Make my own scripts - tips?

I am getting tempted to try to lear a bit about scripts. Bought Take control - Automation for Mac kind of explains a bit.

Anyone have any tips of books (in English) for absolute beginners that is good. Found about ten different and they all have different reviews.

Trust the tips I get in this forum more than Amazon :wink:.

So what I need is to first learn Automator I suppose and then continue later to learn to write my own scripts. Found Apples page about scripts but don´t think Apple themselves are behind it.( … index.html).

Found a few video courses as well (Oreillys and Lynda if I remember correct) but again, not sure what is good respectively not worth the money.

Actually, I wouldn’t start with Automator as it’s not about Applescript, but chaining simple workflows together.

Best Applescript reference on the web:

BTW, is a legitimate and well-respected resource. Shane Stanley has been around for a long time and has worked closely with Apple on many Applescript issues.

Years ago, I was once pwned (and yes, that just marked me as a recovering Warcraft junkie :open_mouth: :laughing: ) on MacScripter as I was always trying to build the most concise, one-line scripts. One of the veterans posted the shortest functional Applescript.


```Seriously! That's an Applescript!  <img src="//" width="15" height="17" alt=":mrgreen:" title="Mr. Green"/> 

If you click on the Script menu next to the clock in your menubar, you'll see Apple provided scripts you can open and try and understand. You need to start understanding how to "talk to the computer" in Applescript.

Also, in Script Editor, choose [b]File > Open Dictionary[/b] [i](or [b]Command-Shift-O[/b])[/i] to open an application's dictionary. [i](This also lets you know which apps have an sdef (script definition - the fancy name for the dictionary) file. These apps are scriptable to one degree or another.)[/i]
Like any dictionary it lists "nouns", "verbs", and "adjectives" in its own dialect. [i](The language is Applescript, but the dialect is DEVONthink-ian.)[/i] <img src="//" width="15" height="17" alt="8)" title="Cool"/> 

Lastly, have some idea you want to try and start coding… and failing… and tweaking… and failing… and reading, then fixing… and failing… and rewriting… and, "Hey! That kinda worked!" 
You may now be officially hooked. Don't blame me.  <img src="//" width="15" height="17" alt=":mrgreen:" title="Mr. Green"/>

PS: I've had the rare blessing of Applescripting professionally for over a decade. I have never bought a book on the subject. I did participate in MacScripter a long time ago and it's always a great resource to return to. But the key to my success is I have [b]rarely[/b] ever said, "It can't be done." Maybe not a pure Applescript solution, but who says I can't say "Ya'll" just because I'm up north?  :laughing:

The way to learn to code is to code. You’ve mentioned several good books, and the MacOSXAutomation site (not run by Apple, btw). There’s also and a few others.

Find a few scripts you like to use, among the ones shipped with DEVONthink, and published on the forum or elsewhere. Then read the scripts and work out how they operate. The first time you do this it will be frustrating and slow going – especially if you haven’t coded before. You’ll catch on quickly though. Your books and the sites above will help. You’ll want to consult the DEVONthink dictionary as you go (File > Open Dictionary in Script Editor.)

An editor that includes a debugger is useful – but the built-in Script Editor (Yosemite) doesn’t do that. Script Debugger is excellent for this, but is really expensive. However, they offer a 20 day trial so if you really focus you can learn a lot in a short period. Script Debugger lets you execute a script step by step and watch the results of every command. It also lets you explore a DEVONthink database and see the scriptable elements in each record.

Thanks Jim & Korm!

Already now I feel that I know more :wink:. (Beep…). After starting to work with Devonthink I suddenly started to realize how much help I can get just by learning a little bit more and the more you learn the more fun! I still have tons to learn about DT but the small scripts to move emails in to DT woke me up and got me interested.

I will the skip Automator and go right to AppleScripts.

Again, thanks!

Learn AppleScript: The Comprehensive Guide to Scripting and Automation on Mac OS X
Hamish Sanderson (Author), Hanaan Rosenthal (Author)

A great book, from beginner all the way to pretty advanced stuff with lots of worked examples you can pretty drop into your own scripts. I can’t recommend this highly enough.

The AppleScript Language Guide … eptual/app lescriptlangguide/introduction/ASLR_intro.html

Overall I can endorse what everyone else has said. The best approach is to
a) decided on something simple that you would like DT to do for you
b) search the forums for a script that does something similar
c) dissect the script to work out what each line does
d) change the script just to make it do what you need

When you are starting out, writing a script completely from scratch is seldom the best approach. DT is a really great place to start learning applescript. The object model is clean and you arent exposed to too many of applescripts numerous quirks that scripting out in the wilds of mail or the finder brings.

I also cant recommend script debugger highly enough but its very expensive. v5 is just stellar. The dictionary explorer view which gives you a real time look into the object model is an amazing learning tool.


Many thanks! Bought the book by Rosenthal and Sanderson. At a glance it seems to be written both for beginners like me but also for a bit more advanced I think, but we´ll see. Downloaded a trial version of Script Debugger, 200 bucks is a bit much just to test. But for sure ok if I understand and have use for it. Does not seem that the developer has any specials so most likely it will cost 199 when the trial ends.

But the 140 I paid for DevonThink is the best invested money so far in any app and I started with Mac SE30 around 1987. Only remember PageMaker being this useful but thats dead since long time ago. Think it pays off to get quality, fewer apps but better.