热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

有没有办法在pyautogui中或者通过python中的硬编码来按下numpad7键?

我正在尝试编写一个程序来自动填写UNIX模拟器(WRQReflection)中的表单,这需要我按numloc

我正在尝试编写一个程序来自动填写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')





推荐阅读
author-avatar
明天会更好--好过_652
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有