Re: Applescript newbie trying to do something easy
Re: Applescript newbie trying to do something easy
- Subject: Re: Applescript newbie trying to do something easy
- From: Edward Ned Harvey <email@hidden>
- Date: Fri, 27 Mar 2009 10:35:25 -0400
- Thread-topic: Applescript newbie trying to do something easy
Title: Re: Applescript newbie trying to do something easy
How do I find the applications dictionary? For example Entourage ...
On 3/24/09 6:08 AM, "Steve Thompson" <email@hidden> wrote:
As others on the list will tell you, it's a combination of reading the application's dictionary, experience and trial and error!
Checking for IMAP accounts is a bit broken in Entourage. If there are no IMAP accounts then the script dies so you have to prepare for that
tell application "Microsoft Entourage"
try
set imapAccounts to the name of every IMAP account
on error
set imapAccounts to {""}
end try
end tell
In your original script you had a choose...with structure of some sort. That would mean that you could only choose a folder that existed so you can be confident it's there for the rest of your script.
tell application "Microsoft Entourage"
set inbox to (IMAP inbox folder of IMAP account "Steve_Test")
name of every folder of inbox
-->{"Deleted Messages", "Drafts", "Sent Messages", "Spam", "AppleScript", "Apple Mail To Do", "B3TA", "Calendar", "Contacts", "FOAF", "Funny", "IBM Dev Works", "Jobs", "Junk", "Notes", "Open Rights Group", "Ruby", "Sent", "Tasks", "Trash", "Twitter"}
exists folder "Splunge" of inbox
--> false
end tell
>Nothing tells me the "type of" for any variable or object
set m to 5
set n to "Hello"
set o to 4.5
class of m
-->integer
class of n
-->text
class of o
-->real
>Basically I just stink at applescript.
Only if you expect that "applescript newbies" should be experts within about 10 minutes. It is hard work especially since working out some of what's going on relies on getting in the heads of the programmers that added the AppleScript functionality to their applications. Some of the things you'll come across probably made sense to them at some point...
Steve
On 23 Mar 2009, at 22:33, Edward Ned Harvey wrote:
Yes! That did it ... For Exchange accounts, and local folders I'm good now. I still have no way to do this on IMAP, but fortunately for me, I don't care about IMAP.
I am curious though - when it fails for IMAP, there's simply no response. No error, no nothing.
I am a computer engineer (half software developer, half hardware engineer) and I can't find anything I would call an API for applescript, or a manual, or language reference... Can't find any way to get any logging out of it, or insert breakpoints or anything.
Nothing tells me the "type of" for any variable or object ... or what additional arguments are valid ... Basically I just stink at applescript.
How does one go about figuring out that "main_account" was actually a list?
How does one go about looking up the syntax that's available for the "move" command in a specific context ... For example ...
move aMessage to theFolder
is what I already had.
How should I know that this exists:
move aMessage to theFolder in item 1 of every Exchange account
How should I know that this doesn't exist:
move aMessage to theFolder in item 1 of every IMAP account
Thanks a million ...
----- Original Message -----
From: Steve Thompson <mailto:email@hidden>
To: email@hidden
Sent: Wednesday, March 18, 2009 8:46 AM
Subject: Re: Re: Applescript newbie trying to do something easy
I think this is what you're missing. It doesn't do exactly what your script aims to do but only because I'm lazy :-) It shows the missing bits.
tell application "Microsoft Entourage"
set main_account to item 1 of every Exchange account
set theFolder to "Some Folder"
set theSelectedMessages to selection
repeat with aMessage in theSelectedMessages
move aMessage to theFolder in main_account
end repeat
end tell
Hope this helps
Steve
----------------------------
http://www.stetho.co.uk
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden