Simple Help please!!! (running and hiding a script)

Discussion in 'Mac Programming' started by beencountry, Mar 9, 2010.

  1. beencountry macrumors newbie

    Joined:
    Mar 9, 2010
    #1
    Hey guys I am trying to run a script so that one of my programs will run automatically and then hide right away. The problem is, is that when the program is first booted up in order for it to work properly it needs basicaly a human interaction to hit the "OK" button. I thought I had it correct but it keeps telling me Syntax error. can Some one help me on this? I have it so that it will start and hide right away just I need help programming how to have it "click ok" This is what I have in apple script so far. Thanks for any help in advance

    tell application "BackupManager" to activate
    tell application "BackupManager" to activate
    delay 5
    tell process "AhsayOBM"
    click button "OK" of window "Ahsay Online Backup Manager Logon"
    delay 3
    tell application "Finder"
    set visible of process "AhsayOBM" to false
    end tell
     
  2. mysterytramp macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #2
    I think you're going to need some GUI scripting. It'll be something like:

    Code:
    tell application "BackupManager" to activate
    tell application "BackupManager" to activate
    delay 5
    tell application "System Events"
    tell process "AhsayOBM" 
    	click button "OK" of window "Ahsay Online Backup Manager Logon"
    delay 3
    end tell
    end tell
    tell application "Finder"
    	set visible of process "AhsayOBM" to false
    end tell
    Because I don't have "BackupManager" it'll be difficult to give you the code precisely, but if you google "GUI Scripting" you should see some example code that will tell you how to work System Events.

    mt
     
  3. beencountry thread starter macrumors newbie

    Joined:
    Mar 9, 2010
    #3
    Hey Thanks MT, this helped a lot. I think the main thing I was forgetting was the [tell application "System Events"], but I got it working now thanks to your help. Just now got to figure out how to run it at start up.
     

Share This Page