Unable to quit AS application

Hello,

Using this code:


if dsLocal is "2" then
	try
		display dialog "error"
		error
	on error
		display dialog "stop"
		quit
	end try
end if
display dialog "3"

does work in AS editor, but when I save the script as a application, I keep getting the last step. Dialog “3”

What I want is depending in the value in the variable dsLocal the application will continue or quit.

What am I doing wrong?

I tried the following code aswel:


try
	if dsLocal is "2" then
		display dialog "error"
		error
	end if
on error
	display dialog "quit"
	quit
end try

display dialog "3"



getting the same result: does quit in AS editor, not in the AS application

Using the code

quit application "appname"

instead of quit does not help.

AppleScript: 2.2.1.
Browser: Safari 525.20.1
Operating System: Mac OS X (10.5)

Hi ASCA,

You can also simply use a «return» statement to end the script:


property dsLocal : "2"

try
	if dsLocal is "2" then
		display dialog "error"
		error
	end if
on error
	display dialog "quit"
	return
end try

display dialog "3"

Try this:

try
	if dsLocal is "2" then
		display dialog "error"
	end if
on error
	display dialog "stop"
	return
end try
display dialog "3"

Doh! I was too slow. :frowning:

thanks, that did the trick…