• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: 'load script' fails for Mail rule script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'load script' fails for Mail rule script


  • Subject: Re: 'load script' fails for Mail rule script
  • From: Michael Terry <email@hidden>
  • Date: Mon, 16 Feb 2004 00:37:14 -0800

On Feb 15, 2004, at 11:58 PM, Lachlan Deck wrote:

Hi all,

I'm setting up some Mail rules - some using AppleScripts for some custom filtering etc.

Anyway, I'm finding that the load script directive fails when used with a rule script but is fine otherwise - so how do I take advantage of 'code-reuse' with such a script rather than having to cut and paste the code?

Thanks. Here's a simplified example of what I'm doing....

property utilScriptFolder: "/Applications/AppleScript/Example Scripts/Mail Scripts/Rules/utils/"
property LDUtil: utilScriptFolder & "LDUtil.scpt"
property DEBUG: true
property DEBUG_MESSAGE: "Hi"

on debugMsg()
if DEBUG then tell app "Mail" ,
to display dialog DEBUG_MESSAGE
end debugMsg

on perform_mail_action(info)
tell application "Mail"
my debugMsg()
-- fails on next line...
set utilScript to load script (POSIX file LDUtil)
my debugMsg() -- never seen
end tell
end perform_mail_action


Just to test exactly what's going on, what if you change it to:

set utilScript to load script (choose file)

And if that still seems to fail, do this, and what's the result?:

on perform_mail_action(info)
try
tell application "Mail"
my debugMsg()
-- fails on next line...
set utilScript to load script (POSIX file LDUtil)
my debugMsg() -- never seen
end tell
on error eMsg number eNum
tell app (path to frontmost application as unicode text)
display dialog ((eNum as unicode text) & ": " & eMsg)
end
end
end perform_mail_action


Mike
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: 'load script' fails for Mail rule script
      • From: Lachlan Deck <email@hidden>
References: 
 >'load script' fails for Mail rule script (From: Lachlan Deck <email@hidden>)

  • Prev by Date: iTunes scripting - comparing playlists
  • Next by Date: addendum to iTunes scripting
  • Previous by thread: 'load script' fails for Mail rule script
  • Next by thread: Re: 'load script' fails for Mail rule script
  • Index(es):
    • Date
    • Thread