0

While i try to find out if window is closed in (Linux) wine my python loop has a strange and (for me) logical behavior.

the source with this loop beginning (Source 1):

for x in range(0, 290): # default is 25
    keyboard.send_keys("\n#40 x='%s'" % str(x))
    keyboard.send_keys("")
    if x > 1:
        keyboard.send_keys("\n#42 x='%s'" % str(x))
        break

For me it gives the following logical output (output 1):

#40 x='1'
#40 x='2'
#42 x='2'

But the source with this loop beginning (Source 2):

for x in range(0, 290): # default is 25
    # keyboard.send_keys("\n#40 x='%s'" % str(x))
    keyboard.send_keys("")
    if x > 1:
        keyboard.send_keys("\n#42 x='%s'" % str(x))
        break

gives me no output at all

expected output for (Source 2):

#40 x='2'
#42 x='2'

i testing with this file https://gist.github.com/sl5net/b10770763d49b30fe2105b365ab3421e inside AutoKey i Linux Mint. Its starting an AutoHotKey Script (https://lintalist.github.io/).

if you want seeing me (i spreche deutsch im live stream), i struggling with this problem, look here to this live stream: https://youtu.be/V6kQAgiyj1Y?t=571

SL5net
  • 2,282
  • 4
  • 28
  • 44
  • 1
    Source 1 and 2 are identical. Am I missing something? – Mike67 Aug 08 '20 at 19:15
  • it runs https://github.com/sl5net/Lintalist4Linux-version-0.00000001-Alpha/blob/master/test.sh and this test.sh starts https://github.com/sl5net/Lintalist4Linux-version-0.00000001-Alpha/blob/master/sendF1v2.ahk that runs lintalist.ahk – SL5net Aug 08 '20 at 19:37
  • I couldn't find an explanation for this phenomenon. BTW I am only interested in the phenomenon academically. It was only part of a larger problem that I have now solved - here: https://gist.github.com/sl5net/f68d302f0f5a40d05e6a2e182b453a51 – SL5net Aug 09 '20 at 06:18
  • Don't know, but when anything weird like this happens, the first thing to try is to `import time` and add `time.sleep(0.1)` calls everywhere and see if it helps. If it does, you can pull them out gradually or change the delay times. AutoKey types way faster than you do and many applications can't keep up. The next thing to try is running a trace to see what AutoKey thinks is going on. See https://github.com/autokey/autokey-python2/wiki/Problem-Reporting-Guide – Joe Oct 11 '20 at 13:35

0 Answers0