Issue when using "Sleep(0000)" in AutoItX scripts

Feature Requests, Comments, Bugs, and Suggestions on the Intelliremote application.

Issue when using "Sleep(0000)" in AutoItX scripts

Postby Keylonta » Fri Nov 06, 2015 9:33 pm

I'm having an issue when using "Sleep(0000)" in AutoItX scripts.

I created a topic on the AutoIt forum with all the details.

https://www.autoitscript.com/forum/topic/177940-sleep-causing-the-event-that-follows-it-to-output-3-commands/

They weren't able to resolve it so it might have something to do with Intelliremote.

Not sure but the first time I used the "Sleep(0000)" command I accidentally set it to 40000 which caused Intelliremote to crash, maybe that caused the issue and I need to reinstall Intelliremote?
Keylonta
 
Posts: 38
Joined: Wed Dec 11, 2013 12:45 am

Re: Issue when using "Sleep(0000)" in AutoItX scripts

Postby Keylonta » Fri Nov 06, 2015 10:36 pm

Same issue with:

Opt("SendKeyDelay", 500)
Send("{DOWN}",0)

Sends 3 x down.

Here is another example:

Opt("SendKeyDelay", 500)
Send("{DOWN 2}",0)

This sends 6 x down.

Are you having this issue at your end?
Keylonta
 
Posts: 38
Joined: Wed Dec 11, 2013 12:45 am

Re: Issue when using "Sleep(0000)" in AutoItX scripts

Postby Keylonta » Fri Nov 06, 2015 10:54 pm

I just worked out what's causing it but I don't know why.

I had my tray blink rate set to 500, then when I set it to 550 it fixed the issue.

Then I tried:

Opt("SendKeyDelay", 1000)
Send("{DOWN}",0)

which caused the issue again, then when I set the tray blink rate to 1050 it fixed the issue.

I'm using a Logitech Harmony 525 remote, would this have something to do with its delay speed settings.

I just checked the remotes settings and interestingly it's inter-key delay is set to 500 ms.

The settings are as follows:

Power On Delay: 1500
Inter-key Delay: 500
Input Delay: 1000
Inter-Device Delay: 1000

Power On Delay. When a device receives a PowerOn command, it takes a certain amount of time to "warm up" the device and resume normal operation. For most devices this happens very quickly, but for some devices, such as televisions and receivers, it can take up to 3000 milliseconds (three seconds).

Inter-key Delay. When a device receives an infrared command the device is considered"busy" while it processes the command. The amount of time required before the device will respond to another command is known as the inter-key delay, and normally ranges from zero to 300 milliseconds. Devices with long inter-key delays take longer to respond to multiple infrared commands (e.g., when changing television channels).

Input Delay. When a device switches inputs (e.g. goes from Video 1 to Video 2) the device is considered "busy" while it processes the command. The amount of time required before the device will respond to another switch input command is known as the input delay, and normally ranges from 500 to 3000 milliseconds. Devices with long input delays take longer to change inputs.

Inter-Device Delay. When an infrared command is sent for a particular device, each device in your system will receive the command, but only one will respond to it. The other devices will ignore the infrared command. Sometimes, when this happens, a device will ignore the infrared signal and then stop accepting infrared commands for a period of time. This period of time is known as the inter-device delay. During this time no infrared signals are generated by the remote. In rare cases this delay can be several seconds.
Keylonta
 
Posts: 38
Joined: Wed Dec 11, 2013 12:45 am

Re: Issue when using "Sleep(0000)" in AutoItX scripts

Postby Keylonta » Fri Nov 06, 2015 11:11 pm

I did some more testing with the following script:

Opt("SendKeyDelay", 500)
Send("{DOWN}",0)

When the blink rate is set to 450 and below it results in 3 x down.

When the blink rate is set to 500 it results in variations of 2 x down and 1 x down.

When the blink rate is set to 550 and above it results in 1 x down.

Unchecking "Block Signal on Tray Blink" did not change the results.
Keylonta
 
Posts: 38
Joined: Wed Dec 11, 2013 12:45 am

Re: Issue when using "Sleep(0000)" in AutoItX scripts

Postby Keylonta » Fri Nov 06, 2015 11:23 pm

I tested using the same method all the way up to a 2000 ms tray blink rate with "Opt("SendKeyDelay", 2000)", all with the same results.
Keylonta
 
Posts: 38
Joined: Wed Dec 11, 2013 12:45 am

Re: Issue when using "Sleep(0000)" in AutoItX scripts

Postby Keylonta » Fri Nov 06, 2015 11:38 pm

I tested with a WMC remote and the issue is the same except it sends 2 x down, not 3 x down.
Keylonta
 
Posts: 38
Joined: Wed Dec 11, 2013 12:45 am

Re: Issue when using "Sleep(0000)" in AutoItX scripts

Postby Keylonta » Sat Nov 07, 2015 12:19 am

7/11/2015 2:40:18 PM [DEBUG] Window focus: notepad.exe
7/11/2015 2:40:19 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:40:19 PM [DEBUG] Line 1: Opt("SendKeyDelay", 500)
7/11/2015 2:40:19 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:40:19 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
7/11/2015 2:40:19 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:40:19 PM [DEBUG] Line 1: Opt("SendKeyDelay", 500)
7/11/2015 2:40:19 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:40:20 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
7/11/2015 2:40:28 PM [DEBUG] Window focus: notepad.exe
7/11/2015 2:40:29 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:40:29 PM [DEBUG] Line 1: Opt("SendKeyDelay", 500)
7/11/2015 2:40:29 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:40:29 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
7/11/2015 2:40:31 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:40:31 PM [DEBUG] Line 1: Opt("SendKeyDelay", 500)
7/11/2015 2:40:31 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:40:31 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
7/11/2015 2:40:32 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:40:32 PM [DEBUG] Line 1: Opt("SendKeyDelay", 500)
7/11/2015 2:40:32 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:40:33 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
7/11/2015 2:40:34 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:40:34 PM [DEBUG] Line 1: Opt("SendKeyDelay", 500)
7/11/2015 2:40:34 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:40:35 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
7/11/2015 2:41:02 PM [DEBUG] Applying Remote Button Change
7/11/2015 2:41:04 PM [DEBUG] Window focus: notepad.exe
7/11/2015 2:41:05 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:41:05 PM [DEBUG] Line 1: Opt("SendKeyDelay", 600)
7/11/2015 2:41:05 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:41:06 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
7/11/2015 2:41:06 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:41:06 PM [DEBUG] Line 1: Opt("SendKeyDelay", 600)
7/11/2015 2:41:06 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:41:06 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
7/11/2015 2:41:06 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:41:06 PM [DEBUG] Line 1: Opt("SendKeyDelay", 600)
7/11/2015 2:41:06 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:41:07 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
7/11/2015 2:41:19 PM [DEBUG] Applying Remote Button Change
7/11/2015 2:41:21 PM [DEBUG] Window focus: notepad.exe
7/11/2015 2:41:23 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:41:23 PM [DEBUG] Line 1: Opt("SendKeyDelay", 1000)
7/11/2015 2:41:23 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:41:24 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
7/11/2015 2:41:24 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:41:24 PM [DEBUG] Line 1: Opt("SendKeyDelay", 1000)
7/11/2015 2:41:24 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:41:25 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
7/11/2015 2:41:25 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:41:25 PM [DEBUG] Line 1: Opt("SendKeyDelay", 1000)
7/11/2015 2:41:25 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:41:26 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
7/11/2015 2:41:28 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:41:28 PM [DEBUG] Line 1: Opt("SendKeyDelay", 1000)
7/11/2015 2:41:28 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:41:29 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
7/11/2015 2:41:29 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:41:29 PM [DEBUG] Line 1: Opt("SendKeyDelay", 1000)
7/11/2015 2:41:29 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:41:30 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
7/11/2015 2:41:30 PM [DEBUG] UDP: [10.20.10.11] 31743
7/11/2015 2:41:30 PM [DEBUG] Line 1: Opt("SendKeyDelay", 1000)
7/11/2015 2:41:30 PM [DEBUG] Line 2: Send("{DOWN}",0)
7/11/2015 2:41:31 PM [DEBUG] UDP: [10.20.10.11] (SB) 0
Keylonta
 
Posts: 38
Joined: Wed Dec 11, 2013 12:45 am

Re: Issue when using "Sleep(0000)" in AutoItX scripts

Postby Melloware » Sun Nov 08, 2015 8:29 am

Ahhh the issues are because Block signal On Tray Blink does the same thing Sleep or SendKeyDelay does.

They issue a "Thread.sleep()" which essentially blocks the application from all activity for XX milliseconds. So all of your results make sense you have both Intelliremote and AutoIt both sleeping their threads. so by making the tray blink 50 ms more the one thread wakes up and finishes and then Intelliremote wakes up 50 ms later. If the opposite is true the behavior your seeing makes sense.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11037
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: Issue when using "Sleep(0000)" in AutoItX scripts

Postby Keylonta » Wed Nov 11, 2015 1:58 am

If that is the case then what's causing the 3 x Send("{DOWN}",0).

If the Tray Blink sends a sleep thread, that doesn't explain why extra Send("{DOWN}",0) commands are being sent. Or maybe I'm not fully comprehending your explanation.

Any ideas how I can work around this issue without increasing the Tray Blink Rate? For some scripts I need more than 450 ms sleep.

I tried the following workaround but it didn't work.

Sleep(450)
Sleep(450)
Send("{DOWN}",0)
Keylonta
 
Posts: 38
Joined: Wed Dec 11, 2013 12:45 am

Re: Issue when using "Sleep(0000)" in AutoItX scripts

Postby Melloware » Wed Nov 11, 2015 7:23 am

I can't explain why the extra KeyDowns are being sent. So from above I am confused are you seeing 3 keydown's issued in the log one after the other?
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11037
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: Issue when using "Sleep(0000)" in AutoItX scripts

Postby Keylonta » Thu Nov 12, 2015 9:28 pm

That log is from me testing different key delay duration's, with corresponding tray blink rates.

I did some more testing with the following script:

Opt("SendKeyDelay", 500)
Send("{DOWN}",0)

When the blink rate is set to 450 and below it results in 3 x down.

When the blink rate is set to 500 it results in variations of 2 x down and 1 x down.

When the blink rate is set to 550 and above it results in 1 x down.

Unchecking "Block Signal on Tray Blink" did not change the results.


I tested using the same method all the way up to a 2000 ms tray blink rate with "Opt("SendKeyDelay", 2000)", all with the same results.


To answer you question, 3 keydown's are not being issued in the log.

Next thing I'll try is testing on my other computer. If the issue is on there too, then there's no way to sleep the script for longer than the tray blink rate without it affecting the succeeding send command. I'll let you know.
Keylonta
 
Posts: 38
Joined: Wed Dec 11, 2013 12:45 am

Re: Issue when using "Sleep(0000)" in AutoItX scripts

Postby Keylonta » Thu Nov 12, 2015 11:35 pm

Same issue on my other Windows 7 64bit PC
Keylonta
 
Posts: 38
Joined: Wed Dec 11, 2013 12:45 am

Re: Issue when using "Sleep(0000)" in AutoItX scripts

Postby Melloware » Sat Nov 14, 2015 8:40 am

Well I can't explan why 3 keydowns are being sent if you only see 1 in the log file.

But because of both Intelliremote and AutoItX trying to sleep their threads I am not surprised by the odd behavior.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11037
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: Issue when using "Sleep(0000)" in AutoItX scripts

Postby Keylonta » Sun Nov 15, 2015 3:28 am

Do you have the same issue at your end with HID?
Keylonta
 
Posts: 38
Joined: Wed Dec 11, 2013 12:45 am

Re: Issue when using "Sleep(0000)" in AutoItX scripts

Postby Melloware » Mon Nov 16, 2015 7:42 am

Keylonta wrote:Do you have the same issue at your end with HID?


I can't reproduce your issue exactly with HID but I can say the same problem occurs if you have a Sleep longer than the Tray Icon Blink. I don't see the 3 events fired like you see though.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11037
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Next

Return to Intelliremote

Who is online

Users browsing this forum: No registered users and 3 guests

cron