Hello,
As part of my on-going project, I use a choose application command. I also am using the command:
on applicationShouldTerminateAfterLastWindowClosed_(sender)
return true
end applicationShouldTerminateAfterLastWindowClosed_
The problem is that when I press “Cancel” on the choose application window, it terminates my application even though that I still have my main window open. Is there a fix for this?
Thanks,
TechExpertHD
Wrap your “choose application” statement in a try block and trap error number -128 yourself.
Hmm, still doesn’t work… here is my code:
on myButton_(sender)
try
set randomVar to (choose application with prompt space & space & tab & tab & tab & tab & tab & tab & tab & tab & "Choose an application.")
set otherVar to randomVar
end try
end myButton_
Your code works for me.
Could it be that your window is really a panel?
A ha! Works like a charm.
Thank you very much!
TechExpertHD