You have to activate the program first so your first line is:
tell application Finder activate end tell
Now for the fun part. Back we go to System Events in order to get an item "clicked." Here is the full script of the process, which you can modify as you need fit:
tell application "System Events" tell process "Finder" click menu item "Get Info" of menu "File" of menu bar 1 end tell end tell
In this instance, you've just told the Finder to get info on your item, which is a relatively stupid thing to ask System Events to do, but you get the point. For an Automator process, this can come in very handy, as System Events can do a lot of things that Automator actions just can't do.
You'll notice that I have to include the menu AND the menu bar. If the action doesn't work, there is a big chance that you have to modify the menu bar to another number. Just fiddle with that setting until you figure it out. In order for ANY of this to work, you have to turn on assistive devices, which is in the Universal Access Preference in System Preferences.
There are many other clickable things that can be done with System Events, but that would be the subject of an advanced AppleScript tutorial. Let's just say System Events can do a hell of a lot of things!
Here is the completed GUI Script for you to copy into Script Editor or Automator to modify for whatever you need:
tell application "Finder" activate end tell tell application "System Events" tell process "Finder" click menu item "Get Info" of menu "File" of menu bar 1 end tell end tell
Now no GUI AppleScript piece is complete without Damned, the AppleScript from Hell. It won't damage your system in any way, so don't think it's a virus. It is incredibly annoying once executed, though, SO BE WARNED!!!
Damned.zip 17.46K
12 downloads



Sign In
Create Account









