[Gambas-user] I added "External Tools" to my gambas :)

Brian G brian at westwoodsvcs.com
Sat Jan 29 17:12:22 CET 2022



"Failure is the key to success; 
 each mistake teaches us something"  .. Morihei Ueshiba
Brian G

----- On Jan 28, 2022, at 1:32 AM, Benoît Minisini g4mba5 at gmail.com wrote:

> Le 28/01/2022 à 07:00, Brian G a écrit :
>> What ever happened to gb.scripter?
>> 
>> It provided may of these functions.
>> 
>> --
>> Thanks
>> Brian G
> 
> To use a script as a library, we can use the "gbs3 --plugin" feature.
> 
> But we would need it to generate an executable only if the script has
> changed. Maybe it already checks that?
> 
> --
> Benoît Minisini
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

Yes scripter only generates an executable when the script changes.

I have been using a script manager to overload the scripts internally
the manager checks when the script changes content, then creates a new class name compiles it and loads it,but manages the access to the class/object through the management interface.
Then the next time the program runs the updated script becomes the new base.

I attach a sample program using that management class

Example :

 Scripts("PrintAnything")
  Scripts("ToLower")
  Dim myfile As String = File.Load(User.home &/ ".gambasscripts/ToLower")
  myfile = Replace(myfile, "next", "next\nPrint \"added at " & Str(Now) & "\"")
  File.Save(User.home &/ ".gambasscripts/ToLower", myfile)
  Scripts("ToUpper")
  Scripts("ListClasses")
  With Scripts
    !PrintAnything([1, 2, 3, 4, 5, 6])
    Print !ToLower("THIS IS BIG AND UCASE")
    !ListClasses()                                         ' check the list of classes
    Scripts("ToLower")                                     ' recompile the updated script
    Print !ToLower("THIS IS BIG AND UCASE")
    !ListClasses()                                         ' check the list of classes
  End With
  
  Print "The next time you run the program then the script is the original class"



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ExamplePluginScripts-0.0.1.tar.gz.gmail.txt
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220129/f37f16ac/attachment-0001.txt>


More information about the User mailing list