自动合法打印VitalSource Bookshelf中的电子书

最近有一本2千多页的在VitalSource中的电子书想转为PDF随时阅读,没料网上找了一圈没有找到合适的。相对好一些的只有一个用Python写的模拟手动打印。于是想到了用AutoHotkey写一个自动打印脚本来转成PDF电子书。

工具:

Windows 10 Professional - 自带Microsoft to PDF(打印后不用自动打开文件)

AutoHotkey Version 1.1.30.03 - https://www.autohotkey.com/

VitalSource Bookshelf Version 7.6.2 (10) - https://downloads.vitalbook.com/vsti/bookshelf/7.6.2/PC/Bookshelf/BookshelfSetup.exe

直接上脚本:

-----Start-----

Sleep, 5000
currentpage = 297
NextOne:
currentpage := currentpage+1
WinWait, [WinTitle]
WinActivate, [WinTitle]
Send ^p
Sleep, 10000
WinWait, VitalSource Bookshelf - Print Preview
WinActivate, VitalSource Bookshelf - Print Preview
Send {Enter}
Sleep, 500
WinWait, Print
WinActivate, Print
Send {Enter}
WinWait, Save Print Output As
WinActivate, Save Print Output As
Send !N
Sleep, 1000
Send %currentpage%
Sleep, 1000
Send !S
Sleep, 2000
WinWait, [WinTitle]
WinActivate, [WinTitle]
Send ^{PgDn}
Sleep, 1000
Goto NextOne

-----End-----

一个晚上,成功转好了一本2千多页的书。其中发现有6页左右有点问题,手动重转即可。

posted @ 2019-05-21 11:28  Selamet  阅读(3541)  评论(2编辑  收藏  举报