Search the web
Sign In
New User? Sign Up
jsosa · JavaScript OSA-Talk
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
JavaScript with Apple's Mail   Message List  
Reply | Forward Message #426 of 529 |
Hi all.

Today I tried for several hours to get going with JavaScript OSA in
Apple's Mail environment. I installed the OSA component properly.
I've been able to test a variety of JavaScript with Apple's Script
Editor. I've also successfully gotten the following to work from
within Mail:

function perform_mail_action_with_messages (ae_params)
{
MacOS.beep();
}

I'm trying to operate on the ae_params apple event thingy but I'm
getting nowhere. I even created an elaborate debugging function to
print out simple values and the top-level of objects:

function printdebug(xxx)
{
var xxxValues, thetype;
thetype = typeof(xxx);
if (thetype == "object") {
xxxValues = "var object" + (xxx.length==undefined?"":"[" + xxx.length
+ "]") +" =";
try {
for (var x in xxx) {
xxxValues += ",\r"
xxxValues += " " + x + ": " + xxx[x];
}
} catch (e) {
MacOS.beep();
Core.warning("error: " + e.toString());
}
} else if (thetype == "function") {
xxxValues = "function() ..."
} else if (thetype = "undefined") {
xxxValues = "undefined"
} else { // not object
xxxValues = "var " + typeof(xxx) + " = " + xxx;
}
Core.message(xxxValues);
}

Now, when I did: printdebug(ae_params), I did get something pretty to
look at. However, when I did: printdebug(ae_params.of), nothing came
up at all. After inserting more try-catches which got me no-where, I
then started moving some intermitted Core.message calls to see what is
going on and it appears that on the following line:
xxxValues += " " + x + ": " + xxx[x];, execution would halt and
nothing would happen. Nothing to catch. The variable x had the number
zero. Evaluating the xxx[x] killed it.

Any ideas on what is happening?

Also... The documentation is a bit sparce. I didn't know I was
supposed to have an ae_params as an argument to the handler, I thought
I could have the parameters for the apple event themselves be the
parameters for the function. I wonder why they must be accessed
indirectly.

~ David Smiley




Wed Dec 10, 2003 7:58 pm

dsmiley9
Offline Offline
Send Email Send Email

Forward
Message #426 of 529 |
Expand Messages Author Sort by Date

Hi all. Today I tried for several hours to get going with JavaScript OSA in Apple's Mail environment. I installed the OSA component properly. I've been able...
David Smiley
dsmiley9
Offline Send Email
Dec 9, 2003
7:57 pm

... Hi, David. I've never scripted Mail with either AppleScript or JavaScript, but I gave it a shot today. There is an AppleScript called "Sample Rule Action...
Arthur Knapp
admiralnovia
Offline Send Email
Dec 10, 2003
5:58 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help