Archive for the ‘applescript’ Category

ARDAgent version

If you administrate a number of Mac clients you’ll no doubt be familiar with Apple’s Remote Desktop. As is the case with most software additional functionality becomes available in new release and ARD is no exception. Hence the ARD client version is a relevant piece of information and when I needed to get the information from a user without using Remote Desktop itself I came up with the following code. (more…)

New Terminal tab with pwd

Just a quick snippet I’m using to open a new tab in Terminal. It accepts a single, optional argument which will override cd’ing to the working directory.

#!/usr/bin/env bash
 
if [[ $# -eq 0 ]]; then
	dir=`pwd`
else
	dir=$1
fi
 
/usr/bin/osascript \
-e "tell app \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down" \
-e "tell app \"Terminal\" to do script \"cd $dir\" in front window" \
-e "tell app \"System Events\" to tell process \"Terminal\" to keystroke \"l\" using control down"

I’ve put the shell script in “/usr/local/bin” as this is in my $PATH. I’ve named the script “tab” so whenever in Terminal I can enter “tab” to open a new tab with the current working directory ready and waiting. Very useful when working with Rails and multiple shells.

Steal iChat Buddy Image

This is an old script I’ve had lying around in my Code folder for a while now. It’s still pretty useful, even in Leopard. It basically takes a buddy’s image of your choice and uses it as your own. Furthermore, it attempts to save a copy of the buddy image on your desktop. It can be quite entertaining if not functional on occasions. (more…)

SSH Remote Desktop Selection

A while back I was asked by a colleague if I could automate starting a number of SSH connections based on the current selection in ARD. This may seem pointless given that you can run UNIX commands in ARD but it is not. With SSH you get an interactive shell; quite different from just being able to send commands and receive a sample of the response! (more…)

Applescript to Quit Process

I often find my ARDAgent process goes haywire what with all the IPSEC tunnels I work with. It became a chore having to relaunch it from the CLI or using Activity Monitor so I blasted out a clumsy Applescript to do it for me. (more…)

SSH Remote Desktop Selection

Apple Remote Desktop is an invaluable tool in the Mac sysadmin world providing functionality above and beyond the likes of VNC. There are however, a few things that we can’t do. For a lot of really geeky work we need an interactive shell via SSH. The problem is ARD only provides a simple Send UNIX command utility that pales in comparison to a fully functional SSH connection.

I made an applescript for a colleague of mine who wanted to be able to SSH a selection of machines in ARD. It’s not too smart as it doesn’t pull usernames or passwords from anywhere but it does speed up opening a connection to a target machine. (more…)