7/12/02 7:49 chris :

>>Maybe you should switch to the AppleScript list, some 
>>smart people live there, including our own Michelle Steiner.
>
>I think I shall... which one do you recommend? (I haven't looked yet, but 
>if there is one with Michelle on it, that's probably a good place to 
>start asking AS and Emailer interaction questions)

I only tried Apple's Applescript-users list. Michelle posted there many 
times.

>Ok, so this seems like a decent idea... but A: how do I call a script 
>from a script (that is, call one that isn't compiled into an application, 
>since the Emailer script menu scripts can't be compiled as an 
>application)

I didn't think of that. It might get harder than it's worth.

Scripting Emailer's script menu should work.

tell application "Claris Emailer"
                activate -- required to select menus
                select menu item "My Script" of menu 8
end tell

(menus and items are called by id or name, but the scripts menu name is 
unclear, in my Emailer 2.0v1 it's menu 8)

To have a look at available menus:
(every menu)
     -- menu references
name of (every menu)
     -- menu names
((every menu item) of (every menu))
     -- menu item references
((name of every menu item) of (every menu))
     -- menu item names

This returns long hairy lists, I made a very basic delistifier script to 
get something more readable in Smile, I can post it. BBEdit's 
search/replace and synchro scrolling are handy too, but will flatten 
AppleScript's styled text.


MessageID-related scripts also work from OSA Menu when Emailer's in 
front, so there might be other solutions (OSA Menu, shortcuts, Youpikey, 
Alias Menu, Quickeys, etc.)

> And B: how do I pass a parameter (or multiple ones) between 
>scripts?

This is trickier. In other cases I would use load script then call it's 
handlers with some parameters, but I can't do that from a simulated 
Emailer menu. Maybe it's the 2nd script that should get params itself, 
but I don't know how.

Or maybe it's the opposite: the script could be called from Emailer in 
the first place and ask iPhoto's selection (I have a similar script to 
create a message with the Finder's selection as attachments).

Oh, no, wait. I think I have it.

>(not without writing them out to a temp file and reading them back in 
>with the 2nd script...

Trick: the 1st script could set properties of the 2nd one, then trigger 
Emailer's menu, so it wouldn't need parameters...

There would be a "Open my forged messages" script in Emailer looking like:

property messagesToOpen: {}
tell app "Emailer"
  if not messagesToOpen = {} then
                  repeat with thisMessage in messagesToOpen
                          open thisMessage
                  end
  end
end

The 1st script would set the messagesToOpen property to a list of ids 
previously returned by your make new message commands. It would need to 
know where this "Open..." script is to set it's property, so a prefs file 
in a fixed location (prefs folder) could be cleaner.

Basics of properties and prefs scripts:

--- make it --- (if using an intermediate prefs file)
script myPrefs
        property myPref : {}
end script
store script myPrefs in zeFile
-- where zeFile is the path to the prefs file
-- use (path to preferences) to find the prefs folder

--- set it ---
set workPrefs to load script zeFile
set myPref of workPrefs to {"tata", "toto"}
store script workPrefs in zeFile

--- use it ---
set workPrefs to load script zeFile
set myVariable to myPref of workPrefs
-- do whatever with it

>with the 2nd script... and if that much trouble is involved... well screw 
>it, I'll just manually open the new message myself each time I use the 

Yep, the efforts seem out of scale.

----
VRic

___________________________________________________________________________
To unsubscribe send a mail message with a SUBJECT line of "unsubscribe" to
<[EMAIL PROTECTED]>  or  <[EMAIL PROTECTED]>

Reply via email to