help with quit function

hello everyone,

i have prepared a nice program for using it inline with transmission for torrents. What it does is enables/disables Transmission speed limit when the programs listed in a .txt file are running.

ftp://cncstudios.homeip.net/Public/

It’s a typical program which uses infinite loop. So I know there is the problem with quiting.

I cannot make the program quit when I quit the Transmission.

Since I am not really in Applescript and I really don’t have enough time to learn about handlers etc, can anyone please help me make it quit?

thx in advance.

p.s. the program is free for use, change etc.

Model: imac g5 isight
AppleScript: 2.0.1
Browser: Firefox 3.5.1
Operating System: Mac OS X (10.5)

Very easy to do, just add this to your infinite loop. What it does is it asks system events to check if Transmission is running. If it can’t find Transmission (because it isn’t running) then it errors… so that’s when we quit the applescript. So if you quit Transmission the applescript will quit too.

try
	tell application "System Events" to get first process whose name is "Transmission"
on error
	tell me to quit
end try

you are so the man…!

it almost worked flawlessly. the only change I made was:

instead of:


try
   tell application "System Events" to get first process whose name is "Transmission"
on error
   tell me to quit
end try

I used:


try
   tell application "System Events" to get first process whose name is "Transmission"
on error
   exit repeat
end try

and after the end repeat i added the tell me to quit!.

Thank you very much for quick help!

You can find the updated version for download in Scriptbuilders forum section!
http://scriptbuilders.net/files/transmissionautospeedlimit1.1.html

Model: imac g5 isight
AppleScript: 2.0.1
Browser: Firefox 3.5.1
Operating System: Mac OS X (10.5)