RDC Shortcut

Since I do occasionally have to fiddle with a Windows server, and there are
little things about Microsoft’s [Remote Desktop Client][rdc] that bug me (only
one session open at a time, for example), I wondered if the matter was
scriptable somehow. Here’s one way (after installing [rdesktop][rdesktop]
via DarwinPorts):

#!/bin/bash
#
RDC=”/opt/local/bin/rdesktop -a24 -g 1024×768″
#
set -x
if [ "X$DISPLAY" = "X" ]; then
open-x11 $0
else
exec $RDC -ushloob example.com
fi
{: lang=bash }

The interesting thing (to me anyway) is having the script exec itself inside
X11, to avoid having two dumb files laying around for each server listed. (A
benefit that becomes irrelevant if you wrap it up in a nice, tidy AppleScript
bundle so it is doubleclick-able).

If you’re enough of a command-line wonk to think a slew of new scripts in
your path is actually a shortcut for something, just put a copy of this in
your path for each server and mark them all executable. Building a generic
script that creates a temporary file (open, for which open-x11 is simply a
wrapper, doesn’t let you specify arguments to the command) and flings that
at X11.app is left as an exercise.

[rdc]: http://www.microsoft.com/mac/otherproducts/otherproducts.aspx?pid=remotedesktopclient
[rdesktop]: http://darwinports.opendarwin.org/

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Comments are closed.