Applescript editor help

Discussion in 'Mac Apps and Mac App Store' started by Hermsen, Apr 13, 2012.

  1. Hermsen macrumors newbie

    Joined:
    Apr 5, 2012
    #1
    This is my script and it works how i want to exept when it ejects the disk name that i want it to its fine, then i want the script to close but the script will stay open any idea's on how to get the script to close when the disk name is ejected? thanks.
    property appname : "TestTaker"
    property diskname : "Training_NTE"

    tell application "Finder"
    mount volume "afp://nwea01:nwea@10.1.0.1/Training_NTE"
    --> file
    "Training_NTE:"
    get end
    end tell
    tell application "TestTaker"
    activate
    end tell
    repeat
    tell application "Finder"
    set appIsRunning to appname is in (name of every process)
    end tell
    if not appIsRunning then
    tell application "Finder" to eject diskname
    if true then
    quit
    end if
    repeat until appname = false
    end repeat
    end if
    end repeat
     
  2. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    Infinite loop

    Strange your script actualy works. In my opinion and believe me I can be wrong too, this piece of code below can never return true or false because you've assigned the property appname a value with your property appname : "TestTaker" line.

    Code:
    repeat until appname = false
    end repeat
    I'm guessing but you want to eject the disk after you've taken a test with the application TestTaker. So when you close application TestTaker the disk will eject.

    Try this :

    Code:
    property appname : "TestTaker"
    property diskname : "Training_NTE"
    tell application "Finder"
    	mount volume "afp://nwea01:nwea@10.1.0.1/Training_NTE"
    	--> file
    	"Training_NTE:"
    	get end
    end tell
    tell application "TestTaker"
    	activate
    end tell
    repeat
    	tell application "Finder"
    		set appIsRunning to (name of every process)
    		if appname is not in appIsRunning then
    			eject diskname
    			exit repeat
    		end if
    	end tell
    end repeat
     

Share This Page