Skip navigation

Xcode/AppleScript App - bring window to front

678 Views 2 Replies Latest reply: Oct 16, 2012 10:50 PM by tuscan RSS
tuscan Calculating status...
Currently Being Moderated
Oct 10, 2012 6:16 AM

i have built an xcode/applescript wrapper application which executes a unix shell script. while the shell script is running (downloading + installing stuff, takes several minutes), the wrapper application is displaying an animated NSProgressIndicator (spinning circle). the idea behind this is that the user knows: as long as i see this progress indicator, the shell script is still busy. this all works fine.

 

however, as soon as a different application is covering the window of my wrapper application, i cannot bring my app's window to the front again by clicking on its dock icon or pressing cmd-tab. using exposé (mission control) it works fine. as soon as the shell script has finished, everything is back to normal.

 

it seems like the app is not responding to some events while waiting for the shell script to finish. what am i missing, any ideas?

MacBook Pro, Mac OS X (10.7.4), 13" 2.8 GHz i7 (late 2011)
  • red_menace Level 6 Level 6 (14,275 points)
    Currently Being Moderated
    Oct 10, 2012 3:30 PM (in response to tuscan)

    Your application won't be able to respond to events if you are blocking the UI, such as running a long shell script or AppleScript without periodically giving the run loop a chance to do its thing.  You might take a look at running the shell script in the background by using NSTask.  Shane Stanley also has a chapter about doing this in his AppleScriptObjC Explored ebook.

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.