Skip to content

Instantly share code, notes, and snippets.

@Snuupy
Created May 7, 2017 04:49
Show Gist options
  • Save Snuupy/3e6621ee99cf48ca764efc34e91902be to your computer and use it in GitHub Desktop.
Save Snuupy/3e6621ee99cf48ca764efc34e91902be to your computer and use it in GitHub Desktop.
Automatically outputs VitalSource books (probably your textbooks) to non-DRM'd PDF.
set totalPages to 1000 -- put total number of pages here
set startPage to 0
set authorName to "YOUR AUTHOR HERE -- put author name here
tell application "VitalSource Bookshelf"
activate
repeat with theIncrementValue from startPage to totalPages - 1 by 5
if (theIncrementValue = 0) then
set thisValue to "1" -- if we're just starting, start at 1
else
set thisValue to theIncrementValue + 1 -- ex. we've already printed page 5, print from page 6
end if
tell application "System Events" to keystroke "p" using command down -- cmd+p brings up print dialog box
tell application "System Events" to keystroke thisValue as string -- put in starting page # to print
tell application "System Events" to keystroke tab -- to:
tell application "System Events" to keystroke theIncrementValue + 5 as string -- 5
tell application "System Events" to keystroke tab
tell application "System Events" to keystroke return
tell application "System Events" to keystroke return
tell application "System Events" to keystroke return
delay 2
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment