[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gambas script capabilities


To preserve the existing file authorisations when opening note the Stat and
restore it when saving.

 hStat As Stat = Stat(sFilename)

Then when it's saved..

File Save(sPath, sData)
Chmod sPath To hStat Auth

You can also restore user and group from the Stat if needed
Chown sPath To hStat User
Chgrp sPath To hStat Group

Or you can use shell.  chmod +x filename

Or for testing just run in a terminal adding gbs3
$ gbs3 filename

That way it does not need the #!/shebang or to be marked executable.

BruceS

On Fri, 9 Oct 2026, 22:21 olivier.cruilles, <olivier.cruilles@xxxxxxxx>
wrote:

> Hi Brian,
> I found the issue, it's on my side.
>
> If I edit the script generated by gbs3 into my Editor and if I save it
> with File.Save() function, apparently it break something.
>
> I'm investigating what does File.Save() to break the internal structure of
> the original file.
>
> Thank you for you answer
>
> Olivier Cruilles
>
>
> Le 9 octobre 2026, à 17:00, Brian G <brian@xxxxxxxxxxxxxxxx> a écrit:
>
>
> On 10/9/26 11:29, Olivier Cruilles wrote:
>
> Hello everyone,
>
> I’m currently testing a little more Gambas Scripting capabilities and I
> would like to have your opinion please.
>
> As I remember, it was possible to create simple graphic application into a
> *.gbs script
> but trying to convert a simple Graphic App ‘Hello world' into a simple
> Form + a button Quit -> to a script .gbs using the command ‘gbs3
> —convert-project /path/to/helloword/app’ , produce a script .gbs file but
> it does not work when I run it.
>
> Just to clarify if it’s really possible have simple graphic forms into a
> .gbs script or not at all ?
>
> Thank you
>
>
> Olivier
>
> I hope this helps Olivier, as I said send my you project I can have a look
>
> Attached is the source project
>
> Here is the command i used to convert it
> gbs3 --convert-project   /home/brian/test/ProjToScr   /home/brian/bin
>
> Here is the script it created
>
> --------------------------------------------------------------- cut here
> -------------------------------------------------------------------
> #!/usr/bin/env gbs3
> 'Auto Generated Script 10/09/2026 20:52:12.101 Version (3.22.99)
> #Script Startup="FMain"
> #Script Version="0.0.1"
> Use "gb.image"
> Use "gb.gui"
> Use "gb.form"
> class FMain
> ' Gambas class file
> End class
>
>
> form FMain
> # Gambas Form File 3.0
>
> { Form Form
>   MoveScaled(0,0,64,22)
>   { TextLabel1 TextLabel
>     MoveScaled(4,5,49,11)
>     Font = Font["Noto Mono,Spacing=1.5,+6"]
>     Text = ("hello world")
>   }
> }
>
> End form
> ------------------------------------------------------------------ cut
> here -----------------------------------------------------------------
>
> Here is what appears on screen when run
>
> [image: pic]
>
> --
> ~~~~ Brian
>
>

Follow-Ups:
Re: Gambas script capabilities"olivier.cruilles" <olivier.cruilles@xxxxxxxx>
References:
Gambas script capabilitiesOlivier Cruilles <olivier.cruilles@xxxxxxxx>
Re: Gambas script capabilitiesBrian G <brian@xxxxxxxxxxxxxxxx>
Re: Gambas script capabilities"olivier.cruilles" <olivier.cruilles@xxxxxxxx>