Jump to content

Script Bogging down over time (2-3 Hours)


 Share

Recommended Posts

I have a script that runs for hours on end (12 hours or so) after about 2-3 hours I noticed it taking substantialy long time to execute each line of code 2-3 mins each.

I exit the script and start it again... walla, the code runs fast again.

SO how can I stop the code from slowing down?

My ideas:

Make a second script that is created by the first that will count down an hour. Exit the script running then restart it again. then when the new script is running it will exit the secondary program. Then create and launch it again after an hour

I love AutoIT! It doesn't talk back, it doesn't complain that ur on the computer, it loves to be ran over and over and over... but IT STILL DOESN'T DO THE DISHES... Gatta keep da pimp hand strong...

Link to comment
Share on other sites

I have a script that runs for hours on end (12 hours or so) after about 2-3 hours I noticed it taking substantialy long time to execute each line of code 2-3 mins each.

I exit the script and start it again... walla, the code runs fast again.

SO how can I stop the code from slowing down?

My ideas:

Make a second script that is created by the first that will count down an hour. Exit the script running then restart it again. then when the new script is running it will exit the secondary program. Then create and launch it again after an hour

Just make the "hour" counter in your script and add this to re-start your script

Func _restart()
    If @Compiled = 1 Then
        Run( FileGetShortName(@ScriptFullPath))
    Else
        Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
    EndIf
    Exit
EndFunc

8)

NEWHeader1.png

Link to comment
Share on other sites

Your script should not slow down over time. Are you constantly appending data to variables or arrays or something? Are you opening handles and not closing them correctly? That would be something to look into.

- The Kandie Man ;-)

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

Your script should not slow down over time. Are you constantly appending data to variables or arrays or something? Are you opening handles and not closing them correctly? That would be something to look into.

- The Kandie Man ;-)

Actually, that is the correct answer, not mine

it should not slow down

mine will just do what you were thinking

8)

NEWHeader1.png

Link to comment
Share on other sites

Your script should not slow down over time. Are you constantly appending data to variables or arrays or something? Are you opening handles and not closing them correctly? That would be something to look into.

- The Kandie Man ;-)

That is a real good point.

I think it is beacuse I do"PixelSearch" bout once every 1/2 hour across half the screen and "PixelGetColor" Continualy throughout the script. Something to the effect of:

$Colortest = PixelGetColor ( $X, $Y, $color)

could this be what is slowing the program down after time? It does work fast and perfect at first. How can I fix this? I dont clear the variable out each time, and to be honest not sure what a handle is... I'm still a noob I guess.

Any help appreciated, and thanks for the quick reply also.

I love AutoIT! It doesn't talk back, it doesn't complain that ur on the computer, it loves to be ran over and over and over... but IT STILL DOESN'T DO THE DISHES... Gatta keep da pimp hand strong...

Link to comment
Share on other sites

lets see the script :)

Sorry man don't wanna post the script for reasons... The script runs flawless, just boggs down after time. I might find a way to post most of it after a little while.

Edited by dakishman

I love AutoIT! It doesn't talk back, it doesn't complain that ur on the computer, it loves to be ran over and over and over... but IT STILL DOESN'T DO THE DISHES... Gatta keep da pimp hand strong...

Link to comment
Share on other sites

UPDATE:

It seems to get dramatically worse after the first run...

I have a quad core processor, so I dont think it is the hardware, as it is really up to date.

After letting it run last night, I checked the Task Manager for its memory usage, and it was almost nominal. This is what is really confusing me.

However, I did observe that it was slowing dramatically at the "Sleep ()" command points. Where a "Sleep (500)" was taking almost one min. I did not notice slowing other than there. I will examine more closely when I get home...

Any suggestions or ideas?

I love AutoIT! It doesn't talk back, it doesn't complain that ur on the computer, it loves to be ran over and over and over... but IT STILL DOESN'T DO THE DISHES... Gatta keep da pimp hand strong...

Link to comment
Share on other sites

Just make the "hour" counter in your script and add this to re-start your script

Func _restart()
    If @Compiled = 1 Then
        Run( FileGetShortName(@ScriptFullPath))
    Else
        Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
    EndIf
    Exit
EndFunc

8)

@Valuater

Correct me if I'm wrong but I think this will just open another occurence of the script. Then he will have 2 of them running.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

its right there

EndIf

Exit

EndFunc

8)

Okay, like I said "correct me if I'm wrong" :) . I think the last time I had to do something similar it was with a compiled script so what I did was get the PID of the current occurance and then passed that as a param when I restarted the script by using something like this right at the top of my code.

If $CmdLine[0] > 0 Then
   If ProcessExists($CmdLine[1]) Then ProcessWaitClose($CmdLine[1])
EndIf

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Yea!

Did you look at the revised script I sent you, did you test that one?

8)

Just a quick reply. At work ATM. Your script looked GREAT man. Havent actualy run it yet beacuse since i sent you that code, I made a dramatic change to my code. Will look at yours and implement it into what i have or use yours.

I have basicly added a loop that pulls values from a $array. ill send new code when i get home...

hoping to figure this out

Edited by dakishman

I love AutoIT! It doesn't talk back, it doesn't complain that ur on the computer, it loves to be ran over and over and over... but IT STILL DOESN'T DO THE DISHES... Gatta keep da pimp hand strong...

Link to comment
Share on other sites

Ok, I have an idea as to what it is, not sure though, going to test in a little. I think it was that I used "ClipPut()" in the script and used "Send ("^{v}")" it is right around this point that it slows down dramaticly.

Trying to use "Send()" to send the text needed instead. Just a heads up. Will update later what happens.

@valuater

Tried your script man and it rocks. Seems to run faster than before. Never knew u could use a function as "_FunctionName ("Value1", "Value2")" before read the help file and I think I have it, but any help u can offer for it would be nice. Thanks again man!

I love AutoIT! It doesn't talk back, it doesn't complain that ur on the computer, it loves to be ran over and over and over... but IT STILL DOESN'T DO THE DISHES... Gatta keep da pimp hand strong...

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...