Hottest Free Downloads - DownloadPipe.com Over 197,000 downloads! Bookmark Now!
DownloadPipe.com - New Downloads Every Minute
 SEARCH:
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Simple script works when run, but not in Mail.app handler

 
   Mac (Home) -> Apple Scripts RSS
Next:  Adding New Folder  
Author Message
donjuedo

External


Since: Oct 02, 2005
Posts: 4



(Msg. 1) Posted: Sun Oct 02, 2005 8:25 pm
Post subject: Simple script works when run, but not in Mail.app handler
Archived from groups: alt>comp>lang>applescript (more info?)

Hi,

I am an Applescript beginner wannabe, but have done extensive digging
to try to answer my question, so please forgive me if everyone knows it
but me.

When I run this script,

tell application "Mail"
set path_to_file to "Macintosh HD:"
set path_to_file to path_to_file &
"Users:peterlawton:Desktop:MailFilterLog.txt"
set fileRef to open for access file path_to_file with write permission
close access fileRef
end tell

in Script Debugger, it runs fine as a standalone script. But when I
try it in Mail.app's perform_mail_action(info) handler, the "set
fileRef to open ..." fails with a -1712 error, "applescript timed out".
In case it matters, I am single-stepping in both cases.

Can anyone shed some light on this for me? Obviously, I don't care to
run this script as a standalone one.

TIA,

Peter Lawton
Back to top
Login to vote
donjuedo

External


Since: Oct 02, 2005
Posts: 4



(Msg. 2) Posted: Sun Oct 02, 2005 9:03 pm
Post subject: Re: Simple script works when run, but not in Mail.app handler [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hey, thanks! That ought to get me on my way.

Just curious, should it work inside tell application "Mail" ...?


Peter
Back to top
Login to vote
donjuedo

External


Since: Oct 02, 2005
Posts: 4



(Msg. 3) Posted: Mon Oct 03, 2005 5:17 am
Post subject: Re: Simple script works when run, but not in Mail.app handler [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi again,

I changed the Mail.app handler to begin like this, without targeting
Mail.app yet:

on perform_mail_action(info)
try
set path_to_file to "Macintosh HD:"
set path_to_file to path_to_file &
"Users:peterlawton:Desktop:MailFilterLog.txt"
set fileRef to open for access file path_to_file with write
permission


It is still timing out. I do think it should be working, as basic as
it is. If anyone has time to create a new Mail.app rule that runs an
Applescript, which starts as above, I would be greatly interested in
the outcome.


Peter
Back to top
Login to vote
Sander Tekelenburg

External


Since: Aug 24, 2005
Posts: 120



(Msg. 4) Posted: Mon Oct 03, 2005 5:42 am
Post subject: Re: Simple script works when run, but not in Mail.app handler [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <1128309946.781624.193230 DeleteThis @f14g2000cwb.googlegroups.com>,
"donjuedo" <peter.lawton DeleteThis @earthlink.net> wrote:

[...]

> tell application "Mail"
> set path_to_file to "Macintosh HD:"
> set path_to_file to path_to_file &
> "Users:peterlawton:Desktop:MailFilterLog.txt"
> set fileRef to open for access file path_to_file with write permission
> close access fileRef
> end tell

None of this has anything to do with Mail.app. Only target an app when
you need to - you don't want to end up as confused as John Gruber.

--
Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>
Back to top
Login to vote
donjuedo

External


Since: Oct 02, 2005
Posts: 4



(Msg. 5) Posted: Mon Oct 03, 2005 10:13 am
Post subject: Re: Simple script works when run, but not in Mail.app handler [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I found that if I tell the Finder to open the file, the simple
(Mail.app) script succeeds regardless of whether run as a handler or
run as a standalone.

Problem solved.
Back to top
Login to vote
Sander Tekelenburg

External


Since: Aug 24, 2005
Posts: 120



(Msg. 6) Posted: Mon Oct 03, 2005 5:12 pm
Post subject: Re: Simple script works when run, but not in Mail.app handler [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <1128312193.031265.65940.RemoveThis@f14g2000cwb.googlegroups.com>,
"donjuedo" <peter.lawton.RemoveThis@earthlink.net> wrote:

> Hey, thanks! That ought to get me on my way.
>
> Just curious, should it work inside tell application "Mail" ...?

<http://www.xs4all.nl/~hanb/documents/quotingguide.html>

--
Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Works in Script Editor, but not as Mail Rule ... why? - Here's a Mail Rule I wrote to do the following: 1. Check all incoming messages for attachments 2. For every new message with attachments, create a new folder named for the message's subject and date. Save the attachments in the folder. 3. Save the..

OSX-Script works on Classic - Hello friends, can I make a script on Mac OS X work via the network on a "Classic" machine? - If so - what settings do I have to obey (Firewall etc)? - Does someone have a link or an article on that topic? I tried it - but cannot make it wor...

Simple question - Dear friends, I have written a Finder scripts in this mood : tell application "Finder" activate set w to window of folder "mypath" set x to list view options of w set visible of column id creation date column of x to ...

Help with script, please - Here is the script: tell application "Mail" set foo to the selection set foo to item 1 of foo set address_ to address of item 1 of to recipient of foo if not (name of item 1 of to recipient of foo exists) then set AppleScript...

Why this script doesn't work ? - The script: tell application "Finder" activate repeat set w to display dialog "salary?" default answer "2000" set wSal to text returned of w display dialog wSa...
       Mac (Home) -> Apple Scripts All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum
Categories:
 Windows Forums
 Game Forums
 Linux Forums
  Mac Forums
 PDA Forums
 Mobile Forums
  Top  |  Store  |  RSS Feeds RSS  |  Data Feeds  |  Advertise  |  Submit  |  Bookmark  |  Newsletter  |  Contact