Applescript app won't quit

I need a little help.  I have written an AppleScript app that "touches" one of my external drives every 55 seconds to keep it from spinning down.  However, this app won't quit when I depress command-Q ... even though I have included an "on quit" handler.  Can anyone suggest what I need to change to have this app respond properly to command-Q?  Here's the script:
with timeout of 99999999 seconds
          tell application "Finder"
  activate
                    repeat
       do shell script "touch -a /Volumes/TimeMachine/.TemporaryItems"
       delay 55
                    end repeat
          end tell
end timeout
on quit
       continue quit
end quit

AppleScript is not multi-threaded, so the application will never get the quit message because the repeat loop never finishes.  Sitting in a continual repeat loop is not the way to go since it blocks the user interface - instead, resave your application with the option to stay open, and use the idle handler (note that the Finder is not needed for the do shell script command):
on idle
  do shell script "touch -a /Volumes/TimeMachine/.TemporaryItems"
  return 55
end idle

Similar Messages

  • My apps won't quit or re-open

    All of a sudden yesterday my applications started to not quit. I couldn't actually use the apps, the appeared closed, but they still showed as open in the dock and the force quit menu. It wouldn't let me open them again to use them so I had to manually restart with the power button (it wouldn't let me shut down on the OS either). Now it's doing it all the time and it's really annoying, what could be causing it?

    I was having the same problem, minus the error code. When I called Apple they told me to call back when it quits loading and quitting apps. It happened the next day and they sent me to a product specialist who had no clue why the apps would quit responding like that. Finally, I booted to the Leopard DVD and did an erase and install. Time Machine restored my system and everything is working fine.

  • Backup.app won't quit?

    Has anyone seen this phenomenon with Leopard? My wife's new MacBook (with data migrated from an iBook) has Backup set to backup to her dot mac disk and no matter how many times I reinstall the app or delete settings or quit the program, it relaunches itself in about 5 seconds.
    Any thoughts about how to solve this?
    Much obliged,
    Mick

    Deleted your profile?  How were you able to do that since there is no delete profile option.  You can clear out the backup, turning off backup, but this wipeout does not wipe out you list of install apps so when you log back in the apps that were installed willbe resintalled.  Palm Profile dose not backup apps but keeps a seperate log of apps installed and allows reinstall upon a resign into profile.  Only exception is if the app was side-loaded onto the device it will come back but those apps should be free to reinstall.
    The doctor is like a parial erase that also resintalles the webos so it will require resign into profile.  Through your email address for your forum ID I was able to find 2 palm profiles that are still viable with paid apps on them so if you wanna try one of them to get the paid app back we can continue this conversation via Private Message so we are not publicly conveying whats in those profiles.  Also would like to know which paid apps you are concerned with loosing so I can check the profiles to see if they are there afterall.  Keep me posted.

  • Print Proxy Queue Won't Quit

    On my Brother MFC connected by USB, the printer proxy app won't quit after the print job ends, and you have to click the proxy app's icon in the Dock, then quit the app manually. (You have to close it, as the computer won't sleep by itself after x amount of time if the proxy app is left open.)
    This is only intermittent. You can tell in advance if this is going to happen by not seeing a little piece of paper icon superimposed over the printer proxy app's icon in the Dock. No piece of paper icon = proxy app won't quit.
    Tried reinstalling all drivers, archive/reinstall, using Printer Setup Repair to "reset the printing system," permissions, Cocktail to deep clean caches including printer caches, all to no avail. New printing cables, connected directly without a hub. Happened on my HP LaserJet 3330 which died, and now on my Brother MFC-2070. Happened when I was using a Titanium laptop also, before the current G4 tower. Happens across many apps, although Office seems to provoke it more frequently.
    Ideas anyone, short of trying a totally clean install and reinstalling all apps an drivers from scratch to see if that helps? The OS install I'm working on is back from 10.2.0, and has been upgraded and archive/reinstalled multiple times, and has been used on multiple computers over the years. My Word 2004 Normal template dates back to Word 5.1 and has been converted/upgraded several times (6.0, 98, 2001, X, 2004; could this be a culprit as well); should I rebuild it from scratch (hours and hours of work there, many custom menus, etc).
    Quicksilver G4 (2001)   Mac OS X (10.4.3)  

    Never got one answer, give up

  • Mail won't quit when offline

    I have a problem with Mail where, if my internet connection isn't working (some problems at my local cable ISP), the Mail app won't quit and I have to force quit. I just wanted to see if others had this problem and if there is a solution other than force quitting.

    This happens on my machine as well but I also find that force quitting seems to be the only way out....

  • Mail won't quit and won't receive messages

    My Mail.app won't quit (needs to be forced quit) and won't pick up new messages. It does send, but it won't register as having done so. How do I reinstall it? I don't want to have to reinstall Leopard from scratch. It seems to think it's offline, because it eventually times out, but it doesn't say it's offline in the menu and taking it offline and putting it back doesn't help. Thanks.

    try the following:
    1) log in as another user and try to use Mail - if you don't have another user created on your computer, just create one as a test. If with that other user you can access Mail and work in it, then you may have a user specific issue. If you still have the same issue then you may have a Mail specific issue.
    2) If Mail works under another user, then go to application>utilities>disk utility and repair permissions. Then try Mail again under your main user account. If not solved then go to 3)
    3) Do a custom install from your Leopard disk, and re-install Mail only.
    hope this helps.

  • Macbook won't  shut down  because finder won't quit

    Macbook  10.5  Leopard, purchased  October 2007.
    Tried to shut down
    Popup says "logout has timed out because application finder has failed to quit, to try again quit finder and choose logoput from the apple menu"
    I tried  ..... and nothing.  Can't shut down.
    I tried command option escape  and that doesn't work.
    Tried to  force quit, and  that doesn't work. 
    Somewhow   finder is still running no matter what and hence I can't shut down. This is very frustrating
    Is there  any way I can get the computer to have everything  go dark and shut down?  All the obvious instructions  don't work
    I have had to force quit  in the past maybe 2 or 3 times in the past.    No biggie.  But this problem of  not being able to shut down even after force quit is new.
    Nothing is connected to the   macbook except the  external monitor, which has always been there.

    If any of the apps won't quit on you in future, try ti kill them in Terminal:
    killall Finder
    then hit enter
    If you don't know the official app name (how OS SX sees it), go to COMMAND_OPTION_ESCAPE and see the official name in the running app list.
    The power button method above works 100%, but will bypass saving of session states for all services, so your OS X could be unstable after reboot and won't remember some settings you had prior to shuting down. Use it only as a last resort.

  • I keep receiving this error every time I open LR, "Lightroom encountered and error when reading from its preview cache and needs to quit" and the app won't open. It said LR would try and fix this error next time I opened it but the error remains. I tried

    I keep receiving this error every time I open LR, "Lightroom encountered and error when reading from its preview cache and needs to quit" and the app won't open. It said LR would try and fix this error next time I opened it but the error remains. I tried uninstalled and installing the app and the error remains. I have windows 8. Can anyone please help???

    Use Windows Explorer to open the folder containing your catalog. The normal location is Pictures\Lightroom. Locate a folder with the extension .lrdata and delete that folder. Then you should be able to start Lightroom again, and Lightroom will begin building and new previews folder. Do not delete anything else.

  • My dad has a brand new iMac. If he quits an app, this window closes, but the app won't finish shutting down, Force quitting does not work.  Once another app is opened, it will not close either.  Now none of the apps are responding. Any ideas?

    My dad has a brand new iMac. If he quits an app, this window closes, but the app won't finish shutting down, Force quitting does not work.  Once another app is opened, it will not close either.  Now none of the apps on the dock are responding. I asked him to click on the apple, and drop down to "About this Mac", but that wouldn't open either. Any ideas?  If I was at his house, I would call Apple Care in a heartbeat, but am home with my sick daughter,,,  Thanks!

    For starters, have him open Disk Utility in Applications>Utilities, select the volume (the indented listing) and Verify Disk. If it reports any problems, have him try a Safe Boot by holding the Shift key at startup. This boot will take much longer than usual. It's checking and trying to repair the drive directory, if possible. Once in Safe Boot, have him repair Permissions.
    For other Disk repair remedies see
    http://support.apple.com/kb/TS1417
    Also, have him try a PRAM Reset. At the startup chime, hold down CMD-Option-P-R together, listen for two more chimes, total three, then let go to finish booting.
    Also, is he running any AV? If so, have him uninstall it. It might be responsible for this behavior. (There are no viruses for OS X.)

  • Mail.app using 80% CPU and won't quit - any ideas?

    Hi, I'll try and cut a short story shorter...
    I tried to begin using Mail.app last night instead of Entourage and Thunderbird just to see what it was like. Having never used mail.app before, I use the bundled import wizard to retrieve the settings from the Entourage account (POP, wifes ISP account) which seemed to work ok. I didn't test at this point as I have another account (POP again, my gMail) stored on Thunderbird which I also wanted to import.
    To import the mailboxs from Thunderbird I copied the relevant folders from the ~\Library...\myprofile\... folder to the desktop and added the .mbox extension. Then used the import wizard 'other' option to bring them in.
    All seemed to go ok. I recreated my 'other' account manually and sent/received some test mails etc. then marked everyting in all mailboxes as read.
    At this point the laptop went very slow so I checked Activity Viewer - this showed Mail.app hovering between 70% - 80%. I thought this was a bit odd so I tried to Quit Mail, but it just hung. I then force quit and the CPU calms down.
    I opened Mail again and it was ok for about 3 minutes until I try to view various mailboxes. Mail is still responsive but the mailboxes are empty! I use the rebuild function and they show the messages again, unless I look at a different one and then go back to the rebuilt mailbox - it's empty again.
    Then the CPU/won't quit happened again. CPU is up at the same levels, Mail.app has 7 threads. I thought there may be some indexing going on so I went to bed. I got up this morning to find the G4 fans going crazy and CPU still consuming the CPU?
    Any ideas?
    I'm thinking I may trash both accounts and rebuild from scratch tonight.

    Hi Ian.
    Aside from whatever the problem is here (which I don't really know), you shouldn't add an .mbox extension to mbox files in order to import them into Mail. Mail uses that extension for something else. Also, you'd get better results using Eudora Mailbox Cleaner to do the conversion.

  • Ensure AppleScript App Quits

    I have an AppleScript saved as a run only app which I call every hour from launchd.
    Most of the time it works fine, but occasionally something causes the app not to quit when it's done its thing.  This means that next time an error is thrown and the process does not run (so it fails until I force quit the app).
    I have tried wrapping the whole script in a try...with timeout...end timeout...on error return...end try structure but that makes no difference.
    The core of the script is a run shell script that calls a perl script which in turn gets data from a web site.  I have tried nesting a try...on errror...end try around this that simply sets the content of the variable that should be populated from the script in the event that any error occurs.
    The final part of the script is opening a [text] file and inserting a few lines at the top.  Again I have tried wrapping this in a try...on error return...end try stricture.
    None of these efforts seems to have any effect.  However, I can't get the script to fail when I run it from the ApplScript Editor.
    Would I be better to use osascript to call a script rather than the app, or am I doing something more fundamental wrong?

    I'm not trying to be coy either, but I don't see that posting the whole script is going to help particularly because the perl script uses WWW::Mechanize to get data from a website where I have to provide user credentials - hence, it will not be possible to run it without those credentials.
    The expectation is that I will get approximately ten lines of data back (which I put into a local variable).  I then use an offset check to determine whether a particular string is present.  If it is present, I then go on to compose a message (using Messages) to send to myself.
    Regardless of the content, I open a local text file and insert the web response at the beginning of the file (as an activity log).  The file is then closed for access and that's it.
    I have only once seen an error when I ran the script from the AS Editor and this seemed to indicate a problem with the site's availability - so when Mechanize couldn't find any identifiable data, it threw an error.
    The app is not saved as stay open, but it does.  All I can say for certain is that the log file does not get written to, so I suspect that the problem lies with the perl script.  It is for that reason that I wrapped it in a try...with timeout structure.  (My understanding of the timeout, is that if script execution fails to complete within the timeout an error will be thrown, so this is picked-up by the try...on error.  That understanding may be wrong.)
    So, after all that, here is the script [with a single hard-coded address obscured for privacy]:
    try
              set desktopPath to (path to desktop) as alias
              set FlightCheckLog to (desktopPath as text) & "FlightCheckLog.txt"
              set targetList to {"Sep-7", "Sep-8", "Sep-9", "Sep-10"}
              tell application "Messages"
                        set theBuddy to buddy id "<OBSCURED>"
              end tell
              set messageSent to false
              try
                        with timeout of 300 seconds
                                  set theFlights to do shell script "~/Documents/perl/FilghtCheck.pl -x -c J -d 2013-09-07 ATH-LHR"
                        end timeout
              on error
                        set theFlights to ""
              end try
              repeat with theDate in targetList
                        set theOffset to (offset of theDate in theFlights)
                        if theOffset is not 0 then
                                  set theFlight to text (theOffset - 5) thru end of theFlights
                                  set theReturn to (offset of return in theFlight)
                                  set theFlight to text 1 thru (theReturn - 1) of theFlight
                                  tell application "Messages"
      send theFlight to theBuddy
                                            set messageSent to true
                                  end tell
                        end if
              end repeat
              try
                        set theFile to open for access FlightCheckLog with write permission
      get eof theFile
                        if result > 0 then
                                  set fileText to read theFile
      set eof theFile to 0
                        else
                                  set fileText to ""
                        end if
                        if messageSent then
                                  write ((current date) & return & theFlights & return & "MESSAGE SENT" & return & return & fileText) as text to theFile
                        else
                                  write ((current date) & return & theFlights & return & return & fileText) as text to theFile
                        end if
      close access theFile
              on error
                        return
              end try
    on error
              return
    end try

  • Music download interrupted, now iTunes app won't open or quit

    Music download frozen/interrupted.  Now iTunes app won't open or quit, and I'm unable to shut my computer down or install updates because it won't quit.

    Hello there, CoreyAmy.
    The following Knowledge Base article shows how to quit an application that has become unresponsive:
    OS X: How to quit an unresponsive application using Force Quit
    http://support.apple.com/kb/HT3411
    Additionally, this article offers some pointers on how to resume an interrupted download form iTunes:
    iTunes: How to resume interrupted iTunes Store downloads
    http://support.apple.com/kb/ht1725
    If your download was interrupted using your Mac or PC
    Open iTunes.
    Choose Store > Check for Available Downloads.
    Type your account name and password if prompted.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Command quit will close the iTunes window but won't quit the iTunes app

    iTunes 12.1.0.50
    Command quit will close the iTunes library window... but won't quit the iTunes app properly.
    The iTunes icon in the dock still says the app is live... click the icon in the dock and the library window pops up again.
    On the second try the app will always close properly.

    I had the same problem: after updating to iTunes 9.1 (no errors) I just couldn't launch it. In Task Manager I saw that the iTunes process was running but it never really opened.
    After nights of frustration of scanning the net for solutions I finally managed to get iTunes to run again.
    1) Firstly I deleted the new iTunes 9.1 and all programmes associated with it according to the directions given here: http://support.apple.com/kb/ht1923
    It also mentions you should remove the Bonjour service but I could never make that work (no privileges or something like that).
    2) After that I reinstalled a previous version of iTunes. In this case 9.0.3.15. I got the download here: http://www.oldapps.com/itunes.php
    3) Then I disabled the Bonjour service with the MSCONFIG method mentioned at http://support.apple.com/kb/HT2292?viewlocale=en_US
    There they state that you should check which service clashes with Windows by trying to disable one service at a time. I found out pretty quickly that it was just the Bonjour service that caused the problems. All other services could run normally.
    After the reboot iTunes finally started up again and I was able to restore my library.
    Only thing is that I can not use the Remote App on my iPod Touch. That apparently required the use of Bonjour.
    I hope this method helps for some of you!
    Cheers,
    Bart

  • Quit AppleScript App

    Hello, I am creating an AppleScript app and have a button for quitting the app. What is the script so I can quit my app?
    Thanks

    In your button handler you can use a statement such as:
      tell me to quit -- OK
        -- or --
      current application's NSApp's terminate() -- better
    If there isn't anything else that your button handler is doing, you can also just connect it to the application's terminate action (this will work the same as selecting the quit menu item) - in IB, select the Application object, look in the Connection Inspector for the terminate: action, and drag a connection to the button.

  • Key binding to quit an applescript app as an alternative to 'Force Quit'

    Hello,
    I have an AppleScript App which is running for a hour. It is basically a GUI scripting.
    If I want to quit the app in between, I am unable to use 'Force Quit' as the mouse/key board is extensively used by the app.
    I wish to know some alternatives for this issue.
    note:
    Is there anyway I can bind some key combination and once it is pressed, the app should quit?

    +Any suggestions to handle this issue?+
    You can quit a script that is saved as an 'application bundle' with another script.
    Open the 'application bundle' and drag the 'applet' file between the quotes...
    tell application "" to quit
    and you will get this, but with a different path.
    tell application "/Users/tom/Login Items/ReniceR.app/Contents/MacOS/applet" to quit

Maybe you are looking for

  • WebI report not refreshed after BW pwd change - SAP EP-KM asPoint of entry

    Config: BOXI3.1 SP3 FP3 INTG. KIT SP3 FP3 BW 7.01 SP5 SAP EP 6.0 Imported all transports Configured BW Publisher Configured SAP Authentication in CMC Imported required roles in CMC Imported KM Par file in Portal Issue: Users logon to EP with SAP BW c

  • Can I have several itunes libraries on one computer at the same time?

    can I have several itunes libraries on one computer at the same time?

  • PO status change

    Hi all,    I want to know if there is a report to change the status of Purchase order. regards saurabh

  • Oracle VM 3.1.1 and local repository

    Hi there, I have created one LUN hardware RAID 10 for 4x300G SAS disks, and then installed Oracle VM Server 3.1.1, during the installation I determined the remaining space on sda for Oracle VM repository on partition sda2 mounted on directory /OVS OC

  • ChaRM v/s Logical system name

    Hi ChaRM experts! Are unique logical system names a pre-requisite for ChaRM configuration?   Due to historical reasons, clients in quality and production systems have same logical name. Is it still possible to configure ChaRM for above landscape? Any