Python
For the Windows platform
Using the Win32gui,win32api,win32con Package
simu_read.py
Copy the Code code as follows:
#-*-Coding=utf-8-*-
'''
Analog button Flip
Usage:python simu_read.py 10 1.5
10 means 10 pages, 1.5 means that the time interval of pressing PGDN in one page is 1.5s
One page PgDn 3 times, then press → to turn to the next page
Open the browser to U17 to see the comic, then start the program, and then cut back to U17
You can automatically turn the page to see the comics.
Fun-only, understanding Python analog keys
'''
Import Win32gui,win32api,win32con
From ctypes Import *
Import time
Import threading
Import Sys
"# mouse click is not used here,-> can replace it
Def get_cursor_pos ():
X, y = Win32gui. GetCursorPos ()
return (x, y)
def mouse_move (x, y):
Windll.user32.SetCursorPos (x, y)
def mouse_click (X=none,y=none):
print ' Mouse_click '
If not X are none and not Y are none:
Mouse_move (x, y)
Time.sleep (0.05)
Win32api.mouse_event (Win32con. Mouseeventf_leftdown, 0, 0, 0, 0)
Time.sleep (0.05)
Win32api.mouse_event (Win32con. Mouseeventf_leftup, 0, 0, 0, 0)
Def test_pos ():
For I in Range (0,10):
Time.sleep (0.5)
Print Get_cursor_pos ()
'''
def key_up (Key_num):
Win32api.keybd_event (key_num,0,0,0)
Win32api.keybd_event (Key_num,0,win32con. keyeventf_keyup,0)
Def init_dict ():
Dict1 = {"PageDown":, ' RightArrow ': 39}
Return Dict1
if __name__ = = ' __main__ ':
If Len (sys.argv)! = 3:
print ' Usage:python simu_read.py '
Sys.exit (-1)
Try
pagenum = Int (sys.argv[1])
Interval = float (sys.argv[2])
Except ValueError:
print ' Usage:python simu_read.py '
print ' should be the type of int '
print ' should be the type of float '
Sys.exit (-1)
If Pagenum < 0 or Pagenum > 10000:
print ' Pagenum should is in the range [1,10000] '
Sys.exit (-1)
If interval < 0.1 or interval > 60:
print ' interval should is in the range [0.1,60] '
Sys.exit (-1)
Key_dict = Init_dict ()
Stsec = 2
print ' Start in ' +str (stsec) + ' seconds ... '
Time.sleep (STSEC)
For I in Range (0,pagenum):
For j in Range (0,3): #generally, the height of one page was not more than 3 screensize
print ' PageDown '
Key_up (key_dict[' PageDown ')
Time.sleep (interval)
Key_up (key_dict[' RightArrow ')
print ' Next page '
Time.sleep (interval+0.2) #delay
The above is the whole content of this article to share, I hope you can enjoy.