Easton Posted April 28, 2015 Share Posted April 28, 2015 Hi everyone!First af all say thank you to all the people is helping in the forum, I'm a newbie with autoit (in fact with everything related with programing) and I'm learning a lot.The fact is that I don't know what I'm doing wrong here:I need autoit stay always measuring the time between 2 events (closing and opening of a printing windows), because when this time is bigger than 2 seconds means than the job is over. And then exit the loop.------------Winwait ("Test, S.L - Imprimiendo...","&Cancelar")While $fDiff > 2000if Winexists("Test - Imprimiendo...","&Cancelar")=0 then $hTimer = TimerInit() EndIfif Winexists("Test - Imprimiendo...","&Cancelar") then $fDiff = TimerDiff($hTimer)EndIfWEnd-------------- I receive this error: Variable used without being declared. Link to comment Share on other sites More sharing options...
Easton Posted April 28, 2015 Author Share Posted April 28, 2015 I also try with: Winwait ("Test, S.L - Imprimiendo...","&Cancelar")Doif Winexists("Test, S.L - Imprimiendo...","&Cancelar")=0 then $hTimer = TimerInit() EndIfif Winexists("Test, S.L - Imprimiendo...","&Cancelar") then $fDiff = TimerDiff($hTimer)EndIfUntil $fDiff > 2000 But it doesn't work Link to comment Share on other sites More sharing options...
JohnOne Posted April 28, 2015 Share Posted April 28, 2015 It does not know what $fDiff is.You need to declare it before you use it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 28, 2015 Moderators Share Posted April 28, 2015 On your first post, you're trying to use $fDiff without first declaring it. Look again at the example in the help file for TimerInit().On your second post "it doesn't work" doesn't exactly help us a whole lot does it? It looks like the code runs; are you getting an error, or is it never finding the window? You have to give us more than "it doesn't work". "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Easton Posted April 28, 2015 Author Share Posted April 28, 2015 It does not know what $fDiff is.You need to declare it before you use it.How do I do it? Excuse me if it is a very simple question Link to comment Share on other sites More sharing options...
Easton Posted April 28, 2015 Author Share Posted April 28, 2015 On your first post, you're trying to use $fDiff without first declaring it. Look again at the example in the help file for TimerInit().On your second post "it doesn't work" doesn't exactly help us a whole lot does it? It looks like the code runs; are you getting an error, or is it never finding the window? You have to give us more than "it doesn't work". Excuse me, on my second post what happens is exactly nothing. There are more than two seconds since last:if Winexists("Test, S.L - Imprimiendo...","&Cancelar") then $fDiff = TimerDiff($hTimer)And it does not end the "Do ... until" Link to comment Share on other sites More sharing options...
JohnOne Posted April 28, 2015 Share Posted April 28, 2015 How do I do it? Excuse me if it is a very simple question You need to explain in more detail. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted April 28, 2015 Share Posted April 28, 2015 Best guess...WinWait("Test, S.L - Imprimiendo...", "&Cancelar") $hTimer = TimerInit() Do Sleep(10) Until WinExists("Test - Imprimiendo...", "&Cancelar") Ot TimerDiff($hTimer) > 2000 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Easton Posted April 28, 2015 Author Share Posted April 28, 2015 Best guess...WinWait("Test, S.L - Imprimiendo...", "&Cancelar") $hTimer = TimerInit() Do Sleep(10) Until WinExists("Test - Imprimiendo...", "&Cancelar") Ot TimerDiff($hTimer) > 2000 Thank you John, I really apreciate your help.It does not work, because "Test - Imprimiendo..." is a windows who opens and closes several times, and the first time when not "winexists" ends the "Do until"That's why I was thinking in stay measuring the time between closing and opening a new windows, because is a really fast process (send a file to the printer) and never delays more than a half second or less. What means that if the time since last opened window is more than two seconds, the process is done.Thank you again Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 28, 2015 Moderators Share Posted April 28, 2015 Why is the window opening an closing multiple times, what are you trying to accomplish? Is it installing software? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Easton Posted April 28, 2015 Author Share Posted April 28, 2015 Why is the window opening an closing multiple times, what are you trying to accomplish? Is it installing software? I am printing invoices, and I never know how many of them are.Every invoice my software prints makes appear and close a window.First I tried with Autoit Recorder but I don't know why this process is not recorded.Thank you again! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 28, 2015 Moderators Share Posted April 28, 2015 So how about just:While 1 WinWait("Test, S.L - Imprimiendo...", "&Cancelar") ;Do whatever else you want to do Sleep(2000) WEnd "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
JohnOne Posted April 28, 2015 Share Posted April 28, 2015 Indeed, don't even need the loop since OP wants to exit it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted April 28, 2015 Share Posted April 28, 2015 Okay, I think I get it now. A window pops up and closes while the job is occurring.If that window does not appear for 2 seconds, it means the job has completed and you can carry on in your script?Which is the popup wndow? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Easton Posted April 28, 2015 Author Share Posted April 28, 2015 Okay, I think I get it now. A window pops up and closes while the job is occurring.If that window does not appear for 2 seconds, it means the job has completed and you can carry on in your script?Which is the popup wndow?Exactly!!The popup window is "Test - Imprimiendo...","&Cancelar"Thank you all of you again!! Link to comment Share on other sites More sharing options...
JohnOne Posted April 28, 2015 Share Posted April 28, 2015 WinWait("Test, S.L - Imprimiendo...", "&Cancelar") $hTimer = TimerInit() Do Sleep(10) If WinExists("Test - Imprimiendo...", "&Cancelar") Then $hTimer = TimerInit() EndIf Until TimerDiff($hTimer) > 2000 MsgBox(0,0,"Complete") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Easton Posted April 28, 2015 Author Share Posted April 28, 2015 WinWait("Test, S.L - Imprimiendo...", "&Cancelar") $hTimer = TimerInit() Do Sleep(10) If WinExists("Test - Imprimiendo...", "&Cancelar") Then $hTimer = TimerInit() EndIf Until TimerDiff($hTimer) > 2000 MsgBox(0,0,"Complete") Wow thank you!!!!Now it works perfectly, I've been nearly two days trying combinations without success, you don't know how I thank you!!Beers from Barcelona!! Link to comment Share on other sites More sharing options...
JohnOne Posted April 28, 2015 Share Posted April 28, 2015 Ace. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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