*This message was transferred with a trial version of CommuniGate(tm) Pro* Comments inline.
On Wed, Apr 28, 2004, Marlyse Comte said: > >thanks Andy - > >so, to define a global variable I just write > >global: "nameVariable" > The syntax is just "global nameVariable", without the quotes. I don't often start my scripts with a run statement but if you use one then I think I'd put the global declaration inside the run statement. >and that would apply as a variable to PM and to iCal... as it is global. >correct? and I would do that before even "on run"? > It should work that way. That's how I passed variable names in my Burst package. >that might have been my problem before. I kind of bypassed the variable >by using "the clipboard", assuming if the Script Editor turns it blue, >it's some global thing, and it seems to work. > >but as you assumed, defining the selection has a bit a drawback, I really >need to have the text selected, which does not work with the From or >Reply-To field, they deselect the moment I move the mouse. > >how would I "assign in the usual fashion" a FROM to selection or to >clipboard or whatever so I could pass it on and paste it later in the >script into iCal? tell application "PowerMail 5.0b12" set theMessages to current messages repeat with msg in theMessages -- put your code here to do something on each message msg set theText to sender of msg set theName to display name of theText set theEmail to email address of theText display dialog theName display dialog theEmail end repeat end tell Of course, in the above example you would likely have to declare theName and theEmail as globals. Something like the following. global theName, theEmail Keep asking specific questions. -- Andy Fragen >---marlyse > >------------ former message(s) quotes: ------------- > >> *This message was transferred with a trial version of CommuniGate(tm) >> Pro* Marlyse, >> Here's what I do. I usually don't like defining global variables. I >> define a global variable at the beginning of the script >> >> global: "theText" >> >> tell application "PowerMail" >> >> set theText to the selection --if that works then it's really simple >> end tell >> >> I find this takes care of the problem between passing variables >> between different tell statements. See if that works for you. If PM >> doesn't like the assignment of the variable from the selection you'll >> have to figure something else from the message that you want to >> capture (From, Subject, whatever) and assign that in the usual >> fashion. I think defining a global variable will make the difference >> for you here. >> -- >> >> Andy Fragen > > >