|
|
@ -52,8 +52,50 @@ driver.close()
|
|
|
|
###############################
|
|
|
|
###############################
|
|
|
|
#Technology Image & Mouse
|
|
|
|
#Technology Image & Mouse
|
|
|
|
###############################
|
|
|
|
###############################
|
|
|
|
...
|
|
|
|
#https://pypi.org/project/PyAutoGUI/
|
|
|
|
|
|
|
|
import pyautogui
|
|
|
|
|
|
|
|
lScreenPath = "Path\\to\\image.png"
|
|
|
|
|
|
|
|
#Search image on screen
|
|
|
|
|
|
|
|
buttonx, buttony = pyautogui.locateCenterOnScreen(lScreenPath) # returns (x, y) of matching region
|
|
|
|
|
|
|
|
#Moucse click on X:buttonx Y:buttony
|
|
|
|
|
|
|
|
pyautogui.click(buttonx, buttony)
|
|
|
|
|
|
|
|
|
|
|
|
###############################
|
|
|
|
###############################
|
|
|
|
#Technology Keyboard & Clipboard
|
|
|
|
#Technology Keyboard & Clipboard
|
|
|
|
###############################
|
|
|
|
###############################
|
|
|
|
...
|
|
|
|
#https://pypi.org/project/keyboard/
|
|
|
|
|
|
|
|
import keyboard
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Write a text (selected language dont affect)
|
|
|
|
|
|
|
|
keyboard.write('The quick brown fox jumps over the lazy dog.')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Blocks until you press esc.
|
|
|
|
|
|
|
|
keyboard.wait('esc')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Record events until 'esc' is pressed.
|
|
|
|
|
|
|
|
recorded = keyboard.record(until='esc')
|
|
|
|
|
|
|
|
# Then replay back at three times the speed.
|
|
|
|
|
|
|
|
keyboard.play(recorded, speed_factor=3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Add hotkey
|
|
|
|
|
|
|
|
keyboard.add_hotkey('ctrl+shift+a', print, args=('triggered', 'hotkey'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###############################
|
|
|
|
|
|
|
|
#Technology Message boxes
|
|
|
|
|
|
|
|
###############################
|
|
|
|
|
|
|
|
#https://pypi.org/project/PyAutoGUI/
|
|
|
|
|
|
|
|
import pyautogui
|
|
|
|
|
|
|
|
#Show alert message box
|
|
|
|
|
|
|
|
pyautogui.alert('This is an alert box.')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Ask a question (Yes/No)
|
|
|
|
|
|
|
|
pyautogui.confirm('Shall I proceed?')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Ask a question with answer options
|
|
|
|
|
|
|
|
pyautogui.confirm('Enter option.', buttons=['A', 'B', 'C'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Ask a question with text answer
|
|
|
|
|
|
|
|
pyautogui.prompt('What is your name?')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Ask a password (password will be hidden)
|
|
|
|
|
|
|
|
pyautogui.password('Enter password (text will be hidden)')
|