Automator Help: take Fixed-Position Screenshot, click "Next Page" and Repeat (that's it!)
Kindle is not AppleScript scriptable in that it does not contain an AppleScript dictionary within its application bundle; however it is, within limits, using System Events and UI Scripting. Note though that with UI Scripting one must not use the system for other things while the script is running as Kindle needs to remain frontmost while the script is running.
The following example AppleScript code, tested under macOS High Sierra took screen shots of the first 5 pages of the BASH Reference Manual:
set saveToLocation to POSIX path of (path to pictures folder)
set bookName to "BASH Reference Manual"
set pageCount to 5
set pathFileName to saveToLocation & bookName
tell application "Kindle" to activate
delay 0.5
tell application "System Events" to ¬
tell window 1 of application process "Kindle" to ¬
set {position, size} to {{693, 66}, {1006, 1089}}
repeat with i from 1 to pageCount
set shellCMD to ¬
"screencapture -R837,124,770,994 -t jpg '" & ¬
pathFileName & " - Page " & ¬
i & " of " & pageCount & ".jpg'"
do shell script shellCMD
delay 1.5
-- # Press right-arrow key.
tell application "System Events" to key code 124
delay 1.5
end repeat
Note: The example AppleScript code is just that and does not contain any error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors. Additionally, the use of the delay command may be necessary between events where appropriate, e.g. delay 0.5
, with the value of the delay set appropriately.