News
box
box
Events
box
box
Community
box
box

MacSpeech Forums and Discussion » MacSpeech Dictate » Extending Dictate

Some custom commands for hands-free Firefox

(3 posts)

Tags:

  1. endymion
    Member

    Here's a list of commands that I have written for Firefox. None of these commands use the Firefox menus, because MacSpeech will instantly crash Firefox if you try to make a command that uses a Firefox menu item. These commands are simply the Firefox keyboard shortcuts, translated into AppleScript, and wired into MacSpeech.

    The first command is the most important: "find link". That command will activate a search bar at the bottom of Firefox that will allow you to search within the text of the links on the page. If there is a link on the page that says "news" and you want to click on it, then say "find link", "no space", "news", "press okay". If MacSpeech supported a "no space" AppleScript action, then it would not be necessary for us to say "no space". I have requested that new action as a feature request from MacSpeech. I also experimented with a "follow link" command that would have put MacSpeech back into command mode after following a link, but MacSpeech currently does not respond to the AppleScript event "set microphone to command", so that's not possible. It responds to "set microphone to dictation" but as far as I can tell MacSpeech doesn't support going back to command mode using AppleScript, even though command, dictation and speech modes are all listed in the MacSpeech AppleScript command dictionary.

    Note that my commands differ from the built-in commands in that the built-in commands use many different verbs. "Select previous tab" for Safari, "Jump back", "Switch to Space One", "Move Page Up", etc. I don't want to have to pause to remember which verb to use when I'm trying to accomplish some task because that's distracting. I standardized all of my movement commands to use the verb "Move", so that I don't have to think about it. I use "Move Page Up", "Move Back", "Move Tab Left", "Move To Space One", and I never have to think about what verb to use.

    Command: Find Link
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "'"
    end tell
    tell application "MacSpeech Dictate"
    	set microphone to dictation
    end tell

    Command: Find Text
    Context: Firefox
    Desription: Same as "Find Link" but searches through all text.
    Source:

    tell application "System Events"
    	keystroke "/"
    end tell
    tell application "MacSpeech Dictate"
    	set microphone to dictation
    end tell

    Command: Do A Google Search
    Context: Firefox
    Source:

    tell application "System Events"
    	keystroke "f" using {option down, command down}
    end tell
    tell application "MacSpeech Dictate"
    	set microphone to dictation
    end tell

    Command: Go To Location
    Context: Firefox
    Source:

    tell application "System Events"
    	keystroke "l" using {command down}
    end tell
    tell application "MacSpeech Dictate"
    	set microphone to dictation
    end tell

    Command: Move Back
    Context: Firefox
    Type: AppleScript
    Description: The "back" button.
    Source:

    tell application "System Events"
    	keystroke "[" using {command down}
    end tell

    Command: Move Forward
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "]" using {command down}
    end tell

    Command: Reload This Page
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "r" using {command down}
    end tell

    Command: Force Reload This Page
    Description: Most people probably don't need this command but I'm a web developer...
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "r" using {shift down, command down}
    end tell

    Command: Stop Loading
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "." using {command down}
    end tell

    Command: Zoom In
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "+" using {command down}
    end tell

    Command: Zoom Out
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "-" using {command down}
    end tell

    Command: Zoom Reset
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "0" using {command down}
    end tell

    Command: Make A New Tab
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "t" using {command down}
    end tell

    Command: Close This Tab
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "w" using {command down}
    end tell

    Command: Move Tab Left
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "{" using {command down}
    end tell

    Command: Move Tab Right
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "}" using {command down}
    end tell

    Command: Move To Tab One
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "1" using {command down}
    end tell

    Command: Move To Tab Two
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "2" using {command down}
    end tell

    Command: Move To Tab Three
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "3" using {command down}
    end tell

    Command: Move To Tab Four
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "4" using {command down}
    end tell

    Command: Move To Tab Five
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "5" using {command down}
    end tell

    Command: Move To Tab Six
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "6" using {command down}
    end tell

    Command: Move To Tab Seven
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "7" using {command down}
    end tell

    Command: Move To Tab Eight
    Context: Firefox
    Type: AppleScript
    Source:

    tell application "System Events"
    	keystroke "8" using {command down}
    end tell

    I have these commands set up in the global context, but I use them a lot with Firefox:

    Command: Move Page Down
    Context: Global
    Type: AppleScript
    Source:

    tell application "System Events"
    	key code 121
    end tell

    Command: Move Page Up
    Context: Global
    Type: AppleScript
    Source:

    tell application "System Events"
    	key code 116
    end tell

    Command: Move To Bottom
    Context: Global
    Type: AppleScript
    Source:

    tell application "System Events"
    	key code 125 using {command down}
    end tell

    Command: Move To Top
    Context: Global
    Type: AppleScript
    Source:

    tell application "System Events"
    	key code 126 using {command down}
    end tell
    Posted 1 year ago #
  2. cedar
    Member

    I very much want to use your helpful scripts. I installed the one for Find Link and that works fine. Then I installed the rest and none of them are working. For some reason, even though I carefully pasted the different scripts in for each command, they all end up saying, in all kinds of psychedelic colors:

    set _dictateApp to (name of current application)
    tell application _dictateApp
    set bundleID to (bundle identifier of current context)
    end tell
    set _currentAppName to short name of (info for (path to application id bundleID as alias))

    What is going on here?

    Thanks in advance…

    Posted 2 months ago #
  3. cedar
    Member

    Since I couldn't make the scripts work, I created a bunch of menu commands. They work, but they are extremely slow.

    Posted 1 month ago #

RSS feed for this topic

Reply

You must log in to post.