2 Replies Latest reply: Jun 21, 2013 9:52 PM by BenS.
seblavoie Level 1 Level 1 (0 points)

Is there a way to start OS X new dictation from AppleScript?

 

I tried :

 

 

tell application "DictationIM" to activate

 

but it did not seem to work although it didn't give me an error.

 

Any clue?


MacBook Pro (15-inch Mid 2009), OS X Mountain Lion (10.8.2)
  • 1. Re: Start dictation with applescript
    Pierre L. Level 4 Level 4 (3,860 points)

    Hi,

     

    If you don't mind using GUI Scripting (you must enable access for assistive devices in the Accessibility System Preference pane), the following script should toggle the Dictation switch between On and Off.

     

    tell application "System Preferences"

        reveal pane id "com.apple.preference.speech"

        -- activate -- only if you wish to make the Dictation & Speech window visible

        tell application "System Events"

            tell process "System Preferences"

                tell window "Dictation & Speech"

                    tell tab group 1

                        click radio button "Dictation"

                        tell radio group 1

                            if value of radio button "On" is 0 then

                                click radio button "On"

                            else

                                click radio button "Off"

                            end if

                        end tell

                    end tell

                    if sheet 1 exists then

                        tell sheet 1

                            click button "Enable Dictation"

                            repeat while sheet 1 exists

                            end repeat

                        end tell

                    end if

                end tell

            end tell

        end tell

        quit -- optional

    end tell

     

    Hope it can help.


     

    Message was edited by: Pierre L.

  • 2. Re: Start dictation with applescript
    BenS. Level 1 Level 1 (5 points)

    I made this script for a usb controller, hopefully it's what you're looking for!

     

    tell application "System Events"

              set theProcess to first process whose frontmost is true

              tell theProcess

                        repeat 2 times

                        key down {command}

                        key up {command}

                        end repeat

              end tell

    end tell