To launch an app in LUA you need to use the API call, am_execute( "APPNAME", "ARGUMENTS" );
So to launch remote desktop connection you must do:
am_execute( "%SystemRoot%\\system32\\mstsc.exe", "/v:<server[:port]>" );
But given a single argument you could either connect or explore a server, (assuming the name of the server is "myserver").
// ---
sizeOf = am_getCommandCount();
if sizeOf == 0 then
am_execute( "explorer.exe", "myserver" );
else
word = am_getCommand( 1 )
if word == 'c' or word == 'connect' then
am_execute( "%SystemRoot%\\system32\\mstsc.exe", "/v:myserver" );
else
am_execute( "explorer.exe", "myserver" );
end
end
// ---
You could of course take the name of the server as the argument and connect to it.
Then save the file in your root command folder, (with an appropriate name like "remote connect to myserver.lua", (remember the .lua extension in this case)
Reload piger, (type: [Caps Lock] this.reload)
and voila, your new command, "remote connect to myserver", is created.
F.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To launch an app in LUA you need to use the API call, am_execute( "APPNAME", "ARGUMENTS" );
So to launch remote desktop connection you must do:
am_execute( "%SystemRoot%\\system32\\mstsc.exe", "/v:<server[:port]>" );
But given a single argument you could either connect or explore a server, (assuming the name of the server is "myserver").
// ---
sizeOf = am_getCommandCount();
if sizeOf == 0 then
am_execute( "explorer.exe", "myserver" );
else
word = am_getCommand( 1 )
if word == 'c' or word == 'connect' then
am_execute( "%SystemRoot%\\system32\\mstsc.exe", "/v:myserver" );
else
am_execute( "explorer.exe", "myserver" );
end
end
// ---
You could of course take the name of the server as the argument and connect to it.
Then save the file in your root command folder, (with an appropriate name like "remote connect to myserver.lua", (remember the .lua extension in this case)
Reload piger, (type: [Caps Lock] this.reload)
and voila, your new command, "remote connect to myserver", is created.
F.