imNew Posted January 14, 2007 Posted January 14, 2007 AdlibEnable("_error_check") ;============================= ;main script _start_application() while 1 mousemove(1, 1) mousemove(1, 2) mousemove(1, 3) mousemove(1, 4) mousemove(1, 5) mousemove(1, 6) mousemove(1, 7) mousemove(1, 8) mousemove(1, 9) mousemove(1,10) WEnd ;============================= func _error_check() if excel.exe crashed then _start_application();restart the application goto mousemove(1, 1);<<=============Can this be done in AutoIT?===================== ;if the main loop is @ mousemove(1, 4) at the moment, I need the loop to stop there, skip mousemove(1, 5) to mousemove(1, 10), ; and then go back to the beginning of the loop endif EndFunc func _start_application() run excel.exe EndFunc two things I have learnt so far that I can do: 1. use a flag in front of every line, add if-else in front of every "mousemove()", so if I have 1000lines of "mousemove()" then 1000 if-else 2. compile the while loop into a separate exe file, and call that exe from the main script I need more ideas, please help.
Helge Posted January 14, 2007 Posted January 14, 2007 Excuse me, but isn't this your third topic on this subject ?
imNew Posted January 14, 2007 Author Posted January 14, 2007 (edited) right, true knowledge requires an endless pursuit, and I haven't found a solution yet. basically I m writting a automated bot to interface with a web-based database application, so it can write data to it. everything I can handle so far, but if the internet disconnects me and the application crashes, my bot can't do anything about it. thus I figured to use "Adlibenable" to catch the application crash and restart the application; but after the application is restarted, I couldn't find a way to tell the bot to stop where it were interrupted, and restart to interface with the application from the beginning again. by the way, i m not a programmer, everything I know is from matlab. Matlab sure doesn't have that feature I m looking for, but I sure hope AutoIt has some working-arounds. Edited January 14, 2007 by moxinghbian
59FIFTY Posted January 14, 2007 Posted January 14, 2007 goto doesn't exist in autoit and goto is totally bullshit, never use such functions to jump to a certain place. If you want to skip your look you have to check after each mousemove, and if you have that many mousecords, just store them into an array an run through them like this #include <Array.au3> Global $aMouseXY = _ArrayCreate( _ _ArrayCreate(1, 2), _ _ArrayCreate(3, 4), _ _ArrayCreate(1, 7), _ _ArrayCreate(5, 1), _ _ArrayCreate(8, 9) _ ) Func RunMouseMoves() For $i=0 To Ubound($aMouseXY)-1 If Not ErrorCheck Then MouseMove($aMouseXY[$i][0], $aMouseXY[$i][0]) Else $i = Ubound($aMouseXY)-1 RunMouseMoves() EndIf Next EndFunc Func ErrorCheck() If $statement Then Return(TRUE) Return(FALSE) EndIf
Helge Posted January 14, 2007 Posted January 14, 2007 (edited) And it's completely impossible to post in your first topic ?You create a topic, and after some replies which didn't satisfy you create another topic, 8 hours after the first one.This topic quickly gets closed by a moderator which also tells you to post in your first topic. However, you don't stopthere but go on like nothing happened and create a third topic less than 8 hours after that again ! Are you telling methat it's nothing wrong with this ?You amaze me and I don't know how to describe your stupidity... Gule tresko ?EDIT : You remind me of kids, who wants attention from their mothers where they repeat "mommy, mommy, mommy"over and over again, till they get slapped, gets their bottle put in their throat or when they're told to shut up. Youhowever don't quit, but you just reposition and continue with your childishness.And hey...don't bother sending PMs to me.and in my 4th post you are probablly going to tell me to calm down and chill out, again?oh right, you guys got to do lots of chilling in your place huhh? Edited January 14, 2007 by Helge
imNew Posted January 14, 2007 Author Posted January 14, 2007 Thanks alot 59FIFTY, thanks for taking the time and read my concerns and helping out. BUt you offered something really interesting there: a function calls itself!! something reminds me of recursing. I will play around with it a bit, thanks again and problem might get complicated a lot, since those mouse movements I put there just represents my lots-of-codes with tons of mouse moves, key presses, control checkings, color checkings...
59FIFTY Posted January 14, 2007 Posted January 14, 2007 (edited) You're right, it's a recursive call, they are often used to loop a certain sequence over and over again until a given statement is reached (I.e. loop through directories or sorting arrays). In this example it's simply used to make the same operation from the begging, the only thing that I forgot is to ExitLoop, or you will get an overhead of function calls. I don't know the exact offset of this call, but I think it's 256, like it is in most common languages Edited January 14, 2007 by 59FIFTY
imNew Posted January 14, 2007 Author Posted January 14, 2007 And it's completely impossible to post in your first topic ? You create a topic, and after some replies which didn't satisfy you create another topic, 8 hours after the first one. This topic quickly gets closed by a moderator which also tells you to post in your first topic. However, you don't stop there but go on like nothing happened and create a third topic less than 8 hours after that again ! Are you telling me that it's nothing wrong with this ? You amaze me and I don't know how to describe your stupidity... Gule tresko ? what are you .... [any verb in here]ing here/today? I have to keep asking the same question because trolls like you have to ruin others' posts. if it bothers you so much then go look elsewhere.
imNew Posted January 14, 2007 Author Posted January 14, 2007 Thanks again 59FIFTY, I think I m getting very close now.but I have one thing not sure about recursion.for example, let's take look of the code you offered me:Func RunMouseMoves() For $i=0 To Ubound($aMouseXY)-1 If Not ErrorCheck Then MouseMove($aMouseXY[$i][0], $aMouseXY[$i][0]) Else $i = Ubound($aMouseXY)-1 RunMouseMoves() EndIf Next EndFuncif I call RunMouseMoves() inside of RunMouseMoves() and RunMouseMoves() finishes and exits what happens to RunMouseMoves()? will it continue to execute? because idealy i would like it just to die out; or maybe that is the place the ExitLoop you mentioned should go in?my last question, thank you so much for looking into it.
59FIFTY Posted January 14, 2007 Posted January 14, 2007 I forgot I covered that by using: $i = Ubound($aMouseXY)-1 The exit statement of the loop is reached and the function is finished, so it will not cause an infinity loop. It works like this: Function is called (ID: 1) Error occured Function calles it self (ID: 2) No Error occured Function dies out (ID: 2) Function dies out (ID: 1)
imNew Posted January 14, 2007 Author Posted January 14, 2007 allright, problem solved, thanks again, time for me to get to the crunching part.
MHz Posted January 14, 2007 Posted January 14, 2007 what are you .... [any verb in here]ing here/today? I have to keep asking the same question because trolls like you have to ruin others' posts. if it bothers you so much then go look elsewhere.Another double posting pain in the ass. Pull your head back in else suffer your fate.
imNew Posted January 14, 2007 Author Posted January 14, 2007 EDIT : You remind me of kids, who wants attention from their mothers where they repeat "mommy, mommy, mommy"over and over again, till they get slapped, gets their bottle put in their throat or when they're told to shut up. Youhowever don't quit, but you just reposition and continue with your childishness.just for Holge, my symmpathies to your horrid childhood, and since you said "kids" I m assuming...
Helge Posted January 14, 2007 Posted January 14, 2007 (edited) I said pretty much just the same* as the person who closed your second topic, only I did it slightly less friendlier.Why are you reacting differently to this topic than to the last one ? Is it simply because you couldn't reply in thattopic because it was closed, or is it because the words then came from a moderator and you didn't dare but nowyou do because I'm a normal user ?In reply to why I don't leave....why don't you leave ? You seem to have a problem with basic human-logic and toprocess the message from the moderator in the second topic. "Topic closed ? And I'm told to post in my first topic !I don't get it... I better create a new topic and whine about people complaining there...yeah." Makes perfect sense.* - why not post in your first topic ?EDIT : And btw, my childhood was perfectly fine, but thank you very much for caring. Edited January 14, 2007 by Helge
imNew Posted January 14, 2007 Author Posted January 14, 2007 I said pretty much just the same* as the person who closed your second topic, only I did it slightly less friendlier.Why are you reacting differently to this topic than to the last one ? Is it simply because you couldn't reply in thattopic because it was closed, or is it because the words then came from a moderator and you didn't dare but nowyou do because I'm a normal user ?In reply to why I don't leave....why don't you leave ? You seem to have a problem with basic human-logic and toprocess the message from the moderator in the second topic. "Topic closed ? And I'm told to post in my first topic !I don't get it... I better create a new topic and whine about people complaining there...yeah." Makes perfect sense.* - why not post in your first topic ?EDIT : And btw, my childhood was perfectly fine, but thank you very much for caring.You just want to be this disgusting gum that will stick to one's shoes that won't go away? how long do you want to troll? why would I have to post more than once? check who has to bump the last topic, do you even think about that? if I have an answer at the first place why do I have to listen to a emo clown like you? you are just this sick twisted no life trying to make others feel the same way as you do, due to your childhood or family issues, or simply the cold there just freezing your reptilian brain off.
Developers Jos Posted January 14, 2007 Developers Posted January 14, 2007 You just want to be this disgusting gum that will stick to one's shoes that won't go away? how long do you want to troll? why would I have to post more than once? check who has to bump the last topic, do you even think about that? if I have an answer at the first place why do I have to listen to a emo clown like you? you are just this sick twisted no life trying to make others feel the same way as you do, due to your childhood or family issues, or simply the cold there just freezing your reptilian brain off.What about toning it down a bit and relax .... voluntarily or forced ... your decision SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts