ML: Launch App via Term locally works, via SSH not fully. Help!

Discussion in 'Mac Programming' started by lokiju, May 13, 2013.

  1. lokiju macrumors 6502

    Jun 10, 2008
    I'm about to go mad here with how much time I've spent on this already.

    I need a way to restart my Time Capsule remotely from time to time to resolve some networking issues that creep up since it's my main router as well.

    I've created a AppleScript and it works fine in both the .scpt and .app formats you can export it as, except ONLY when executed locally on the Mac the script resides on.

    If I SSH in from another Mac or whatever and do for example...
    open ./ <enter> (In this example, it's in my users home directory and the AppleScript is in a .app format)

    It'll actually launch the application (Airport Utility) but will not complete the steps as desired and as it does when executed locally via Terminal or just double clicking on it.

    Here's the code.

    activate application "AirPort Utility"
    delay 4
    tell application "System Events"
    	click image 2 of group 1 of scroll area 1 of window 1 of application process "AirPort Utility"
    	delay 3
    	click menu item 3 of menu "Base Station" of menu bar 1 of application process "AirPort Utility"
    	delay 1
    	keystroke tab
    	keystroke tab
    	keystroke space
    end tell
    My only thoughts are either it's a timing issue and I need to increase the delays or executing via ssh remotely does something different user wise and results in it not fully working.

    Does anyone have any suggestions?
  2. lokiju thread starter macrumors 6502

    Jun 10, 2008
    Anyone out there have any suggestions? Is there maybe a better section to post this in?

    There's been nearly 600 views of this but not a single reply. Surely there has there must be someone who can give some suggestions...

Share This Page