[Gambas-user] Filename as string

Doriano Blengino doriano.blengino at ...1909...
Thu Feb 19 07:54:41 CET 2009


richard terry ha scritto:
> On Wed, 18 Feb 2009 11:01:48 pm FoxIII wrote:
>   
>> I have managed to sort this out now. I am using the code;
>>
>>   TextBox1.Text = File.Dir(Dialog.path) & "/" & File.Name(Dialog.path)
>>
>> But (and I don't know if I should start a new topic or not) I am curious as
>> to how to run a command from gambas. For example, when you are installing a
>> 'deb' file, you get a window displaying what is happening with the install
>> rather than seeing it through the command line.
>>     
You use the SHELL instruction to execute external commands. A single 
string argument to SHELL is the command you want to execute, as you 
would type it on a bash command line. A variation of SHELL is EXEC -- 
see the docs.

If you want to capture the output in a simple way, use the TO modifier 
(and WAIT). Seeing that you speak about installing deb files, things get 
more complicated because installing a package is a slow process, and 
probably you want to see intermediate results as soon as they appear...

One way to do this is to use "full gambas" code, where you read the 
output from process and manage to put it on a widget. Another way, 
simple and quick, is to use an xterm or something similar. Try this:

    mrxvt -e sh -c "ls |less"

(mrxvt is a terminal emulator like xterm or konsole or so). Another 
command could be:

    mrxvt -e sh -c "ls; echo Press ENTER; read a"

Use something like this in the argument of a SHELL or EXEC, and have fun :-)

More info if you want - regards,

-- 
Doriano Blengino

"Listen twice before you speak.
This is why we have two ears, but only one mouth."





More information about the User mailing list