views:

101

answers:

1

As part of an InstallationCheck script on OS X I need to use finder dialogs to let the user browse for files. When I'm done I want to move the installer application up front again so that the user can easily continue with the installation.

I have already tried the simple:

tell application "Installer" to activate

This does not work because as long as I am inside the script the Installer application is unresponsive and when i try to activate it the applescript will try to wait until Installer responds, effectively locking the program until the InstallationCheck script times out.

So basically I need a way to focus an application that works even if it is currently unresponsive. Is there any way to do this either from an applescript or directly from the perl script?

+3  A: 

try

 ignoring application responses
    tell application "Installer" to activate
 end ignoring

you could also try something like this

 tell application "System Events"
    set installer to application file of application processes whose name is "Installer"
 end tell
 tell application "Finder" to open installer
mcgrailm
This does indeed prevent it from locking, but if the application is unresponsive activating it still doesn't do anything. Useful as a safety if you don't know what state the application is i guess but shouldn't there be some: 'tell application "Finder" to move application "Installer" to front'?
MatsT
note that second bit of code assumes there is an app with that name running
mcgrailm
That appears to do nothing at all, no matter if the application is responsive or unresponsive, or not running at all.
MatsT
what does it say in the event log ? also do you you have universal access turned on ?
mcgrailm
I eventually worked around the issue by speeding up the InstallationCheck enough that the user will not reach the unresposive point before it is finished. Thanks anyway!
MatsT