Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Hermsen

macrumors newbie
Original poster
Apr 5, 2012
2
0
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
 
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.