Alfred ssh plugin

I use Alfred (http://www.alfredapp.com/) to speed things up on my mac and it is a brilliant bit of software. I pay for the powerpack and have written a little bit of applescript to allow me to ssh to a server from the launcher.

I have it set up to so that “ssh server username” will connect to server as username. If you don’t put it a username it will default to “default”.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
on alfred_script(q)
	set tmp to splitString(q, " ")
 
	set server to item 1 of tmp
 
	if length of tmp is 2 then set login to item 2 of tmp
	if length of tmp is 1 then set login to "default"
 
	set command to "ssh " & server & " -l " & login
 
	tell application "Terminal"
		do script command
	end tell
end alfred_script
 
to splitString(aString, delimiter)
	set retVal to {}
	set prevDelimiter to AppleScript's text item delimiters
	log delimiter
	set AppleScript's text item delimiters to {delimiter}
	set retVal to every text item of aString
	set AppleScript's text item delimiters to prevDelimiter
	return retVal
end splitString

Leave a Reply

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

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">