I love the Mac OS X Terminal and to do SSH with it. With increasing age I forget the many SSH connection variables. But with some AppleScript I help myself. Here now 3 simple examples.
Example 1:
User and target are hardcoded.
on RunTerminal() set ScriptCommand to "ssh user@123.456.78.9" tell application "Terminal" activate do script with command ScriptCommand in window 1 end tell end RunTerminal on run RunTerminal() end run
Example 2
Dialog for user and only target hardcoded.
global RemoteUser on RunTerminal() set ScriptCommand to "ssh " & RemoteUser & "@192.168.0.1" tell application "Terminal" activate do script with command ScriptCommand in window 1 end tell end RunTerminal on RunDialog() display dialog "Who should it be ?" default answer "root" set RemoteUser to text returned of result end RunDialog on run RunDialog() RunTerminal() end run
Example 3
Dialog for user and list for targets.
global RemoteUser global RemoteTarget on RunTerminal() set ScriptCommand to "ssh " & RemoteUser & "@" & RemoteTarget tell application "Terminal" activate do script with command ScriptCommand in window 1 end tell end RunTerminal on RunUserDialog() display dialog "Who should it be ?" default answer "root" set RemoteUser to text returned of result end RunUserDialog on RunTargetDialog() (choose from list {"192.168.0.1", "example.com", "123.456.678.9"} with prompt "What is your target ?") set RemoteTarget to result as text end RunTargetDialog on run RunUserDialog() RunTargetDialog() RunTerminal() end run
After exporting as Executable you can put it on places where you want. Do not forget the appropriate icon!