Warning: Declaration of mosaic_walker_nav_menu_dropdown::start_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::start_lvl(&$output, $depth = 0, $args = Array) in /home/linkevin/public_html/wp-content/themes/mosaic/functions.php on line 537

Warning: Declaration of mosaic_walker_nav_menu_dropdown::end_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::end_lvl(&$output, $depth = 0, $args = Array) in /home/linkevin/public_html/wp-content/themes/mosaic/functions.php on line 537

Warning: Declaration of mosaic_walker_nav_menu_dropdown::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = Array, $id = 0) in /home/linkevin/public_html/wp-content/themes/mosaic/functions.php on line 537

Warning: Declaration of mosaic_walker_nav_menu_dropdown::end_el(&$output, $item, $depth) should be compatible with Walker_Nav_Menu::end_el(&$output, $item, $depth = 0, $args = Array) in /home/linkevin/public_html/wp-content/themes/mosaic/functions.php on line 537

Warning: Parameter 2 to wp_hide_post_Public::query_posts_join() expected to be a reference, value given in /home/linkevin/public_html/wp-includes/class-wp-hook.php on line 286
AppleScript: Back Page Function in Browsers - The Notepad Blog

AppleScript: Back Page Function in Browsers

This week at work, I realized how pre-2010 my Mac’s Mighty Mouse was. There is a set of buttons on the side of the mouse, but it doesn’t even serve any functions! Namely, it doesn’t allow me to go back a back (aka a “back page” operation, if that’s what it’s called) on the browser. At home, I use the Logitech Performance MX mouse, and on Windows at least, the side buttons are preconfigured to do exactly that, and more (go forward a page), when pressed.

Being a OS X newbie, I decided to create a simple AppleScript macro to perform just this function.  It probably isn’t the best solution by far, but at least it works! Good enough.

I looked around the Internet, and patched together this script for my problem.

In AppleScript Editor:

tell application "Google Chrome" to activate
tell application "System Events"
    key code 51
end tell


Key code 51 represents the delete button in OS X. This script presses the delete button once in Chrome (or “Firefox” for Mozilla Firefox, “Safari” for Safari), which performs a “backpage” operation on the browser.

AppleScript back page previous

To bind it with the side buttons of my Mighty Mouse, I saved it as an application instead of a script file.

AppleScript back page macro as application

Then, in the control panel, I bound it to button 4 (the side buttons) of the mouse.

os x control panel applescript


And yes! A cumbersome (and probably not-so-smart) way to use the side buttons of your Apple mouse.

Kevin Lin

I am a senior at Wake Forest University currently pursuing my BS in Computer Science, and I love technology! To learn a little more about me, please visit the "Meet Kevin" widget on the top right on the screen!
Posted in Code.

Leave a Reply

Your email address will not be published. Required fields are marked *