Benches macOS

4

Script to tell Safari to go back

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I am looking to program my Mighty Mouse tell Safari to go back. I cannot seem to figure out how to program "button 3" to go BACK. Is there a simple script that I can write that will initiate a "Command [" keystroke to tell any app to go back?

4 replies

Sign in or join Beachball Help to reply.

  1. 0

    V.K.

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Try USB overdrive.
    http://www.usboverdrive.com/USBOverdrive/News.html

    It will let you do what you want.

    Scripting will not help you with this kind of problem.

  2. 0

    xnav

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I think that if you assign this AppleScript to button 3, it should work, but I can't get it to.

    tell application "Safari"

    do JavaScript "history.back()"

    end tell

  3. 0

    xnav

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    OK, I got this AppleScript to work:

    tell application "Safari"

    do JavaScript "history.back()" in document 1

    end tell

    Insert the above into the AppleScript editor, compile and 'Save As' an Application. Only check 'Run Only' on the 'Save As' dialog. Now use 'Other' in the mouse button3 assignment dialog pull down to specify the AppleScript application you just saved. Done, button3 will now perform a 'Back' when clicked in an active Safari window.

  4. 0

    xnav

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I have developed a more efficient script. The setup remains the same as my previous post, but the script should read:

    tell application "Safari"

    activate

    tell application "System Events" to keystroke "[" using command down

    end tell