Keylonta

Sleep causing the event that follows it to output 3 commands

11 posts in this topic

#1 ·  Posted (edited)

When sleep is set to 500 and above it's causing the event that follows it to output 3 commands.

In the following example the down keystroke is sent 3 times!

Sleep(500)
Send("{DOWN}",0)

 

In the following example the down keystroke is sent once.

Sleep(400)
Send("{DOWN}",0)

Why is it doing this? How do I stop sleep interfering with the event that follows it?

Edited by Keylonta

Share this post


Link to post
Share on other sites



@Keylonta I have moved your question to the General Help and Support area. Please be mindful of which forum you're posting to in the future.

I would also agree with JohnOne, there must be more to your code. As you have it written, I cannot duplicate what you're seeing.


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

Sorry, I'm a total newbie to AutoIt.

I should of mentioned that I'm using the program "Intelliremote" to write an AutoItX script.

That's all there is to the script so far. I have to work out what's causing the issue before I can continue.

I'll start a new topic on the Intelliremote forum if no one here knows what's causing it.

Share this post


Link to post
Share on other sites

When you say that is all there is in the script, that seems very unlikely, as there is no way the Send commands you listed above are different. They are identical, and the Sleep command before each has no bearing on them.

That means something else is causing your issue ... perhaps a mistiming with something.

We need to see the full text of the script, to determine if the script is involved at all.

It may be, that something is either causing the DOWN key to repeat or repeating your script or part of it.


TheSaints' Robust Chat

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox

userbar.png

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Sleep(500)
Send("{DOWN}",0)

I've just tested it again and it's still producing 3 x down. And when I remove the sleep command it produces 1 x down.

See the script below. It's set so that the 0 button on the remote control sends the script. I've tried other buttons but all have same sleep command issue when sleep command is used in the script as mentioned above.

Capture.JPG

Edited by Keylonta

Share this post


Link to post
Share on other sites

There's not a whole lot that can go wrong in there you'd think.  Does it still do it if you remove the ,0  from the Send command?

Share this post


Link to post
Share on other sites

Cool program, it seems from what I found on google its not the first time people have had issues with it interfacing with Autoit 100%.

I'd imagine if you go run your script on your computer directly it will work right, and that would narrow down your fault domain to the program and not autoit.

At that point you can work with the people who use that program to help fix the issue, or change your script to work around the issue.

 

Could you do some testing and verify if the script works on your PC as designed?

Share this post


Link to post
Share on other sites

I tested using the latest AutoIt. I couldn't find a download for AutoItX, is that an earlier version or something?

I tested with the following script and there were no issues.

Run("notepad.exe", "")
Sleep(1000)
Send("Hello {ENTER}", 0)
Send("Hello {ENTER}", 0)
Send("Hello {ENTER}", 0)
Sleep(500)
Send("{UP 3}",0)
Sleep(500)
Send("{DOWN}",0)

I'll try the Intelliremote forum for support for this issue.

Cheers to everyone who replied.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Easy solution...don't use Send...it's unreliable.  You need to adjust the send length, and the delay between sends for each and EVERY app you work with (yes, some are less sensitive than others)...look up AutoItSetOption

That looks like a listview, so use the _guictrllistview* functions to accurately select your item (by text, and not by some counted send)...that will work regardless of the app.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • InternetMonkeyBoy
      By InternetMonkeyBoy
      I'm going to build a new function that I have been unable to find.   PLEASE CORRECT ME.  It will tweak the internal AutoIt functions giving me the ability to trash stuff I do not want to spin around.  Get it?  Please throw me whatever you got and I will put it togeather.  Ship it now.
      My supersleep() will be in here somewhere.   It's on another thread.
    • quadrplax
      By quadrplax
      I have a light bulb which I can turn on and off using UDP commands (I already have that working in AutoIt). What I would like to do is run a script before the computer goes to sleep to turn it off, and after it resumes to turn it on. I've already got the latter working, but not the former. I tried Task Scheduler with the kernel power log, but the command doesn't get executed until the computer resumes from sleep. I've tried some things using WM_POWERBROADCAST, but so far I haven't got that to work either. Here's what I've got so far:
      Global Const $WM_POWERBROADCAST = 0x218 Global Const $PBT_APMSUSPEND = 0x4 Global Const $PBT_APMRESUMEAUTOMATIC = 0x12 While 1 Sleep(100) WEnd GUICreate("Event Receiver") GUIRegisterMsg($WM_POWERBROADCAST,"MY_WM_POWERBROADCAST") Func MY_WM_POWERBROADCAST($hWnd, $uMsg, $wParam, $lParam) Switch $wParam Case $PBT_APMSUSPEND MsgBox(0,"PBT_APMSUSPEND","PBT_APMSUSPEND"&@HOUR&@MIN&@SEC) Case $PBT_APMRESUMEAUTOMATIC MsgBox(0,"PBT_APMSUSPEND","PBT_APMRESUMEAUTOMATIC"&@HOUR&@MIN&@SEC) EndSwitch EndFunc Does anyone know how to make this work?
    • knucklesCZ
      By knucklesCZ
      Hello. I'd like to ask a question about AutoIt basics, as I was deeply thinking about creating a script, I got stuck at some questions such as:

      The Sleep function stops the script completely (it stops everything, if the script repeats an action every 5 seconds and there is a Sleep(1000), will it repeat once per 6 seconds in real time)?
      Can there be multiple loops working simultaneously depending on IFs or Switches? (loops controlling keyboard, deducing things from imagesearch etc.)
      If there can be multiple loops working in one moment (multiple actions), does Sleep stop the whole script or just one of the loops?

      Thanks for responses.
    • SugarBall
      By SugarBall
      Hello guys, 
      suddenly i'm having a problem with Sleep() func. When i give it less time like Sleep(2000), works, but when i tell it to sleep longer like Sleep(1000*60*3), it won't work... in fact is a surprise because it used to work perfectly.. anyone knows how to help?
      SugarBall
    • timmy2
      By timmy2
      I'm writing a small prog that will run in the background and sound an alarm if a certain Gmail message arrives in an otherwise unused account.
      My inclination is to use a simple While/WEnd loop with a 5 minute Sleep between checking for messages, but I've seen examples here of somewhat similar background tasks that employ AdlibRegister so I'm curious which method is the most reliable and least impactful on the CPU.  Below are two simple scripts that begin to do what I want and represent how I think this could be handled.
      While/WEnd with Sleep
      #include <CheckMail.au3> Global $aReturn Global $iEmails While 1 $aReturn = CheckMail("username", "password") $iEmails = @extended If $iEmails > 0 ExitLoop Sleep(300000) ; check for new messages every 5 minutes WEnd ;work with contents of $aReturn array that contains the new message(s) found  
      While/WEnd with Sleep and AdlibRegister
      #include <CheckMail.au3> Global $aReturn Global $iEmails = 0 AdlibRegister('_CallCheckMail',300000) ; check for new messages every 5 minutes While 1 Sleep(500000) ; I had to put something here. Does higher the value = less CPU demand? If $iEmails > 0 ExitLoop WEnd ;work with contents of $aReturn array that contains the new message(s) found Func _CallCheckMail $aReturn = CheckMail("username", "password") $iEmails = @extended Return EndFunc