Repeat Loop times out and I don't want it to

Maybe there is a better way to do this but I want an action to take place whenever the modification date of a certain file changes. This is what I use but it errors because of a timeout after about 10 mins if the mod date doesn't change. I need this to be checking all the time.
on idle
tell application "Finder"
set UpdatedOLD to modification date of file aFile
set UpdatedNEW to modification date of file aFile
end tell
repeat while UpdatedOLD = UpdatedNEW
tell application "Finder"
set UpdatedNEW to modification date of file aFile
end tell
end repeat
end idle
How can I get this to work?

Hello
I think you have stepped on a land mine set by OSX 10.6.
There's a fatal bug in Apple Event Manager in 10.6 such that one event in every 65535 events will be lost and never be replied, which will result in Apple Event timeout error on sender. This bug has been reported shortly after the 10.6 release and has not yet been fixed as of 10.6.2.
In your current script, you're continuously sending event to Finder and sooner on later send an event with the specific event id that is doomed to be lost. Judging from the time till you see the time out error, that is 10 min, you're at most sending 65535 / 600 = 109.225 events / sec to Finder. You can reduce the number of events by inserting some delay, e.g. 'delay 1' in your repeat loop but it can only defer the failure.
cf.
Re: Timed Out (Silence)
http://lists.apple.com/archives/applescript-users/2009/Oct/msg00117.html
Re: spurious timeout on nth Apple event on Snow Leopard
http://lists.apple.com/archives/applescript-users/2009/Nov/msg00041.html
A better way to achieve your task would be to let a launchd agent watch the file.
A recipe is as follows.
1) Save a compiled script in :
~/Library/Scripts/launchd/watchdog.1.scpt
with contents :
--SCRIPT
-- Here put your script that is to be triggered when the file is modified.
-- e.g.
tell application "System Events"
display dialog "The file is modified." giving up after 10
end tell
--END OF SCRIPT
2) Save a UTF-8 plain text file in :
~/Library/LaunchAgents/watchdog.1.plist
with contents :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>watchdog.1</string>
<key>Disabled</key>
<false/>
<key>Program</key>
<string>/usr/bin/osascript</string>
<key>ProgramArguments</key>
<array>
<string>osascript</string>
<string>/Users/USER_NAME/Library/Scripts/launchd/watchdog.1.scpt</string>
</array>
<key>WatchPaths</key>
<array>
<string>POSIX_PATH_TO_THE_FIILE</string>
</array>
</dict>
</plist>
*Change USER_NAME to your user name and POSIX_PATH_TO_THE_FIILE to the POSIX path to the file to be watched.
3) Issue the following command in Terminal to load the launchd agent :
launchctl load ~/Library/LaunchAgents/watchdog.1.plist
Or
3a) Log-out and re-log-in to load the launchd agent.
*The name 'watchdog.1.plist' and 'watchdog.1.scpt' and the script's location '~/Library/Scripts/launchd/' are mere examples. You may change them as you see fit.
cf.
http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/m an5/launchd.plist.5.html
http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/m an1/launchctl.1.html
Good luck,
H
Message was edited by: Hiroto (fixed typo)

Similar Messages

  • I just received my new Mac Mini and want to migrate files from my Time Machine. I assume the old OS is on Time machine and I don't want it to supersede the new Yosemite OS. Do I have to Do anything special?

    I just received my new Mac Mini and want to migrate files from my Time Machine. I assume the old OS is on Time machine and I don't want it to supersede the new Yosemite OS. Do I have to Do anything special?

    Using Migrations Assistant will only move the data and other things over, it will not bring over a previous version of the Os since the 2014 model can run anything earlier than Yosemite.

  • The volume on the second half of my Quicktime slideshow fades out--and I don't want it to do that!

    I used FotoMagico 4.0 to make a slideshow. There are options for exporting, and I chose the one called Custom, which makes a Quicktime movie. For some reason the volume in the second half of the show starts to fade out, and by the end I can barely hear anything. If I export to their Standalone Player, which allows the slideshow to play on a Mac computer, everything works just fine. I'm at my wits end trying to figure out how to fix this. I want to be able to export the slideshow to Vimeo so that people on Macs and Pc's can both watch it, but I can't do it with the volume the way it is.

    Go to System Preferences. Then under the General tab, there is a tick box saying "Restore windows when quitting and re-opening apps." Un tick that box. Once you start and quit Safari again, it will go back to your home page.

  • Updating ios 6.1.3 but it times out and fails, what am i doing wrong?

    Last iphone 4s was replaced under warranty due to wifi greying out and now i can't update the software on my new phone.
    Tried updating direct from iphone but it fails and when attempting from itunes it says my internet connection timed out.
    I've attempted 5 times now and i don't know what else to try apart from take it back to Apple Store. Can anyone help?

    Temporarily disable any security software on the device and try again.

  • My music goes to iCloud and I don't want to use my data to download it continuously. How do I keep it on my device and out of iCloud?

    My music goes to iCloud and I don't want to use my data to download it continuously. How do I keep it on my device and out of iCloud?

    Donnakelley62 wrote:
    I don't know. And no I don't use iTunes match.
    WE are travelling and it seems every time I want to listen to music it's on iCloud and not my device. I find a wifi connection and download the songs them bam next time they are back on iCloud!
    iTunes purchases are always on iCloud. They don't get uploaded there. They are simply there because you purchased them.
    When you first purchqse, iTunes (computer or phone) should download them. If they are not downloaded, you will see the cloud icon.

  • Is there a way to change the master text length in FCP? The default length is 10 seconds, which is too long. I can easily adjust the length but I don't want to do it each time, and I don't want to adjust one and then have to copy and paste this length.

    Is there a way to change the master text length in FCP? The default length is 10 seconds, which is too long. I can easily adjust the length but I don't want to do it each time, and I don't want to adjust a text clip and then have to copy and paste this each time. Ideally, there should be something in User Preferences but there is not. Thanks.

    Maybe some one else can pipe up with a solution, but this would literally take 2 seconds to do for a new project.  And you can create a "template project" that includes this "text" clip.  Save this project and then to a get info and check "stationary pad."  When you double click on this file, fcp will open with a copy of this project and you just need to do a save as. 
    I've been working with computer editing systems for longer than i can remember and at a certain point you just have to adapt your workflow to the limitations of the software.  

  • My iPad 2 will not allow me to update my apps. When I hit the update button I get a spinning circle but then it times out and doesn't update. Please help.

    My iPad 2 will not allow me to update my apps. When I hit the update button I get a spinning circle but then it times out and doesn't update. In the past when I have updated successfully, the spinning circle would show me an indicator of time left on the update. I no longer have this Indicator. The circle just spins and times out and nothing happens. I've reset the iPad in the settings menu, reset the router, logged in and out of Apple id, powered ithe iPad off and on, and tried a couple other "fixes" that I've read online. So far no luck. AAny help would be greatly appreciated. Much thanks!

    How much free space do you have? If it is low, installers may not be able to run properly.

  • When making a photo book, my iPhoto freezes during uploading the book to the store after assembly.  I have attempted this 4 times now and I don't know what to do! I know the file size is massive due quantity of large images. How can I get past this?

    When making a photo book, my iPhoto freezes during uploading the book to the storey.  I have attempted this 4 times now and I don't know what to do! I know the file size is massive due quantity of large image files, but I don't want to reduce the image file size and compromise quality in the book. How can I get past this?
    My macbook air is os x 10.9, using iPhoto 11 9.5 (902.7).

    Try Old Toad's solution here:   See   Re: iphoto : upload impossible to print a book
    Try to boot into Safe Mode and order this way, or sign into a different user account and try to order as a different user.
    Léonie

  • HT203200 I have a song that I purchased from Itunes on my Iphone and there was an error downloading.  Every time i try to download it times out and says to try again.  I have tried several times and still get same message.  Help?

    I have a song that I purchased from Itunes on my Iphone and there was an error downloading.  Every time i try to download it times out and says to try again.  I have tried several times and still get same message.  Help?  I have been charged for this song but have not been able to download.

    Go here:
    http://www.apple.com/support/itunes/contact/
    and follow the instructions to report the issue to the iTunes Store.
    Regards.

  • Just bought the ipad4 and can't log into facebook. Times out and tells me to check my network connection. Anyone having the same problem or any ideas?

    Just bought the ipad4 and can't log into facebook. Times out and tells me to check my network connection. Anyone having the same problem or any ideas?

    Hey barnsieno10,
    Thanks for using Apple Support Communities.
    Looks like sign in issue, This article is a great resource for the message you are receiving.
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    http://support.apple.com/kb/ts3970
    Have a nice day,
    Mario

  • Process chains time outs and hangs with no error msg - in SP13

    Hi all,
    We are having all kind of weird problems after we patched our system with SP13. Our process chain time outs and hangs, but surprisingly we never get any error msg. And scarier part is, the problem seems to be intermittent. PC runs fine on some days and hangs on some.
    Further analysis into the dump – as below
    Termination occurred in the ABAP program "SAPLRSSM" -
    in "RSSM_SLEEP_DEBUG".
    The main program was "SAPMSSY1 ".
    In the source code the termination point is in (Include) program "LRSSMU39".
    This refers to an issue that appears to have been addressed by OSS Note
    934648(meant for SP8). This notes also indicates to populate RSADMIN table to
    exclude "RSSM_SLEEP_DEBUG". Not sure if this note is valid for SP13? However we went ahead and populated the RSADMIN table.
    So now we have no clue what’s going on and where to fix the issue.
    As per SAP suggestion we applied the following notes:
    0000653996  Analyzing lock situations
    0000893563  Correction: Deadlock on completion of a remote chain
    0000994007  Corrections: Deadlock with external status query
    0001005481  Correction: Process successful, but there is no instance
    0001047174  Correction: Incorrect scope when locking in process chains
    0001051957  Correction: TIME_OUT during dialog confirmation of processes
    0001083660  Report for error stack analysis
    Nothing seems to help us. And SAP suggested a few options, which we implemented to no rescue.
    I’m sure that many of the customers have applied SP13, and want some feedback from them, if this is happening in their systems too?
    If so, how did you fix this issue?
    Or this situation is unique to us?Please note that no settings were changed as of SP13 to that of what they were in SP12(unless it is a side effect of the patch itself). Everything worked fine with SP12 and is still working on the BIP system. All the problems are in BIQ patched to SP13.
    Any pointers or insight would be appreciated. We have a customer msg open with SAP, and going back and forth, but nothing seemed to work as of today.
    Thanks,
    Voodi

    Not sure which OSS helped us get past the issue, as SAP asked us to apply a ton of notes. But along which the notes, SAP has some suggestions for us, which we think did the magic. After the implementation of the suggestin we never faced the same issue again. The suggestion by SAP:
    move the process chain callback in a batch job by executing
    program RSSM_TRACE_SWITCH and selecting the flag "verifcation
    of asynchronous processes - execute in batch".
    Lemme know if this doesnt fix the issue, I can give all the notes that SAP asked us to apply.
    Message was edited by:
            voodi

  • I had  to restore my iPad mini. Now when I go to the App Store and tap the cloud to reload some of my apps, it times out and they won't load. Any suggestions?

    i had to restore my iPad mini and when I go to the App Store to reload some of my apps it times out and doesnt reload them. Any suggestions?

    Close the App Store app and reset your iPad.
    Now close all apps. In order to close apps, you have to drag the app up from the multitasking display. Double tap the home button and you will see apps lined up going left to right across the screen. Swipe to get to the app that you want to close and then swipe "up" on the app preview thumbnail to close it.
    In order to reset your iPad, hold down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple logo appears on the screen after which time you can release the buttons and let the iPad start up.
    IF that didn't help, try turning WiFi off on your iPad in the Settings, restart the iPad, then turn Wifi on again.

  • HT1657 I started watching a rental.  A "new update avalible" popped up, so I clicked it to move it out of the way.  Now my video disappeared and I don't want to pay another 5 dollars to rent it again.  What do I do or click?

    I started watching a rental.  A "new update avalible" popped up, so I clicked it to move it out of the way.  Now my video disappeared and I don't want to pay another 5 dollars to rent it again.  What do I do or click?

    The photos are on the ipod.  Photo sync will erase them.  I need a way to extract them from the ipod, or to.extract them from the ipod backup that is who knows where on my PC.
    I've been searching for an app to do that with no luck.  They all seem to want a newer OS than is on my ipod yet I have the most recent update installed.

  • I have a Mac Book and purchased a Bose system that uses an antenna to play music from the the laptop - it works great, but the computer times out and shuts down - Help

    have a Mac Book and purchased a Bose system that uses an antenna to play music from the the laptop - it works great, but the computer times out and shuts down - Help

    Check in "System Preferences">"Energy Saver" to see if you have the "Computer Sleep" bar set too low.

  • Hi, every time i try downloading ios5 it reaches 100% and then the connection times out and nothing happens after that; though the internet connection is fine as i can access other sites etc. what could be the problem?i tried using 2 different modems.

    Hi, every time i try downloading ios5 it reaches 100% and then the connection times out and nothing happens after that; though the internet connection is fine as i can access other sites etc. what could be the problem?i tried using 2 different modems. Where can i download the ios5 from as my itunes is on my desktop which uses windows xp. Please help

    Download iOS 5.1
    iOS 5.1 (build 9B176) is compatible with iPad 1, iPad 2, iPhone 3GS, iPhone 4, iPhone 4S, iPod touch 3rd & 4th gen, and iPad 3. Additional builds are available for Apple TV 2 and Apple TV 3. The below download links are all direct downloads of iOS 5.1 from Apple.
    iPad 1
    iPad 2 Wi-Fi
    iPad 2 GSM (AT&T)
    iPad 2 CDMA (Verizon)
    iPad 2,4
    iPhone 3GS
    iPhone 4 GSM (AT&T)
    iPhone 4 CDMA (Verizon)
    iPhone 4S
    iPod touch 3G
    iPod touch 4G
    iPad 3 Wi-Fi
    iPad 3 GSM
    iPad 3 CDMA
    Apple TV 2 (9B179b1)
    Apple TV 3 (9B179b1)
    Source: http://osxdaily.com/2012/03/07/ios-5-1-download/

Maybe you are looking for

  • Error while registering components.

    i got this error while registering the components i.e. collector,preference and session: Exception in thread "main" java.lang.nosuchfielderror: org.omg.corba.tckind: field tk_principal not found at at com.visigenic.vbroker.activationimpl.oadutil.main

  • ALE/IDOC TRANSPORT ERROR FOR Z TABLE

    Dear Experts,                     I am new to ALE/IDOC,I am trying a simple scenario by transporting a ztable data between two clients with in a same server. steps i have done are : 1, created logical system at both sender and receiver. 2, assigned l

  • Adjust clip time & date...for real?

    Hello. A couple years back I had a HD fail and on it was a few GB of video that wasn't backed up (most of the 500+ GBs were backed up, but a few weren't as it was new video that hadn't gone through the weekly backup script) and thus, when I recovered

  • V10.4 Absent Backup to Disc Option

    Thought we lived in a society where the customer really matters?  Then why the H*** did you remove the backup to disc option  in V 10.4 without any warning or consideration of the customer community......oh and thanks for providing some alternatives.

  • Linux Server Bare Metal Restore

    Hi, As our OEL environment grows, I was wondering what products others use to ensure 'Bare Metal Recovery' to like or unlike hardware in the case of a 'disaster'. We have Veritas Netbackup in house for nightly backups, but do not have the Bare Metal