Opening applications with Apple Script
I know this isn't specifically VoiceOver related, but I have just started delving into Applescript.
What I'm coding is basically a windows run command on steroids, which checks to see if I'm trying to make it do something special (e:firstname.lastname@example.org, w:google.com for example), and if I'm not, open the app I tell it too.
However, 8 times out of 10, opening an app causes it to open in the background, meaning I have to command tab to it.
It's not a big thing, but it's a little annoying.
Anyways, here's what the script is doing:
tell application "whatever" to activate
tell application "whatever" to set visible of first window to true
This seems to happen particularly often with Terminal.
Thanks in advance.
I am super impressed with some of the Apple Scripts that I have seen from Chris Norman and others on this site. I would greatly appreciate it if someone could point Me to some guides or training resources where I might learn to Script.
Thanks in advance.
Sea No Evil.
There is a tutorial which I have sort of flown past on my wild excursions through google, but what I did was just figured out what I wanted to do, and did it.
The biggest script I wrote (the run thing), I knew I wanted to start with some sort of dialog box, so I just googled "how to make a dialog box in apple script" (or words to that affect).
From there I needed to see if there was a colon in the input string, so I googled "How to see if a string contains a certain character in apple script".
Finally, there's a whole load of scripts already in OS X which you can read and figure out what they do.
Apple script is a bit of a pain to my mind because it attempts to be so simple... It's not alway7s obvious what terminology you need to use. Bhe basics of it however are this:
tell application "application name in quotes"
Most things (tell, try, ignoring, if etc), are terminated with end, so end try, end if, end ignoring, end tell etc.
As a parting shot, if I'm honest, if I had to rewrite the script from the ground up without the aid of google, I highly doubt I'd be able to do it.
Have fun, and happy hacking!