Skip navigation

Start dictation with applescript

1182 Views 2 Replies Latest reply: Jun 21, 2013 9:52 PM by BenS. RSS
seblavoie Calculating status...
Currently Being Moderated
Nov 22, 2012 6:22 PM

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)
  • Pierre L. Level 4 Level 4 (3,860 points)
    Currently Being Moderated
    Nov 23, 2012 5:39 AM (in response to seblavoie)

    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.

  • BenS. Calculating status...
    Currently Being Moderated
    Jun 21, 2013 9:52 PM (in response to seblavoie)

    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

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.