Applescript and Xcode Progress Bar

Hopefully someone here can give me a hand.
I have a very simple script that I would like to share with some of my coworkers who aren't so comfortable with the command line. So I would like to make a GUI with a progress bar using Interface Builder. I've searched high and low but can not find anything current that helps me. I think I might just be misunderstanding how outlets work and such, as I can get the script to run and the window shows, but the bar does not progress.
As a note, I'm using Xcode 4. Any help is greatly appreciated. Thanks in advance.

A couple of things...
Your window and it's contents (including your progress indicator) normally do not redraw while you're within a handler. So chances are that the progress indicator is not getting redrawn until you exit the awakeFromNib handler... at which time your progress indicator has already been incremented to it's max value and so it would redraw as already full.
So, one option is to insert calls to tell your window to redraw after each update. But progress indicators have the ability to update themselves on a background thread. So, in this case, an easier option might be to tell your progress indicator to use threaded animation. So try inserting this at the top of your routine:
myProgressBar's setUsesThreadedAnimation_(true)
Another thing is that the "do shell script..." calls that you're doing are probably happening very quickly since all you're doing is a call to "mkdir". So even after adding the above line of code you may not see much if any difference in how quickly the progress indicator fills up.
You might try adding a small "sleep" to each do shell script call to slow things down a little. For example, for each of your shell script calls you could do something like this:
Change this:
do shell script "mkdir ~/Desktop/dir1"
To this:
do shell script "mkdir ~/Desktop/dir1 ; sleep 0.5"
That will add a half second delay to each shell script call and possibly allow you to see the progress indicator fill up more slowly.
Steve

Similar Messages

  • After updating to iOS 5.0.1 my iphone 4 is frozen on the screen with the apple logo and a progress bar under it. What should i do?

    After updating to iOS 5.0.1 my iphone 4 is frozen on the screen with the apple logo and the progress bar under it. Held the power and home button, the phone shut off, and restarted the progress. If i try to turn the phone on, it keeps telling me to connect to iTunes. Once I do, it asks me to restore, i click restore, but it keeps on freezing at the screen. What is the problem? Error 1603 comes up. Followed the link to apple's page but nothing that was said there worked.

    See Here for
    Unable to Update or Restore
    http://support.apple.com/kb/HT1808

  • I get a black and white logo and a progress bar after upgrade ipad2 5.01

    i get a black and white logo and a progress bar after upgrade ipad2 5.01

    See this page : http://support.apple.com/kb/HT4097 - it covers :
    iPad stops responding, showing the Apple logo with no progress bar or a stopped progress bar, for over ten minutes.

  • I was trying to update my Ipad to IOS 8, the screen is all black with the apple logo on it and the progress bar is stuck,

    I was trying to update my Ipad to IOS 8, the screen is all black with the apple logo on it and the progress bar is stuck.
    I can't turn it off, and when i connect it to itunes, it doesn't display

    Try putting the iPad in restore mode and see if iTunes recognizes it. The steps are below:
    Turn your iPad off.
    Hold down the Home button and plug it into your computer. Keep holding the Home button until you see a screen telling you to connect to iTunes.
    iTunes should show you a popup saying that there is an iPad that is in Recovery Mode and needs to be restored before you can use it. Click OK.
    Click on Restore iPad

  • When attempting to install ios5 iTunes starts to backup the iPod but the back doesn't finish and the progress bar keeps moving left to right, any ideas why please?

    When attempting to install ios5 on my iPod touch , iTunes starts to backup but doesn't get anywhere and the progress bar just keeps going from left to right, any ideas please as to what I can do? Thanks

    Try resetting the iPod while it is connected to your computer.
    Hold the On/Off Sleep/Wake button and the Home button down at the same time for at least ten seconds, until the Apple logo appears.
    Then try again.
    If that didn't help, try restarting the AMDS > iPod touch: How to restart the Apple Mobile Device Service (AMDS) on Windows

  • HT1766 I've just purchased an Iphone 5c. I have chosen the restore from iCloud and the phone has now restarted to complete the restore. It has been 3 hours and the progress bar has not moved.

    I have chosen the restore from iCloud and the phone has now restarted to complete the restore. It has been 3 hours and the progress bar has not moved. I have now tried to reload again by holding the sleep etc, to no avail

    If all you want is your old photos, you could backup your new phone using iTunes, then restore it from your iCloud backup, import the old photos to your computer, then restore it from the backup your made in iTunes returning your newer data to your phone.  If you want your old photos on your phone, sync them there from your computer using iTunes.  The process would look like this:
    Connect your phone to your computer, when it appears in iTunes on the left sidebar right-click on it and select Transfer Purchases; right-click again and select Backup.
    Disconnect from your computer and go to Settings>General>Reset>Erase All Content and Settings to return it to new
    Go through the activation setup, choosing to Restore from iCloud backup.  Make sure your phone is plugged into a charger and has access to wi-fi as this can take hours to complete.
    When complete, without connecting your phone to your computer, open iTunes and go to Preferences.  On the Devices tab check "Prevent...from syncing automatically"
    Now import the old photos to your computer (see http://support.apple.com/kb/HT4083)
    When done, open iTunes, right-click on the name of your phone on the left sidebar and select Restore from Backup, choose the backup you made in step 1.
    Go to the Photos tab and select the photos you want to sync to your phone and sync.

  • Ipod won't play video/podcasts or audio only a black screen with the play symbol and volume/progress bar. games work fine! any ideas?

    Ipod video classic 5th gen won't play video/podcasts or audio only a black screen with the play symbol and volume/progress bar. games work fine! any ideas?

    Here's some more info.
    I tried installing the latest iTunes to my housemate's PC, logging into iTMS with my account, authorizing his machine to play my content, restoring my iPod to the factory settings, downloading the videos and copying them to my iPod.
    It worked fine, and I can play my videos.
    I have done the exact SAME thing on my own home PC twice, after completely uninstalling and reinstalling iTunes, QuickTime, and the Apple Software Updater. But I still can't get any videos downloaded on my home PC to play on my iPods.
    Any thoughts?

  • When i turn my mac on i get the white screen and a progress bar that when finished shuts the computer down

    i recently came back from holiday and tried to start up my laptop (that stayed at home, just shutdown but plugged in). when i turned it on, i got the apple white screen, a timer wheel and a progress bar that when it reached the end of the bar, it just shut the computer down again. i cannot get past this screen and the mac will not turn on. does anybody know how i can fix this please?

    Your hard drive is dead and you'll need a new one. If you're the least bit handy, you can replace the drive yourself. You need to decide what capacity and speed you want out of a new drive.
    I'm hoping that you had backup schemes in place? If not, there's a chance that, with a tool such as DiskWarrior, you MIGHT be able to grab some data from your dead/dying drive.
    Clinton

  • HT1339 what if you click restore and the progress bar is interrupted and says that your ipod is busy? Then what?

    what if you click restore and the progress bar is interrupted and says that your ipod is busy? Then what?

    Reset the iPod - Press Menu and Select simultaneously for about 10 secs or till the Apple Logo comes ON.
    Disconnect the iPod, and all other USB devices
    connect the iPod to another USB Port, and not to a USB hub. (Never connect the iPod to the USB port on the Keyboard.)
    Run Disk Utility -> First Aid->Erase (to correct any filesystem corruption.
    Then run iTunes and Restore.

  • HT201269 I'm updating from my iPhone 4 to the iPhone 5 and have been 'restoring' for 2 hours now and the progress bar still states I hae 6 hours remaining. Will it really take this long? How long should a restore take? It's a 32gb device. Thanks.

    I'm updating from my iPhone 4 to the iPhone 5 and have been 'restoring' for 2 hours now and the progress bar still states I hae 6 hours remaining. Will it really take this long? How long should a restore take? It's a 32gb device. Thanks.

    I am having this problem.  At first with the new iPhone 5, and then with the iPad 2.  I am not sure why this is happening. 
    My gut feeling is this is an iO6 issue and here's why -
    The problem mainly occurs with apps.  I have about 150 apps, and when I plugged in the phone, iTunes went to sync all of them.  The process would hang up after about 20 - 30 apps were loaded onto the phone. I could tell where about the process hung up because the apps on the phone showed up as "waiting".
    Then on the iPad 2 I plugged in to sync and saw there was a huge "Other" component in my storage.  It required me to restore the iPad 2 from backup.  With this restore the same issues occurred - putting the apps back on the iPad would hang up.  The videos on the iPad also got stuck - maybe after about 10 hours of videos transfered iTunes crashed.
    My solution has been to soft reset the device, restart Windows, and continue the process until it's complete.  This is remarkably inefficient and time-intensive but everything works with patience.
    I have been wondering if others have had these same problems. 

  • Ipad screen stuck on Apple logo and empty progress bar.

    Hello,
    My iPad screen is stuck on the Apple logo and empty progress bar. I have tried rebooting the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds but the screen doesn't change.
    The problem arose after I tried to reset the sttings on the iPad after an app wouldn't open.
    Any help would be appreciated.
    Thanks

    1: Connect the device to your computer and open iTunes.
    2: If the device appears in iTunes, select and click Restore on the Summary pane.
    3: If the device doesn't appear in iTunes, try using the steps in this article to force the device into recovery mode.

  • During boot Yosemite shows a grey screen with the Apple logo and a progress bar - is this normal?

    During boot Yosemite shows a grey screen with the Apple logo and a progress bar - is this normal?

    Same here after upgrade yesterday. 
    I can get OS utilities up using CMD R or holding the shift key (eventually), but if I simply then reinstall the OS will it not loose everything on my drive? I do have it backed up on Time Machine? What a nightmare - Apple Support does suck.  I am not paying £25 for them to call me to tell me how to fix a bug in their OS software upgrade.  Any help
    Also does anyone know if it is possible to use time machine to go back to Snow Leopard? I have wasted much of the day on this now
    Cheers
    Simon

  • I just bought the darkness and the progress bar wont fill up, i just bought the darkness and the progress bar wont fill up

    i just bought the darkness and the progress bar wont fill up, i just bought the darkness and the progress bar wont fill up....help

    Hi..
    Not sure what, "progress bar" you are referring to. Did you mean that the app isn't completely downloading??
    Try contacting the app's developer here >  http://support.2k.com/anonymous_requests/new

  • I have a mac book pro still running mountain lion.I haven't powered it on in a few months. now when i try to turn it on all i get is the apple logo and the progress  bar after a few mins. of trying to load my laptop just turns off.can anyone help me

    I have a mac book pro with retina,I haven't turned it on in a couple of months.no problems then, now when I try to turn it on i only get apple logo and progress  bar. After a few mins the laptop just turns off and nothing eles.any help would be appreciated  thanks

    I linked to it above, but here is another link.
    http://support.apple.com/en-us/HT201262

  • Need help with applescript and Xcode 4.3.2

    I'm trying to write my first application that will involve a GUI. I can code applescript using script editor with a bit of effort, but I'm want to have users input more than one piece of information in the pop up. So, I download xcode, create my first applescript cocoa project go to MainMenu.xib and add a bunch of labels, text fields and buttons. Looks fairly nice... Go to start it and... nothing (well the window pops up, but it doesn't do anything). Unfortunately, I haven't figured out how to link the window to the applescript... So, how do I...
    * Have the applescript prepopulate data in the text fields and pulldowns
    * Once the user changes the data in the fields tell the applescript
    * Tell the window to close and pass the control back to the applescript once either the cancel or submit button is pressed.
    More detailed...
    * What's an outlet and how do I use it here? Which of the 18 outlet(s) do i use for this?
    * What's a property (referenced on one of the web pages I saw around applescript and cocoa) and do I need them here?
    Looking at the documentation with xcode, there isn't a lot about xcode and applescipt. Looking at the web, the top links are a few years old. So, links to good relevent documentation would be very nice as well as direct answers to the questions
    Thanks,
    Scott

    I'm not sure why you are closing it, but the NSApplication class is what keeps track of the windows.  If you don't want to connect the window to an outlet from the interface editor, you can use something like
    set theWindow to current application's NSApplication's sharedApplication's mainWindow()
    ...and from there you can use whatever NSWindow methods, for example
    theWindow's performClose_(me)

Maybe you are looking for