Skip to content

Instantly share code, notes, and snippets.

@smellman
Created September 1, 2016 10:46
Show Gist options
  • Select an option

  • Save smellman/629591f4764e10424ccdeb2fc7caea70 to your computer and use it in GitHub Desktop.

Select an option

Save smellman/629591f4764e10424ccdeb2fc7caea70 to your computer and use it in GitHub Desktop.
Preview page up/down by Keyboard Option+Up/Down
tell application "System Events"
set frontmostProcess to name of first process where it is frontmost
end tell
tell application "Preview" to activate
tell application "System Events"
key code 125
end tell
tell application frontmostProcess to activate
tell application "System Events"
set frontmostProcess to name of first process where it is frontmost
end tell
tell application "Preview" to activate
tell application "System Events"
key code 126
end tell
tell application frontmostProcess to activate
<?xml version="1.0"?>
<root>
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_APPLESCRIPT.preview-key-up</name>
<url type="shell">
<![CDATA[ osascript ~/Dropbox/AppleScripts/preview-key-up.scpt ]]>
</url>
</vkopenurldef>
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_APPLESCRIPT.preview-key-down</name>
<url type="shell">
<![CDATA[ osascript ~/Dropbox/AppleScripts/preview-key-down.scpt ]]>
</url>
</vkopenurldef>
<item>
<name>Preview page up/down</name>
<appendix></appendix>
<device_only>
</device_only>
<identifier>private.script.preview.pageupdown</identifier>
<autogen>
__KeyToKey__
KeyCode::CURSOR_UP, ModifierFlag::OPTION_L,
KeyCode::VK_OPEN_URL_APPLESCRIPT.preview-key-up
</autogen>
<autogen>
__KeyToKey__
KeyCode::CURSOR_DOWN, ModifierFlag::OPTION_L,
KeyCode::VK_OPEN_URL_APPLESCRIPT.preview-key-down
</autogen>
</item>
</root>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment