VC General Commands as a shell option

Discussion and questions about programming with Ultibo.
pjde
Posts: 383
Joined: Tue Feb 09, 2016 6:21 am
Location: Sydney, Australia

VC General Commands as a shell option

Postby pjde » Thu Apr 12, 2018 7:52 am

For anyone interested, the attached file will allow one to invoke VC general commands from a shell.

The command is GENCMD and use

GENCMD commands
to list all commands available.

You need to add the unit to your uses clause and add the line

ShellRegisterCommand (TShellCommandGC.Create);

somewhere in your program.

Enjoy

Paul
Attachments
uGenCmd.zip
(957 Bytes) Downloaded 21 times
User avatar
Ultibo
Site Admin
Posts: 1977
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: VC General Commands as a shell option

Postby Ultibo » Mon Apr 16, 2018 12:22 am

pjde wrote:For anyone interested, the attached file will allow one to invoke VC general commands from a shell.

Thanks Paul, I've been trying this out and it is an excellent way to make this functionality available.

If you don't mind we'll add it to the Ultibo release under the ultibounits package so it is always available.

Just one small change, the buffer used by TShellCommandGC.DoCommand should be declared locally to the function like this:

Code: Select all

var
  i : integer;
  s, l : string;
  buffer : array [0 .. 1023] of char;
begin
 Result := false;
 ...

instead of being declared in the class, that way it is allocated on the stack which makes the class thread safe.

And of course the ShellRegisterCommand() call can be added to the initialization section so it just automatically registers.
Ultibo.org | Make something amazing
https://ultibo.org
pjde
Posts: 383
Joined: Tue Feb 09, 2016 6:21 am
Location: Sydney, Australia

Re: VC General Commands as a shell option

Postby pjde » Mon Apr 16, 2018 1:18 am

Do with it as you wish.

Regards

Paul

Return to “General”

Who is online

Users browsing this forum: No registered users and 0 guests