Hi,

Are there any manuals on apple scripting? There are a few prorams i would like to write some scripts for?

Best

James
On 17 Apr 2007, at 03:44, Darcy Burnard wrote:

Hi. A couple quick points here. First off, I can't believe that I hadn't thought of using the delay statement in conjunction with the say statement. I have played a bit with the say statement, but hadn't had much luck with it since it was always being cut off by voice over. I agree that you can do some interesting things with UI scripting. I'm new at apple scripting, so haven't done a lot yet, but you can do simple things like make the sling box client change the tv channel. This is a minor thing I know, but that in conjunction with audio hijack pro can give you pretty good vcr type functionality if you don't need the video. Finally, to anyone who is new to apple script as I am, I would encourage you to check out the book "Applescript the missing manual". This is a great book that I've learned a lot from.
Darcy

On 16-Apr-07, at 12:50 PM, Josh de Lioncourt wrote:


Ever since this topic came up a few days ago, I've been thinking about it. I did some preliminary research and it seems that the ability to make programs more accessible via AppleScript was one of the things it was originally intended for, as far as Apple is concerned.

Indeed, the tool even has some functionality for UI elements, outside of mere macro recording, that allow you to write scripts for programs that do not expose their inner workings to AppleScript, though many do. A program does not have to be exposed to AppleScript to make it scriptable.

Shortcut keys can be assigned to AppleScripts easily on an application by application basis, but it seems there is a bug in assigning a global hot key to AppleScripts. It will appear next to the menu item in the ApppleScript menu, but pressing the key will not actually do anything. From what I've read, however, assigning hotkeys this way does work on an individual program basis.

I discovered this while writing a script for a feature that I've heard wished for many times here on this list, to read the system time with a single keystroke, without having to navigate to the clock. I created an AppleScript to do this extremely easily, the text of which will appear at the end of this message. The catch was that, without a global shortcut to assign to it, it's pretty useless.

Excepting the shortcut key limitations, AppleScript is substantially more powerful in most respects than Jaws Scripting, at least at an initial glance. I could see this becoming a huge asset.

The following is a very simple script to announce the current time via the system voice. If anyone figures out a way to assign a global shortcut key to this that actually works, I'm all ears. Below the script are a couple of very brief comments about it.


set theTime to the time string of the (current date)

delay 0.5
say theTime

As you can see, three simple lines give you an announcement of the time. The "delay 0.5" causes a delay of half a second before it actually speaks, giving VoiceOver a chance to shut up. I found that the say command will not work if VO is currently speaking. VO, rightly so, gets the priority to the speech engine. If you have VO speaking at a slower rate, you may wish to extend that time.

I look forward to hearing discussion on this.




Reply via email to