Go Back   The macosxhints Forums > OS X Help Requests > AppleScript



Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
Old 04-25-2012, 04:03 PM   #1
robleach
Prospect
 
Join Date: Feb 2003
Posts: 32
Dictionary shortcomings

Hi,

Other than reading a book and memorizing everything, is there a good reliable resource to find applescript words that don't have dictionary entries? For example, say I wanted to know, "What are the ways I can refer to a specific window?" I would search for the word "window", but would not find what I'm looking for. Unless I know one or two of the words already or have the intuition to look up the window property "index", I'd never find documentation like I found here on macosxautomation.com:
Referring to a Finder Window
Finder windows, and other scriptable objects as well, can be referenced in a variety of ways:

by name:
Finder window "Documents"
by numeric index:
Finder window 1
by descriptive index:
the first Finder window
the second Finder window
the fifth Finder window
the 1st Finder window
the 23rd Finder window
by By position relative to other windows:
the front Finder window
the middle Finder window
the back Finder window
the last Finder window
the Finder window before the last Finder window
the Finder window after the first Finder window
by random index:
some Finder window
I can't seem to find a reliable way of finding words like "front", "middle", "back", "last", "before", "after", "first", "second", etc. unless I already know one or two of them. I mean, I suppose I could google around and find a couple words and then perhaps stumble upon something like the link above, but is there some resource that I could search using the word "window" and it would come back with all the adjectives I can use to specify a window? There's got to be something out there!

Thanks,
Rob
robleach is offline   Reply With Quote
Old 04-25-2012, 04:29 PM   #2
regulus6633
Major Leaguer
 
Join Date: Apr 2005
Posts: 478
I don't think there's a resource for what you're asking. You basically want a thesaurus for applescript terms... but I can't think of any. But you have a pretty good resource right at your fingertips. Open AppleScript Editor and look under the help menu. You'll find the applescript language guide and that will answer many of your questions. For example, I opened it as a PDF file so it's searchable. I searched for "last" and it showed me table 1-1 which is a list of all keywords... including those mentioned in your post.
__________________
Hank
http://www.hamsoftengineering.com
regulus6633 is offline   Reply With Quote
Old 04-26-2012, 09:24 AM   #3
robleach
Prospect
 
Join Date: Feb 2003
Posts: 32
Thanks Regulus,

That is quite handy, though it took some digging to find the PDF, so for anyone else who happens along this post, here it is:

AppleScriptLanguageGuide.pdf

It's not exactly what I was hoping for, but is worlds better than only using the dictionary when you're a novice like me. Incidentally, it looks like the word I should have been searching for is "specifier". The nice list I posted earlier is a list of object "specifiers" and (from reading in the docs just a few minutes, I learned) it works on a lot more than just windows. And the table you pointed out is a list of "reserved words" - very handy!

In my opinion, every reserved word should be in the dictionary. It's unthinkable to me that they are not. Is there a good reference book I can buy that has everything?

Rob
robleach is offline   Reply With Quote
Old 04-26-2012, 04:41 PM   #4
regulus6633
Major Leaguer
 
Join Date: Apr 2005
Posts: 478
Quote:
Originally Posted by robleach
In my opinion, every reserved word should be in the dictionary

What dictionary are you referring to? The language guide is the "dictionary" for the applescript language. The other place to learn applescript commands is the dictionary for the "standard additions osax". The StandardAdditions are additions Apple has made to the base applescript language.

In general the applescript language is made like this... you have commands that come from the base language, from the standard additions, and from each individual application. So for the base language you need the language guide. For the standard additions and for the individual applications you open their individual dictionary... under the File menu of AppleScript Editor you choose "open dictionary". From the list you can choose the StandardAdditions.osax or any application that is scriptable.

So you see, there is no one place for all commands. The beauty of applescript is that any application developer can make their application apple-scriptable. They define how applescript works with their application and they define the command names. This is why each application has their own dictionary. The advantage of this approach is it makes applescript extensible by anyone. The down-side is it makes learning the language a little difficult because commands and terminology can get mixed up when so many people make it.
__________________
Hank
http://www.hamsoftengineering.com
regulus6633 is offline   Reply With Quote
Old 04-26-2012, 06:17 PM   #5
robleach
Prospect
 
Join Date: Feb 2003
Posts: 32
Yeah

Yeah. Don't get me wrong. I'm all for AppleScript. I would just like to find comprehensive, lookup-oriented documentation with cross-references.

Rob
robleach is offline   Reply With Quote
Old 07-07-2012, 12:36 PM   #6
sojourner
Major Leaguer
 
Join Date: Apr 2010
Posts: 371
I love and thoroughly recommend tha "AppleScript" books by Hanaan Rosenthal. Not quite what you're looking for, and not in the format you're requesting, but very helpful in figuring out specifiers and how they can be used.
__________________
see a problem; solve a problem.
sojourner is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 01:30 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.