[Gambas-user] Gambas scripter

Ron ron at ...1740...
Thu Dec 31 14:56:24 CET 2009


Benoît Minisini wrote:
>> Ron wrote:
>>     
>>> Some first experiences building scripts using gbs2
>>>
>>> Is it possible to display the errors at end of the output?
>>> If you execute a large script from shell and have a compile error you
>>> keep on scrolling up to see the error.
>>>
>>> Or even better when there is an error on a line, display the script
>>> source until that line number with the error below it.
>>> Maybe this is difficult because of the way scripting works. And/or
>>> display line numbers in front of source code lines.
>>>
>>> Another thing, there is no way to get the file name of the script from
>>> within the code.
>>>
>>> Application.Args[0] =
>>> /tmp/gambas.1000/script-cache/75ee02d930493c0fdc45e92c5b297df5
>>>
>>> Application.Name =  6dc71006365626c9524efb11972ce2af
>>>
>>> Script name in this case was 'callerid.script'
>>>       
>> Application.Path is also pointing to the cache/tmp directory instead of
>> the real location of the script.
>> Application.Path = /tmp/gambas.1000/script-cache
>>     
>
> Yes, this is logical but annoying. I have no workaround at the moment yet.
>
>   
>> I begin to see now, why I couldn't use it that easily last time.
>>
>> If you have to start using things like 'EXEC [ "pwd" ] TO sPwd' to get
>> the current dir it doesn't make sense to use a Gambas script.
>>
>>     
>
> There is no current directory in Gambas!
>
>   
Are you sure?

By currentdir I mean the directory you started the Gambas app from.

This works in a Gambas Command Line or GUI app.

' Gambas module file

PUBLIC SUB Main()

  PRINT Application.Path

END

returns /home/ron/desktop, if the executable was saved and started from 
desktop. /tmp if started from /tmp

But doesn't work in a script like you said above.

The EXEC pwd works in a script, return the correct path, but is a bit silly.

Regards,
Ron_2nd.




More information about the User mailing list