0

I have successfully been able to use the lightly-document widget.system to run a "command-line" processes from a Dashboard widget...

if(window.widget) {
    if(currentlyBeingSpoken != null) {
    currentlyBeingSpoken.cancel();
    }
    currentlyBeingSpoken = \
    widget.system("/usr/bin/osascript -e 'say \
    "" + textToSpeak + "\" using \"" 
    + chosenVoice + "\"'" , done);
}

I want to "do" the same kind of thing from a Cocoa "WebView".

How can this be accomplished? Is it just a matter of finding the right part of Apple's Javascript code? Or is this a runtime implementation of the dashboard that is not accessible from a WebView?

Alex Gray
  • 16,007
  • 9
  • 96
  • 118
  • 1
    It's added to the WebView by Dashboard. You would have to write a plugin to do this. – ughoavgfhw Sep 10 '11 at 17:00
  • 1
    If you’re using Cocoa, why not execute the AppleScript/command-line utility yourself? –  Sep 10 '11 at 19:01
  • i'm trying to "do things" from within the WebView, without hooking up some socket or cgi hocus-pocus... I know that you can do a custom URI scheme for applescript (complicated), or a native cocoa button.. and I THINK you can explicitly "match" javascript calls to native objective c functions, but the documentation for that is dicey, and this seemed easier.. – Alex Gray Sep 11 '11 at 11:08

0 Answers0