I also have trouble with Applescripts not performing when called by a
filter during mail collection but working fine when called manually (ie.
from the "Perform Filter" menu item).

The one that most annoys me is a script that adds some info such as the
sender's name, the date, etc, into the comments for any attached files,
so if I can't remember who sent me file signo-abb24.sit I just have to
Cmd-i and I can find out. But the script never runs automatically, only
if I cal it from the menu. Not very useful. It used to work... but I'm
not sure when it stopped working. A while ago, that's for sure.

rick

-- 
G5 2GHz x2  ::  2GB RAM  ::  10.4.5  ::  PM 5.2.3  ::  3 pane mode

Shark Attack: A Design Studio
<www.sharkattack.co.uk>

--
Original message:
Received from George Henne on 2/6/06 at 16:16

>(Wayne: I think I understand you, but the changed code does the same thing)
>
>Here's the latest code.
>
>tell application "PowerMail"
>       set theMessages to current messages
>       repeat with msg in theMessages
>               -- put your code here to do something on each message msg
>               
>               if exists (attachments of msg) then
>                       set fileList to attachments of msg
>                       repeat with theFile in fileList -- this code does not 
> handle multiple
>CSV attachements
>                               set fname to theFile's name
>                               if fname contains ".csv" then
>                                       set myFile to theFile's file
>                                       set theText to my readFile(myFile)
>                               end if
>                       end repeat
>               else
>                       set theText to the content of msg & time sent of msg
>               end if
>       end repeat
>end tell
>
>-- now send the text to Hypercard
>set the clipboard to ((theText) as text)
>tell application "SuperCard 4.5"
>       activate
>       do script "go to card 1 of stack NSB Invoice SC"
>       do script "send mouseUp to cd button CopyClipboard"
>       do script "send mouseUp to cd button UpdateImport"
>end tell
>-- SuperCard will now generate the reply
>
>on readFile(theFile)
>       read theFile
>end readFile
>
>
>>Try moving your tell statements. 
>>Close the tell for PowerMail, then run your SuperCard, then open a new
>>Tell statement for Powermail to create a new message. That should fix
>>the problem. It will also prevent PM having to wait for SuperCard to finish.
>>
>>Wayne
>>
>>-----Original Message-----
>>>From: George Henne <[EMAIL PROTECTED]>
>>>Sent: Jun 2, 2006 9:34 AM
>>>To: Wayne Brissette <[EMAIL PROTECTED]>
>>>Subject: Re(2): Problem running AppleScript that creates email
>>>
>>>Wayne,
>>>
>>>That's very kind. 
>>>
>>>I simplified the explanation a bit on the board. The AppleScript
>>>actually calls Supercard, which is sending the message to Powermail; but
>>>I think the principle is the same.
>>>
>>>tell application "PowerMail"
>>>     set theMessages to current messages
>>>     repeat with msg in theMessages
>>>             -- put your code here to do something on each message msg
>>>             
>>>             if exists (attachments of msg) then
>>>                     set fileList to attachments of msg
>>>                     repeat with theFile in fileList -- this code does not 
>>> handle multiple
>>>CSV attachements
>>>                             set fname to theFile's name
>>>                             if fname contains ".csv" then
>>>                                     set myFile to theFile's file
>>>                                     set theText to my readFile(myFile)
>>>                             end if
>>>                     end repeat
>>>             else
>>>                     set theText to the content of msg & time sent of msg
>>>             end if
>>>             
>>>             -- now send the text to Hypercard
>>>             set the clipboard to ((theText) as text)
>>>             tell application "SuperCard 4.5"
>>>                     activate
>>>                     do script "go to card 1 of stack NSB Invoice SC"
>>>                     do script "send mouseUp to cd button CopyClipboard"
>>>                     do script "send mouseUp to cd button UpdateImport"
>>>             end tell
>>>  -- SuperCard will now generate the reply
>>>     end repeat
>>>end tell
>>>
>>>on readFile(theFile)
>>>     read theFile
>>>end readFile
>>>
>>>
>>>
>>>>I'll be happy to take a look at it if you want.
>>>>
>>>>Wayne
>>>>
>>>>-----Original Message-----
>>>>>From: George Henne <[EMAIL PROTECTED]>
>>>>>Sent: Jun 2, 2006 9:05 AM
>>>>>To: PowerMail Discussions <[EMAIL PROTECTED]>
>>>>>Subject: Problem running AppleScript that creates email
>>>>>
>>>>>I have an AppleScript that runs as a result of a mail filter. One of the
>>>>>things it does is create a PowerMail message. The script runs fine by
>>>>>itself: the problem is that it hangs when it is called from PowerMail.
>>>>>
>>>>>From what I can determine, PowerMail starts the script and waits for it
>>>>>to finish. The script tries to add an email to PowerMail's inbox, but
>>>>>PowerMail is not accepting events.
>>>>>
>>>>>Can anyone think of a way around this? We need PowerMail to start the
>>>>>script, then stop waiting for it.
>>>>>
>>>>>George Henne
>>>>>NS BASIC Corporation
>>>>>http://www.nsbasic.com
>>>>>
>>>>>
>>>
>>>
>
>
>
>






Reply via email to