Script won't quit; AppleEvent timeouts and Errors! Any advice?

Hi Forum,
Applescript is driving me crazy... I'm using quite a bunch of scripts on a highly automated server which are supposed to shuffle files and folders, process images, create and export XML files, etc.
All scripts are tested multiple times and run without a problem, however, when I put them in a Cron to execute during nighttime, I get mysterious messages in the morning like:
"AppleEvent timed out" or
"NSReceiverEvaluationScriptError:4"
Of course, all folloving scripts and events are then stucked and even the weekly reboot will not be executed! And I can't understand why; when I launch the apps (the scripts are saved as executable applications) manually, they never fail!
Anyone any idea? How could I trap this problem? Many thanks in advance!
Kind regards,
AS

In fact, the same scripts do not always run into problems; one day it works, the next not. So enabling logging would be helpful in any case... but how can I do this?
Concerning the user, I already tried running the script with the only user account as well as root; the problems are basically the same. The system goes never to sleep and only a screensaver is activated. Also the scripts do not rely on any dynamic path, only fixed AS pathes are used, however they mostly point to server volumes!
I can post a (simplified) script as an example. This script is in real too big to post here but this should give you an idea. It basically looks for TIFFs in an INPUT folder and generates downsampled JPEGs in an OUTPUT folder if they do not exist yet. All this is logged in a file and finally a message with the results is being mailed:
tell application "Finder"
set the_date to (current date) as string
if exists disk "SERVER_VOLUME" then
set theInputFolder to folder "INPUT" of disk "SERVER_VOLUME"
set theInFiles to every file of theInputFolder
set theOutputFolder to folder "OUTPUT" of disk "SERVER_VOLUME"
set theOutFiles to every file of theOutputFolder
set theLoggingPath to a reference to "SERVER_VOLUME:" as string
set log_path to theLoggingPath & "tiff.log"
set logfilecontent to (open for access file log_path with write permission)
try
write the_date & return to logfilecontent starting at eof
on error
close access logfilecontent
end try
close access logfilecontent
repeat with x from 1 to length of theInFiles
set theInFile to file ((item x of theInFiles) as string)
set extension hidden of theInFile to false
update theInFile
end repeat
repeat with y from 1 to length of theOutFiles
set theOutFile to file ((item y of theOutFiles) as string)
set extension hidden of theOutFile to false
set label index of theOutFile to 4
update theOutFile
end repeat
set theExisting to every file of theOutputFolder whose name extension = "jpg"
count (every file of theOutputFolder whose name extension = "jpg")
set ExistingCount to result
repeat with z from 1 to length of theExisting
set theImage to file ((item z of theExisting) as string)
set the file_name to the name of theImage
set logfilecontent to (open for access file log_path with write permission)
try
write "[EXST] " & file_name & return to logfilecontent starting at eof
on error
close access logfilecontent
end try
close access logfilecontent
end repeat
set theTiffs to every file of theInputFolder whose name extension = "tif"
count (every file of theInputFolder whose name extension = "tif")
set TiffCount to result
tell application "Image Events"
launch
repeat with a from 1 to length of theTiffs
-- the image processing is done and logged
end repeat
quit
end tell
tell application "Mail"
launch
-- a mail is sent
quit
end tell
else
-- a restart procedure is initiated
end if
end tell
In the morning I mostly have the JPEGs, the Log and the Mail, yet the script failed to quit with an error message and all further scripts are blocked!
Thanks again!

Similar Messages

  • I just downloaded the new version of iTunes 10 and now it won't let me drag and drop any files from my computer.

    I just downloaded the new version of iTunes 10 and now it won't let me drag and drop any files from my computer into my iTunes. It lets me play the song from the folder in my computer and then it opens with iTunes and plays the song all the way through, but then if I try to play it again, it says the file cannot be located. So then I go to locate and go to the folder and all that and select it and nothing happens.

    Not sure whether for instance you initially had a Yahoo optimised version of Firefox, and have now overwritten it with an official Mozilla version. Although the Mozilla version should NOT add unwanted features, but the Yahoo version may well do.
    If you merely need to find the Yahoo emails page quickly just add it as a bookmark or as a bookmark on the Bookmarks toolbar and make sure that is visible.
    Clicking the star icon on the location bar whilst looking at your emails will bookmark the page.
    * [[How to use bookmarks to save and organize your favorite websites]]
    * [[Bookmarks Toolbar - Display your favorite websites at the top of the Firefox window]]
    I do not use Yahoo myself,and am not sure what add-ons are available. You could search yourself using
    * FirefoxButton -> add-ons
    ** see [[Find and install add-ons to add features to Firefox]]
    ** examples [https://addons.mozilla.org/en-us/firefox/addon/yahoo-toolbar/ yahoo toolbar] & [https://addons.mozilla.org/en-us/firefox/addon/yahoo-mail-notifier/ mail notifier]
    * also look at Yahoo's own information such as http://help.yahoo.com/tutorials/toolbar/cl3/c3_ff_toolbar1.html

  • Big transition from PC and Cubase, any advice welcomed to avoid Apple Shock

    Hello everyone,
    I've been waiting until the new Mac Pros were released before jumping out of the PC plane and into the Mac world, I just want to have as good a parachute as possible so any advice and help is appreciated. My apologies if I'm putting in too many questions, I just didn't want to create a bunch of threads in different areas and some of these questions may have a simple answer.
    With that said, here's where I'm at:
    I've used Cubase since version 3 and am currently using SE3 through an Echo Layla 24 (PCI card to 1U rack interface) with XP.
    Would it be better to tread lightly by purchasing Logic Express and then Studio or just go straight for the Studio version? I have no problems learning a new system and am excited at the prospect of using Logic for everything as I continually read how great it is on the Mac platform. I just want to make sure Logic is able to do everything Cubase (recording audio/midi) and Wavelab (mastering) have done for me for years now.
    Also, I'm not sure my Layla 24 will work in these new Mac Pros so if I have to upgrade my interface as well I've been looking at the following options:
    MOTU 828mkii (possibly getting a Black Lion Audio mod at some point)
    Apogee Duet and then getting a simple USB/MIDI breakout box for the MIDI.
    On my current interface, I'm able to keep a drum machine, keyboard, POD Pro, condenser mic, and a MIDI device plugged in simultaneously to 1/4" inputs and MIDI connectors respectively. That's really convenient and the reason I've had my eye on the 828mkii. The only reason I'm considering the Duet is that I've read nothing but the most positive of reviews for this device over anything in the sub $1000 range. Made for Apple, integrates well with Logic, and the sound is beyond unbelievable. If the sound is really that much worth it over the 828mkii even with a BLA mod then I can always get a USB to MIDI cable/box and deal with the constant plugging/unplugging of my 1/4" devices.
    In addition, I've recently acquired a Line 6 Toneport UX2 USB interface. Is there any major hiccups using this device with Logic Studio/Express? I like some of the sounds I can get out this little box and simply changing the output channel in the Gearbox software allows me to record a dry signal while monitoring wet.
    Lastly, I've seen on the new Mac Pros the option to get the single Quad version for $500 less. That $500 would be handy towards Logic Studio/Express and a new interface device if I had to get one. Would it be possible to get the single Quad Mac Pro and then buy a single processor chip down the road to bring it to the same speed as the Mac Pro default configuration in the Apple store? Would I be voiding any warranties by traveling down that road?
    Thank you in advance for your patience and time,
    TR

    First off,
    Thanks for all the great replies. Where to begin, where to begin...
    I've spent several hours reading as much as possible on the interfaces I previously listed, adding the RME Fireface 400, Audiofire 12, and MOTU Ultralite to the fray. I would imagine each of these devices along with the ones I formerly mentioned probably sound better than the Echo Layla 24. The Layla line (still own a 20, and now the 24) has been good for me in the past and I would like to up the ante, although I do have to keep the total cost in mind as this is a no holds barred full crossover. New Mac Pro, new interface, and new software. As Tom mentioned from having a similar experience, it's years worth of hardware and software invested. In addition to just this change, I'd like to also move my other non-audio programs over as well, namely Photoshop CS2, CorelDraw, Premiere, Quickbooks, and a slew of other work related software. It's a little daunting to say the least. I do think Adobe offers some sort of crossover deal but I have to check further into that. Hopefully other companies offer something like that as well.
    Glad to hear there are other Cubase users who've moved over to Logic without much trouble. Depending on how much the new hardware interface is going to cost will most likely be the deciding factor between me getting the Studio version or Express version of Logic. I do like that if you get Express you can simply spend another $300 for the Studio upgrade. That's how it should be. I won't start a Cubase vs Logic thread, as this is just a comment regarding company policy, however I have the Cubase Producer Pack, VST, VST/32, SE3 and other Cubase related boxes sitting on my shelf and with all the money invested there wasn't a decent cost effective upgrade solution for me. I'd be forced to buy Cubase 4 at full price in order for Mac compatibility and that just leaves a bad taste for me. One of the reasons I've been ready to try Logic.
    Is there any difference between the Express 8 engine and the Studio engine? I've read that Garageband (included with the operating system) has a similar or same engine. Would it be possible for me to lay down some quick 'idea' or 'spur of the moment' tracks in that Garageband software and then move them into Logic to flesh them all out possibly retaining a track or two from Garageband? Just curious on that one.
    One other question regarding the Logic software editing. Most of the tracks I lay down require multiple takes which I simply punch in and out onto multiple tracks. I snip the audio segments accordingly then shift them all onto the same track. I then hop into Wavelab (open at the same time) to process the .WAV files used on said track (usually adding Noise Reduction, other plugins), then hop back over to Cubase which updates the track accordingly. It saves me CPU processing power (although I probably won't have to worry about that with an 8 core system), however, will I be able to easily punch in and out as well as shift the varying pieces of track together from multiple tracks?
    Thanks for the UX2 experience, I know on the box it says Mac compatible, I was worried that I'd have to possibly buy a newer piece of gear to run it, ala the Cubase software. (It apparently is compatible with an older version of the Mac OS)
    So here's where I'm at as of today:
    I've decided to go with the 8 core system so I won't have to worry about any future issues at least for quite a while.
    Purchasing Logic Express or Studio is dependent on the cost of the new interface.
    The interface options are (in alphabetical order of course):
    Apogee Duet and USB MIDI breakout box
    Echo Audiofire 12
    MOTU 828mk2 (used from eBay, then get a BLA analog mod)
    MOTU Ultralite
    RME Fireface 400
    I can tell you one thing for certain, if I can ever get that money tree out back to grow I'll rarely have any questions at all. HA!
    Thanks again for all the responses and helpful advice,
    TR

  • I cannot complete stage 3 for setting up messages; 'tap and send' - any advice?

    Any advice to complete set up of messages on my new ipad? I cannot complete 'stage 3 - tap and send'?

    A fairly common error people make when using messages, is to type their outgoing message in the Subject field which is just above the Message field.  In fact, I think it's a good idea to turn the message field to OFF.
    Settings/messages/turn subject field off

  • My mini mac won't quit saving itunes and there are no icons to quit just the bar rotating saving itunes

    My mini mac is frozen saving itunes library for days  No icons to force quit--about to unplug!!  Hooked up to my tv for internet

    Hi Laura, looks like you don't have a choice other than powwring down, then...
    "Try Disk Utility
    1. Insert the Mac OS X Install disc, then restart the computer while holding the C key.
    2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu at top of the screen. (In Mac OS X 10.4 or later, you must select your language first.)
    *Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.*
    3. Click the First Aid tab.
    4. Select your Mac OS X volume.
    5. Click Repair Disk, (not Repair Permissions). Disk Utility checks and repairs the disk."
    http://docs.info.apple.com/article.html?artnum=106214
    Then try a Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes.
    (Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive.)
    If perchance you can't find your install Disc, at least try it from the Safe Boot part onward.
    If 10.7.0 or later...
    Bootup holding CMD+r, or the Option/alt key to boot from the Restore partition & use Disk Utility from there to Repair the Disk, then Repair Permissions.

  • About 90% of the time, when I try to close a PDF nothing happens. After repeatedly clicking the X I get the following message. The Organizer Database is damaged and will be reset the next time Acrobat is launched. Quit the application and close any curren

    Anybody had this Problem?
    garym57236896

    You must be using an old version of Acrobat as Organizer hasn't been in the last two versions of Acrobat.  Here is the KB that covers that old error:  Error "The Organizer Database is damaged and will be reset..." | Acrobat 9

  • My iTunes purchases won't convert to mp3 files. Any advice?

    My iTunes purchases won't convert to mp3 files. I don't want to burn a CD, either. Any useful advice/help?

    krisfrommorgantown wrote:
    My iTunes purchases won't convert to mp3 files. I don't want to burn a CD, either. Any useful advice/help?
    If they will play but will not convert, you probably have DRM "protected" files.  Were they purchased prior to mid-2009?
    If so, and you don't want to burn, your choice is either to replace them, or to upgrade them by using Match.  For the latter option, see
    iTunes Store: iTunes Plus Frequently Asked Questions (FAQ)
    and look at the section on "Can I upgrade my previously purchased music to iTunes Plus?"

  • Ok! so i tried updating my ipad 2 software to I.O.S 6.1 and it failed then continued to shut down and put the plug into itunes logo on my screen! I then i have been trying to update and restore my Ipad 2, then it says corrupt file and stops any advice?

    This is ridiculous!!!!! Apple Corporation needs to fix what ever went wrong with IOS 6.1 update and they better do it soon or theyre going to have a mob on their hands!! i have been continuosly restoring and updating my iPad 2 and it always says corrupt file then restarts the whole process! im going out of my mind and im about to say to **** with it and call apple themselves and make so many complaints that theyll fix it within the hour or i will go to new york city at the head of the corporation and make the most skeptical and most embarrissing seen that they will end up ashamed to even be working for a company with the supposedly "SMARTEST AND BRIGHTEST TECHNOLOGICAL PEOPLE IN THE U.S." who cant even get a software update correct so that it doesnt make some of our lives harder then they need to be! and if its already known to be corrupt then should take it off the whatever update liost and fix it before anyone else has to go what ive gone through, cause its pure torcher!! i paid good money for a product for easy use whenever and thats not what im getting when they cant even make a simple update thats supposed to help but only makes my product worse and make me wanna never buy from them again!

    Hello aZaa4401,
    Thank you for using Apple Support Communities.
    You can use the following article to resolve your issue:
    If you can't update or restore your iPhone, iPad, or iPod touch
    Regards,
    Jeff D. 

  • Imac G5 second hand shop. Need to add Hard drive Ram and OS.Any advice?

    I've found the serial number and am interested in what the specs of this machine are. It is very clean inside but the hard drive (and heat sensor), and ram are missing. I've have a SATA hard drive and the latest version of OSX Leopard but I want to get the correct memory (the most possible) but I'm not sure what type memory to get. Thanks in advance for any help.

    Welcome to Discussions - here are the memory specs for the various models:
    Rev A -
    iMac G5
    2 GB PC3200 (400)
    unbuffered DDR,
    184-pin 64 MB
    DDR
    SDRAM 2
    iMac G5 (Ambient Light Sensor)
    2 GB PC3200 (400)
    unbuffered DDR,
    184-pin 128 MB
    DDR
    SDRAM 2
    iSight:
    1. PC2-4200
    2. unbuffered
    3. nonparity
    4. 240-pin
    5. 533 MHz
    Once you determine which model you have, the above list will tell you what memory to get. Rev A and the Ambient Light models can take a maximum of 2GB, the iSight model can take 2.5GB.

  • Macbook iTunes won't quit or open

         I was syncing my sisters iPhone to iTunes and she unplugged it and later I tried syncing my iPhone and it was still trying to cancel the sync from hers so I tried closing iTunes but now it won't quit or reopen and computer won't restart because the app is open.

    Hi ..
    Force quit iTunes.
    Command + Option + Esc

  • 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.

  • Shell Script: Timeout and return error if Sqlplus hangs

    Shell Script: Timeout and return error if Sqlplus hangs
    Dear all,
    This morning, our production database hung with lots of ORA-600 and 7445. The issue has been escalated to Oracle Tech support but my monitoring script which tries to make a connection every 5 mins to the database to see if its up, did not alert me. The reason is that, it connected to the database and hung, never came out to report an error and so I never got alerted until a user called me.
    Can any one tell me how I can exit from the sqlplus block if I dont get a response in x seconds? This sqlplus block is being called with in a shell script.
    Any help is highly apprciated.

    I don't know of anything built into any shell scripting language that would do this, no. I'm not a Perl programmer, but I have a vague recollection that Perl may have something useful here.
    From the "separate thread" part of my comment, though, you could certainly spawn a separate thread (thread 2), have thread 2 wait a period of time, then look for a message from thread 1 and throw an error if the message hadn't been sent. I don't know that I'd be for writing multi-threaded shell scripts, though. The heartbeat also gives you a layer of redundancy so that something is monitoring the monitor in case that process stops working.
    Justin

  • "Lightroom encountered and error when reading from its preview cache and needs to quit"

    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.
    Any Ideas here? Is there another app that may be telling it where to look for the cache and it no longer there? I was using a ramdisk for a bit but ditched it. Not sure if that has something to do with it but it seems suspect.
    Your thoughts?
    --Kenny Brandon Wilson

    Talked to Adobe support this morning, this is their response in case anyone else is looking for help. I'm running a Windows 7 box, LR 5.6.
      Gokul: Click on start and type %appdata%, then open roaming folder.
      Edward: ok
      Gokul: Open Adobe folder.
      Gokul: Open Lightroom folder.
      Gokul: Open Lightroom folder> Preferences.
      Edward: ok
      Gokul: Rename Lightroom 5 Preferences.agprefs file as Lightroom 5 Preferences.agprefsOLD.
      Edward: OK
      Gokul: Please check if you can launch Lightroom without any error.
      Edward: it shows me a welcome screen and is asking me to select my country
      Edward: aka, register the software
      Gokul: You can skip and launch it.
      Edward: LR catalog not found
      Gokul: Please select the catalog.
      Edward: my original catalog?
      Gokul: Yes.
      Edward: testing integrity of catalog
      Edward: loaded just fine
      Gokul: Okay.
      Gokul: Please check if you can re-launch it again.
      Edward: yes, it worked!
      Gokul: Excellent!
      Gokul: Since your preferences were corrupted you were facing issue so we renamed the preferences file to reset it.
      Edward: aha....ok
    All of my import/export presets were intact along with develop user presets. I'm happy as a clam for my $10/month!

  • IPhoto 09 Faces wheel spins forever and/or won't quit

    Hope someone has insight or it helps others...
    For the last several days any import into iPhoto will set it into spinning the Faces album waiting wheel forever. There is no way to Quit. Other times just simple quitting won't work.
    Activity shows 40-50% iPhoto CPU usage, lots of context switches (270,000 in 5 minutes of CPU time) but no hangs, no faults. I have previously let it run overnight, in case it was somehow reanalyzing 18000 images, but even then the problem remains.
    Console shows: 10/12/09 3:55:58 PM iPhoto[653] * -[NSPathStore2 getCharacters:range:]: index (8) beyond bounds (3)
    as most recent item from iPhoto in the log.
    Looking inside the iPhoto Library folder the face.db database, iPhotoMain.db etc. have no activity going on. ( I tested by changing the face info on one picture, the Finder last modified date immediately changed, showing the processes are running fine, but just some runaway process won't quit.)
    Another console item showed iPhoto finding wrong architectured PGP plugin in contextual menu items, so I have trashed that. And, it finds a Chronos Notes related issue (contextual menu item in library and same named alias in user/library) throw an exception. I also informed ChronosNet.com of this....in case the recent iPhoto acting up is related to the SOHO update that was recently installed.
    "I've had iPhoto start acting up (fails to quit) since SOHO NOTES latest update... checking the Console shows a possible problem....
    You have a contextual menu entry (alias) in user/library and same name (original item) in library. That makes apps like iPhoto throw exceptions...
    10/12/09 4:29:33 PM [0x0-0x40040].com.apple.iPhoto[653] objc[653]: Class SBContextualMenuHelper is implemented in both /Users/imran/Library/Contextual Menu Items/ChronosNotesCM.plugin/Contents/MacOS/ChronosNotesCM and /Library/Contextual Menu Items/ChronosNotesCM.plugin/Contents/MacOS/ChronosNotesCM. One of the two will be used. Which one is undefined."
    Let's see what they state.
    Now.... Force quitting now to see what it shows in the logs:
    It did not show any quick console messages. I'm surprised an OS X "report this crash to Apple" window did not open up.
    Now relaunched... will see if it happens again...
    Imran

    iPhone is not "hung" in the traditional sense in that you can do several things within it while it's non-stop Faces spinning wheel displays. I do NOT find it responsive and it does NOT Quit when Faces is spinning forever. tgardner, your experience appears to be different.
    Checking in Activity Monitor shows that interestingly there are no hangs or errors. But, looking into contents of iPhoto library shows NO files are modified even after 24 hours or running. In other words, maybe it's not dead, but it is comatose.
    Also, checking in Console I always see a variable out of bounds error when this happens.
    I have 19000 images and of those maybe 5000 have faces, of about 50 people. ALL of those images are already processed with Names info. Even if Faces needs to update some data, 24 hours of nothing but iPhoto running ought to be enough but it is not.
    Others may want to check Console and Activity Monitor and add their experiences here.
    regards
    IMRAN

  • HT204406 Itunes Match won't upload. I get error stating there was an error in the itunes store, please try again. I have tried again everyday for the last month and am still unable to use.  Any ideas on why Match can't complete the 1st step of the process

    Itunes Match won't upload. I get error stating there was an error in the itunes store, please try again. I have tried again everyday for the last month and am still unable to use.  Any ideas on why Match can't complete the 1st step of the process (Gathering information about your Itunes library)?

    JohnCullison wrote:
    For the last few weeks, the iTunes store has been displayed with empty graphic rectangles (with a blue box containing a white question mark centered in the rectangles), bits of text, and some buttons. The page extends quite a ways, including what I assume would be all the links to all the music...
    If all you are trying to do is buy music, you can easily buy MP3s at any online music download store (e.g. amazon.com) and add them to your iTunes library.

Maybe you are looking for