Skip to content

Instantly share code, notes, and snippets.

@amoblin
Created August 24, 2012 03:21
Show Gist options
  • Select an option

  • Save amoblin/3445107 to your computer and use it in GitHub Desktop.

Select an option

Save amoblin/3445107 to your computer and use it in GitHub Desktop.

Revisions

  1. amoblin revised this gist Aug 24, 2012. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions autologin.applescript
    Original file line number Diff line number Diff line change
    @@ -4,29 +4,29 @@ set username to ""
    set login_passwd to ""
    set passcode_prefix to ""
    set dest_ip to ""
    set init_command to ""

    set host_name to "10.210.224.66"
    set terminal_name to "Terminal"
    set delay_time to 1

    tell application terminal_name
    activate
    tell application "System Events"
    activate
    tell application "System Events"
    keystroke "t" using {command down}
    delay delay_time
    keystroke "ssh " & username & "@" & host_name & "\n"
    delay delay_time
    keystroke login_passwd & "\n"
    keystroke "ssh " & username & "@" & host_name & "\n"
    delay delay_time
    keystroke login_passwd & "\n"
    delay delay_time
    keystroke passcode_prefix
    delay delay_time
    end tell

    display dialog "ESCODE: " default answer "1"

    tell application "System Events"
    keystroke (text returned of the result) & "\n"
    tell application "System Events"
    keystroke (text returned of the result) & "\n" & dest_ip & "\n"
    delay delay_time
    keystroke dest_ip & "\n"
    keystroke init_command & "\n"
    end tell
    end tell
  2. amoblin created this gist Aug 24, 2012.
    32 changes: 32 additions & 0 deletions autologin.applescript
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    #!/usr/bin/osascript

    set username to ""
    set login_passwd to ""
    set passcode_prefix to ""
    set dest_ip to ""

    set host_name to "10.210.224.66"
    set terminal_name to "Terminal"
    set delay_time to 1

    tell application terminal_name
    activate
    tell application "System Events"
    keystroke "t" using {command down}
    delay delay_time
    keystroke "ssh " & username & "@" & host_name & "\n"
    delay delay_time
    keystroke login_passwd & "\n"
    delay delay_time
    keystroke passcode_prefix
    delay delay_time
    end tell

    display dialog "ESCODE: " default answer "1"

    tell application "System Events"
    keystroke (text returned of the result) & "\n"
    delay delay_time
    keystroke dest_ip & "\n"
    end tell
    end tell