Bug? Apple Script causes Error and crashes hazel

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I tried to use an apple script today and it got me an error message when I tried to run it in a hazel rule as a file and embedded as well. The script works fine when run in the script editor. When trying it out several times via "run rules now", hazel put out an error message and when handling the rule, trying to fix it, hazel crashed several times. To make this clear: it didn't crash while trying to execute, it crashed when I double clicked the rule, pasted the apple script text into the embedded script text field, etc. And with crashed I here mean "the application System Preferences" quit unexpectedly..."


The script looks like this:
_______________________
tell application "Mail" to quit
set sizeBefore to do shell script "ls -lah ~/Library/Mail | grep -E 'Envelope Index$' | awk {'print $5'}"
do shell script "/usr/bin/sqlite3 ~/Library/Mail/'Envelope Index' vacuum"
set sizeAfter to do shell script "ls -lah ~/Library/Mail | grep -E 'Envelope Index$' | awk {'print $5'}"
display dialog ("Mail index before: " & sizeBefore & return & "Mail index after: " & sizeAfter & return & return & "Enjoy the new speed!")
tell application "Mail" to activate
_______________________


I got it to work now by slimming the script down to this:
_______________________
tell application "Mail" to quit

do shell script "/usr/bin/sqlite3 ~/Library/Mail/'Envelope Index' vacuum"

tell application "Mail" to activate
_______________________

This is all I need so I consider the problem as solved for me, just wanted to post it in case it has relevance as a bug.

best,


V
soundframes
 
Posts: 12
Joined: Fri Apr 25, 2008 1:38 am

I pasted the script here and get no error.

Can you check the console logs (launch Console in /Applications/Utilities) and see if there are any System Preference error messages? Also, check for any crash logs in your Library/Logs/CrashReporter folder. Look for files starting with "System Preferences...".

Send them to me via email (click on the "Contact Support" link in the "Info" section). Also, let me know what OS version you are running.

Thanks.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hi,


Mr_Noodle wrote:I pasted the script here and get no error.

Can you check the console logs (launch Console in /Applications/Utilities) and see if there are any System Preference error messages?


Not sure if I got this one right but I did not find any logs from System preferences here.

I did found the hazel log and after some searching, I found the part where the error with this scripts comes up. Looks like this:
_____________________
2008-08-19 00:20:30.571 hazelfolderwatch[16087] [Error] AppleScript failed: Error executing AppleScript on file /Users/veit/Documents/Scripts, Tools, Automator, etc/Auto-Run weekly/_hazel runs these scripts every week.
2008-08-19 00:20:30.572 hazelfolderwatch[16087] AppleScript error: {
OSAScriptErrorAppName = hazelfolderwatch;
OSAScriptErrorBriefMessage = "\"Mail index before: 33M
Mail index after: 33M

Enjoy the new speed!\" doesn\U2019t understand the \U00abevent panSdlog\U00bb message.";
OSAScriptErrorMessage = "\"Mail index before: 33M
Mail index after: 33M

Enjoy the new speed!\" doesn\U2019t understand the \U00abevent panSdlog\U00bb message.";
OSAScriptErrorNumber = -1708;
OSAScriptErrorRange = NSRange: {0, 0};
}
________________________________



Mr_Noodle wrote:Also, check for any crash logs in your Library/Logs/CrashReporter folder. Look for files starting with "System Preferences...".

Send them to me via email (click on the "Contact Support" link in the "Info" section). Also, let me know what OS version you are running.


Yep, I found the Crashlogs from the three crashes last night there. Will send them to you in a minute.

My OS Version is 10.5.4

Best,


V
soundframes
 
Posts: 12
Joined: Fri Apr 25, 2008 1:38 am

There is a bug that causes a sporadic crash. I'll have it fixed in the next beta. I don't think it depends on the script you enter/paste into the field. It's just one of those things where it will affect some people some of the time.

Thanks for the report.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Just a heads up that the new beta is out (check the beta forum). If you end up trying it out, let me know if the bug is actually fixed.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron