作者:明天会更好--好过_652 | 来源:互联网 | 2023-05-25 10:22
我正在尝试编写一个程序来自动填写UNIX模拟器(WRQ Reflection)中的表单,这需要我按numlock键,然后按num7才能输入。但是,当我运行下面的代码时,我的程序只是在字段中键入数字7,而不是像实际按下两个按钮一样进行操作:
pyautogui.press('1')
time.sleep(0.1)
pyautogui.press('enter')
time.sleep(0.1)
pyautogui.press('5')
time.sleep(0.1)
pyautogui.press('enter')
time.sleep(0.1)
pyautogui.press('1')
time.sleep(0.1)
pyautogui.press('enter')
time.sleep(0.1)
pyautogui.typewrite(['tab','tab'],0.1)
Product_Class = list('MERGE[enter image description here][1]')
Product_Code = list('1A309')
Vessel_Number = list('14X')
# Fills the product class field (usually MERGE)
i = 0
PCend = len(Product_Class) - 1
while i<=PCend:
pyautogui.typewrite([Product_Class[i]])
i+=1
time.sleep(0.4)
pyautogui.press('tab')
# Fills the product code field (This is the user entered merge number)
i = 0
Mend = len(Product_Code) - 1
while i<=Mend:
pyautogui.typewrite([Product_Code[i]])
i+=1
time.sleep(0.4)
pyautogui.press('tab')
# Fills the vessel number field (This is the user entered spinning machine)
i = 0
VNend = len(Vessel_Number) - 1
while i<=VNend:
pyautogui.typewrite([Vessel_Number[i]])
i+=1
time.sleep(0.4)
pyautogui.press('tab')
# Prints the SOC to screen
pyautogui.keyDown('numlock')
pyautogui.press('num7')