Automate connections and key sequence task

Hello,

I’ve tried searching but no luck. I’m wondering if it is possible to run a batch file to automatically connect to a connection in a document and then execute a key sequence task after it connects?

I currently have a batch file that will upload a csv file to a server, then use the below command to connect to the server.

“C:\Program Files\RoyalTS\RoyalTS.exe” /protocol:terminal /using:name /uri:“dev1”

Which works great, but I want to add to it. When I connect to the server, I want a key sequence task to run after it connects. Is that possible with a batch file? I know you can set the task to run in royals but I only want this task to run when my batch file runs.

High level overview of the batch file:

  1. use winscp to automatically upload a csv file to a certain location on the linux node.

  2. if it is successful - connect to the node with the command above.

  3. run key sequence task that calls a script on the linux node to process the csv file.

Thanks in advance.

You can use the /property:<name>=<value> command line option to specify or “override” the key sequence configuration of your connection:

https://content.royalapplications.com/Help/RoyalTS/V4/index.html?advanced_commandline.htm

Something like this:

/property:KeySequenceEnabled=true /property:KeySequenceMode=2 /property:KeySequenceName=NameOfKeySequenceTaskObject

You can find all properties for RemoteDesktop connections here:

https://content.royalapplications.com/Help/RoyalTS/V4/index.html?scripting_objectproperties_royalrdsconnection.htm

Alternatively you could create dynamically a document with all the connections and tasks using a PowerShell script and ensure the key sequence is executed accordingly…

I hope this helps.

Regards,
Stefan

below is what I have in my batch file. it still connects but doesn’t run the task. Does the task have to be in the same document as the connection? Is there a way to add a wait before running the task? maybe it’s trying to run it before it’s actually connected to the node?

“C:\Program Files\RoyalTS\RoyalTS.exe” /protocol:terminal /using:name /uri:“dev1” /property:KeySequenceEnabled=true /property:KeySequenceMode=2 /property:KeySequenceName=“Printer - Add”

Thank you

I’m sorry for the confusion. The property override only works for ad hoc connections. I’m afraid the only solution for your use case is to create a document using a powershell script.

Regards,

Stefan

In case anyone is still interested in this, I believe you can achieve what B3nd3r was asking for by making a template with the key sequence task embedded in it, then refer to the template as an adhoc connection to “dev1”:

RoyalTS.exe
/protocol:terminal /using:adhoc /uri:dev1 /usingtemplate:name
/template:<name of template>