我试着用一些颜色检查代码和其他东西为PianoTile2制作一个宏。我得到的是:
def PixCol(i_x, i_y):
import win32gui
i_desktop_window_id = win32gui.GetDesktopWindow()
i_desktop_window_dc = win32gui.GetWindowDC(i_desktop_window_id)
long_colour = win32gui.GetPixel(i_desktop_window_dc, i_x, i_y)
i_colour = int(long_colour)
return (i_colour)
def Start():
from win32 import win32api
from win32 import win32com
shell = win32com.client.Dispatch("WScript.Shell")
TileA = False
TileB = False
TileC = False
TileD = False
while True:
# Color Checking
if PixCol(1131, 473) == 0:
TileA = True
else:
TileA = False
if PixCol(1221, 473) == 0:
TileB = True
else:
TileB = False
if PixCol(1325, 473) == 0:
TileC = True
else:
TileC = False
if PixCol(1431, 473) == 0:
TileD = True
else:
TileD = False
# Auto Clicking
if TileA == True:
shell.sendKeys("a")
if TileB == True:
shell.sendKeys("s")
if TileC == True:
shell.sendKeys("d")
if TileC == True:
shell.sendKeys("f")
# End Of Code
if PixCol(1100, 60) == 15889441:
break
我试着从下面的命令开始。在
^{pr2}$但它没有运行错误。在
Traceback (most recent call last):
File "<pyshell#33>", line 1, in <module>
PT2Macro.Start()
File "C:\Python34\lib\PT2Macro.py", line 22, in Start
from win32 import win32com
NameError: name 'windll' is not defined
每次我尝试运行它时,它都会出现相同的错误,即使我没有使用windell模块。在
如果可以,请帮忙!在
(我的规格)
Windows 7 64-bit
Python 3.4.3 x64
目前没有回答
相关问题 更多 >
编程相关推荐