Scripting


Royal TSX provides a powerful scripting interface based on AppleScript which allows you to automate repetive tasks or integrate certain parts of Royal TSX with other applications.
For a quick introduction and samples please see this KB article.

Web Browsers / HTML / URI Scheme


Since Version 2.1 Royal TSX supports launching Ad Hoc connections from any web browser/web site by using the rtsx:// URI scheme.
Basically, any content after rtsx:// gets passed to the Ad Hoc textfield in Royal TSX. You may also use protocol specifiers (ssh://, rdp://, etc.). Note however, that if you want to specify the protocol to use you have to properly escape the URL (see Example 2 below).

Example 1 :

rtsx://royalapplications.com


When clicking this link, Royal TSX will open (if it isn't already open) and pre-fill the Ad Hoc textfield with "royalapplications.com".
It will also display the dropdown that allows you to select the connection type or template to use for this connection.

Example 2 :
rtsx://web://royalapplications.com 
Clicking this link will result in Royal TSX opening a web page connection to "royalapplications.com" without going through the connection type selection dropdown.
Note that while the link appears nice and clean when rendered on screen it has to be properly escaped in HTML to get the best browser compatibility. If you take a look at the source code of this page you'll notice that the href attribute has the following content: "rtsx://web%3A%2F%2Froyalapplications.com". This is something to remember when using our URI scheme. Not properly escaping special characters can cause unpredictable results across different browsers.

Please see this KB article for more information on supported options when launching Ad hoc connections.

Application Update

If you wonder what your options for updating Royal TSX to a new version are - read on.
  • Built-in updater (Go to the "Royal TSX" menu and select "Check for Updates...")
    The built-in updater is based on Sparkle, an application update library used by many macOS apps.
  • MacUpdate


Launchers

Flashlight
An official Royal TSX Flashlight Plugin is now available from within Flashlight's Plugin Gallery.
The plugin allows you to open ad hoc connections by either just specifying the hostname/ip or including a protocol specifier (ie. rdp://hostname).
Alfred V2
An Alfred Workflow to open connections can be downloaded here.
The workflow automatically retrieves connections from Royal TSX while typing. (Autocomplete)
If a connection with the entered name cannot be found, an ad hoc connection will be created.
Usage: rtsxopen NameOfAConnection
For ad hoc connections you can also supply the protocol and port: rtsxopen ssh://hostname:22
Alfred V1
An Alfred Extension to open connections can be downloaded here.
Usage: rtsxopen NameOfAConnection
If multiple connections with the same name exist, all of them will be opened.

TeamViewer

Unfortunately TeamViewer doesn't offer a component that we can use to embed a session in Royal TSX. Nor is it open source so we cannot create our own either.
What you can however do, is create a Command Task to launch TeamViewer with a specific Partner ID and (optional) it's password.
To do so, create a new Command Task and fill the following fields with these values:
Command : Contents/MacOS/TeamViewer
Arguments : -i YourPartnerID -P YourPartnersPassword
Working Directory : /Applications/TeamViewer.app
Don't forget to replace YourPartnerID and YourPartnersPassword with matching values.

Also, the working directory might be different on your machine.

FTP with Transmit

Because Transmit is scriptable, you can create a command task for it in Royal TSX.
Here's a sample:
Command: osascript
Arguments: -e 'tell application "Transmit" to tell current tab of (make new document at end) to connect to address "$URI$" as user "$EffectiveUsername$" with password "$EffectivePassword$" with protocol FTP'
This command task can then be executed against any existing connection as long as the URI, username and password properties are set.


How would you go about adding a custom port number to the ftp/sftp connection?
Transmit supports passing a custom port via AppleScript by specifying "using port 123".
So you can replace the previous arguments with this: -e 'tell application "Transmit" to tell current tab of (make new document at end) to connect to address "$URI$" as user "$EffectiveUsername$" with password "$EffectivePassword$" with protocol FTP using port 123'
That will tell Transmit to connect to port 123. Of course you should replace 123 with the actual port number you want to connect to. You can also enter the port number in one of the custom fields of your context connection and refer to that by using $CustomField1$.
Does Royal TS/X have a port variable like $PORT$ instead of using a $CustomField1$?
There are port tokens for each connection type that has a port setting (currently all but web page connections). You can find those by navigating to the connection type you'd like to use the task on in the token menu.
But I don't think the port of a SSH or RDP connection for instance would be of much use to you in this scenario because it will probably differ from the port you use for FTP. e.g. RDP runs on port 3389, FTP on port 21. That's why I suggested putting the FTP port in a Custom Field.

Screenhero

Here's a sample to integrate Screenhero connections in Royal TSX using Command Tasks.
Command : osascript
Arguments : -e 'tell application "Screenhero"' -e 'set buddiesStrs to get_online_buddies "$this.CustomField1$"' -e 'set buddyList to {}' -e 'repeat with buddyStr in buddiesStrs' -e 'set oldDelimiters to AppleScript'"'"'s text item delimiters' -e 'set AppleScript'"'"'s text item delimiters to ":::"' -e 'set aBuddy to every text item of buddyStr' -e 'set AppleScript'"'"'s text item delimiters to oldDelimiters' -e 'copy aBuddy to the end of buddyList' -e 'end repeat' -e 'set buddyId to first item of (first item of buddyList)' -e 'start_screenshare buddyId' -e 'end tell'

Custom Field 1 : The buddy name you want to share your screen with