Quiting an Application, then restarting the Application?

Hi Folks,

can this be done by Applescript:

When a Application has reached a status, a popup should appear and after pressing “OK” (only the one choice)
the Application should quit and then restart


if Q contains "one" then
try
tell current application
display dialog "National Roaming is not allowed - please refresh the Programm"
set the requested_status to the button returned of the result
end tell
on pressed button "OK" --is this correct?
quit theApplication -- is this correct?
restart theApplication -- is this correct?
end try
end if


Thanks for any suggestions…

Stefan

Hi Stefan,

If you have only one button, there is no need to retrieve the answer.
The try block is only necessary, if you want to trap an error or avoid any error message
actually this is sufficient:

if Q contains "one" then
		tell current application to display dialog "National Roaming is not allowed - please refresh the Programm" buttons {"OK"} default button 1
		quit theApplication
		delay 1
		launch theApplication
end if

Hi Stefan,

thanks a lot for this… The launch is not working, but I think that can be because I am using the Application in the Test Enviroment…

Best Regards,

Stefan

Hi.

It may be that you need run or activate instead of launch. I haven’t checked recently, but the difference between these commands used to be:

launch: load the application into memory.
run: load the application into memory and run it through its normal startup routine “ eg. opening a default document, etc.
activate: load the application into memory, bring it to the front, and run it through its normal startup routine. Alternatively, if it’s already launched or running, just bring it to the front.