VNC Connect Applescript

At the studio we run a Mac based network with multiple servers and clients. With remote desktop enabled on the Macs or a VNC server (such as Tight VNC) on Windows it’s easy to view and control the screens of remote systems. Which is pretty handy when most of your systems are located in a distant machine room and don’t want to get off your chair.
While it’s pretty easy to select the computer in the finder and press screen share, I decided to write an Applescript to streamline the process of frequently connecting to same remote systems and thought I would share it in case anyone finds it useful.

The remote systems will need to have a static IP address and this script will only work with OSX 10.5 and up.
To customise the script all you need to do is change the values in the lists and ensure that the name and address values keep their relative position in the list. You can also add more than three systems by just adding to lists.

 

(* VNC Connect script v1 www.sandymilne.com *)

on get_pos(aCompterName, aList)
	repeat with theItem from 1 to the count of aList
		if item theItem of aList is aCompterName then return theItem
	end repeat
	return 0
end get_pos

(* Set computer address and Names *)

set computerNameList to {"Server", "Windoze", "iMac 1"}
set computerAddressList to {"10.0.0.8", "10.0.0.6", "192.168.1.22"}


set selectedHostName to choose from list computerNameList with prompt "Select a host:"

if selectedHostName is not equal to false then
	set connectwith to item (get_pos((selectedHostName as string), computerNameList)) of the computerAddressList
	
	do shell script "open -W vnc://" & connectwith
end if



 

You can download the script here:
VNC Connect.zip

Leave a Reply

Your email address will not be published. Required fields are marked *


*