I use a large number of Applescripts on a daily basis and every so often I will begin getting errors relating to getting or manipulating files. It won’t be able to get the name of a file, or create a folder, or anything else of that nature. This happens with scripts that I use successfully on a regular basis. Restarting the Finder fixes the problem.
It appears that the problem is triggered when I try to use too many applescripts that address the “Finder” w/in too short a time period. For example, I have a script that asks me for a folder name and then creates the folder. If I run it using Spark several times in quick succession, this can sometimes trigger an error. It looks like I’m causing some sort of Applescript/Finder traffic jam, but I can’t really tell exactly what is triggering the problem.
Does anyone know what causes this, and if there is anything I can do to prevent it from happening?
Browser: Firefox 3.6.3
Operating System: Mac OS X (10.5)
I am no expert on this. But my experience tells me that I have any errors in my scripts, which goes unnoticed, because that particular section of code isn’t within a try - on error - end try block, then that situation is likely to occur. -With me living in the belief that there were no errors during execution, as no error message was presented by the scripts running.
Not every runtime error will be announced.
I’m more likely to believe that this is your situation, than the “Traffic jam situation” but that may of course be the case if you manage to have two scripts talk to finder at the same time. At least I believe it could.
I had an error once, which made my desktop to appear as “clean”, when I tried to open the trashcan, it showed no contents . Then I restarted Finder and everything was okay! :lol:
I would try adding some try catch blocks in the scripts concerned like this.
” usual statements go here
on error e number n
display dialog "OOps: " & e & " number " & n & "just occurred in " & (name of me)
If you believe in the “traffic jam explanation” you could try to insert update within tell application “Finder” blocks.
Best Regards and hopes it helps
What you describe is not uncommon – the Finder gets in a huff very easily. The best solution is to avoid it altogether for file manipulation, using “do shell script” and shell commands. The end result is much greater stability, plus speed.