Nomad Posted May 17, 2006 Share Posted May 17, 2006 I'm just wondering if this is a common problem or not and also if it can be fixed. I have a program that can be run through all of the code entirely several times with no problems. But sometimes after it's ran for several hours, it will freeze during a mouse movement (when left unattended for a long time). It will stay this way until I notice it and actually move the mouse manually. Then the program will usually finish the mouse movement as programmed and continue running with no problems. I have my screensaver disabled, if that even matters. Also, this doesn't usually happen until the program has been running for more than a few hours unattended. Is this possibly something I have programmed incorrectly? Like not refreshing the environment? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 17, 2006 Moderators Share Posted May 17, 2006 I'm just wondering if this is a common problem or not and also if it can be fixed. I have a program that can be run through all of the code entirely several times with no problems. But sometimes after it's ran for several hours, it will freeze during a mouse movement (when left unattended for a long time). It will stay this way until I notice it and actually move the mouse manually. Then the program will usually finish the mouse movement as programmed and continue running with no problems.I have my screensaver disabled, if that even matters. Also, this doesn't usually happen until the program has been running for more than a few hours unattended. Is this possibly something I have programmed incorrectly? Like not refreshing the environment?So do we look into the crystal ball and guess what your script is, or are you going to post your code so maybe one of us might be able to take a look at what your issues are? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted May 17, 2006 Share Posted May 17, 2006 Smoke i see it it has alot of Mouseclicks, if it is just because its ran for hours, make another script that checks for the error window and then kills the process and starts a new one just a suggestion Link to comment Share on other sites More sharing options...
Nomad Posted May 17, 2006 Author Share Posted May 17, 2006 Smoke i see it it has alot of Mouseclicks, if it is just because its ran for hours, make another script that checks for the error window and then kills the process and starts a new one just a suggestionI'll have to look into that. I'm not sure if it will work the way I would like it to or not. I was just wondering if this is a normal issue with AutoIt. But I don't think it is getting an error, it's like it's waiting for something because it still executes the command it is stuck on after a manual mouse movement (it sticks on the MouseMove() command). But like I said, it will run fine for hours. Then it will do this on a random portion of the script, occasionally, but it has already read the entire script many times and ran fine. The script loops back through over and over. I don't know much about stacks, but I'm wondering if this is related to that. I don't get a stack overflow error though.As far as posting my code, I don't see what that has to do with the command "MouseMove()". If there are commands which should accompany the MouseMove() that would prevent this, then I do not have them in the script... besides, the script is over 7500 lines long, I doubt it will fit in a topic on here. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted May 17, 2006 Share Posted May 17, 2006 o my bad well i guess use mousegetpos and then keep checking and if they are the same for more then 1 time then kill the prog and run it again Link to comment Share on other sites More sharing options...
Nomad Posted May 17, 2006 Author Share Posted May 17, 2006 o my bad well i guess use mousegetpos and then keep checking and if they are the same for more then 1 time then kill the prog and run it againKilling the program is exactly what I don't want to do I guess I can post an example section of the program containing one of the MouseMove() commands, but I don't know if it's going to help... but anyway, here it is:If Not WinActive($Window) Then WinActivate ($Window)If Not WinActive($Window) Then WinWaitActive($Window)GUICtrlSetData($GameStatus, 'text message here') Sleep (250)$MS = GUICtrlRead ($MSScroll) ;$MSScroll is a mouse movement speed adjustment control on the GUI$MS = int($MS / 5)$MS = (20 - $MS)HotKeySet("{ESC}") ;cancels hotkey so program can send the keystrokeSend ('{ESC}')HotKeySet("{ESC}", "ExitProg") ;reactivates the hotkey Sleep (500)MouseMove (408, 403, $MS)MouseClick("left", 408, 403) Sleep (500)MouseMove ($x2, $y2, $MS)MouseClick("left", $x2, $y2)MouseClick("left", $x2, $y2) Sleep (500)MouseMove (404, 374, $MS)MouseClick("left", 404, 374)have at it. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 17, 2006 Moderators Share Posted May 17, 2006 (edited) You're MouseMove() followed by MouseClick() is rather redundant isn't it?MouseClick -------------------------------------------------------------------------------- Perform a mouse click operation. MouseClick ( "button" [, x, y [, clicks [, speed ]]] ) Parameters button The button to click: "left", "right", "middle", "main", "menu", "primary", "secondary". x, y [optional] The x/y coordinates to move the mouse to. If no x and y coords are given, the current position is used. clicks [optional] The number of times to click the mouse. Default is 1. speed [optional] the speed to move the mouse in the range 1 (fastest) to 100 (slowest). A speed of 0 will move the mouse instantly. Default speed is 10.Look at the speed option. Here:If Not WinActive($Window) Then WinActivate ($Window) ;If Not WinActive($Window) Then WinWaitActive($Window); Don't need this line GUICtrlSetData($GameStatus, 'text message here') Sleep (250) $MS = 20 - int(GUICtrlRead ($MSScroll) / 5);$MSScroll is a mouse movement speed adjustment control on the GUI HotKeySet("{ESC}");cancels hotkey so program can send the keystroke Send ('{ESC}') HotKeySet("{ESC}", "ExitProg");reactivates the hotkey Sleep (500) MouseClick("left", 408, 403, 1, $MS) Sleep (500) MouseClick("left", $x2, $y2, 2, $MS) Sleep (500) MouseClick("left", 404, 374, 1, $MS) Edited May 17, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Nomad Posted May 17, 2006 Author Share Posted May 17, 2006 So MouseClick() will also move the mouse cursor as well as clicking it? I didn't know that. I knew it would click on the coordinates you selected, I just didn't know it would show the cursor move. As far as not needing the WinWaitActive() command, I had to add that because the mouse would already be clicking on stuff before the window would be completely active, but that was also before I added the Sleep() command I think. Thanks, I'll try this out tomorrow, bed time. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now