I'm trying this part of my script and it work perfectly
if win32gui.GetCursorInfo()[1] == 65567:
but when I'm trying to add this
win32gui.GetCursorInfo()[2] == categoriesScreenPos[1]:
it stop working... why?
The categoriesScreenPos[1]
is the same value (17,242)
of the position of the cursor, but the if doesn't work...
Full if
:
if win32gui.GetCursorInfo()[1] == 65567 and win32gui.GetCursorInfo()[2] == categoriesScreenPos[1]:
What I'm trying is to, when the cursor is in a specified position and has a specified icon, the if break a while.
ps: if I print the both commands like this
print categoriesScreenPos[1]
print win32gui.GetCursorInfo()[2]
they give me the same result!
edit: doesn't work because I have a break inside the if, and the while still continues... but only with the first if statement, worked perfectly.
I'm sorry... Full part of the script:
while timer < timerMax:
timer = timer + 1
time.sleep(2)
m_move(*categoriesScreenPos[1])
time.sleep(2)
m_move(*loginScreenPos[0])
if win32gui.GetCursorInfo()[1] == 65567 and win32gui.GetCursorInfo()[2] == categoriesScreenPos[1]:
print '[' + time.strftime('%Y/%m/%d %H:%M:%S')+'] ' + 'Login Sucess'
break
if win32gui.GetCursorInfo()[1] == 65541:
time.sleep(0.2)
kbShell.SendKeys('{F2}')
print '[' + time.strftime('%Y/%m/%d %H:%M:%S')+'] ' + 'Login Failed'
break