AnRios Posted September 6, 2019 Share Posted September 6, 2019 Hi there, I'm very new at scripting and I have a problem. I use these extremely simple lines to exhibit and print images from SAP. However I did not manage to find a solution to make it stop before the end, could someone help? Thanks in advance. OBS: Since I'm using the company pc, I haven't the permission to install anything, I'm running the zip version of AutoIT. For $i = 1 to 600 ; I print several images a day WinActivate("Relatorio") Sleep (300) BlockInput (1) ; Block Use Input Send("{ENTER}") Sleep (1000) Send("{F3}") ; This activates the hotkey from PrintKey Sleep (250) MouseClickDrag ( "left" ,353 ,197 ,672 ,437 ,0 ) Sleep (400) BlockInput (0) ; Unblock Use Input WinActivate("Relatorio") Send("{DOWN}") Next Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted September 6, 2019 Share Posted September 6, 2019 @AnRios Set an HotKey to exit from your script, or set a boolean variable to run conditionally your script. In any case, you can use HotKeySet() function Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
AnRios Posted October 23, 2019 Author Share Posted October 23, 2019 Francesco, thanks for the response. I have no idea where to insert this, before or after or between the For... Next loop. Could you give me an example? Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 23, 2019 Share Posted October 23, 2019 (edited) @AnRios If you see in the example provided by the Help file about HotKeySet(), you'll see that the fuction is set before all the functions (in most cases), so, put it before the For...Next loop in your script Edited October 23, 2019 by FrancescoDiMuro SkysLastChance 1 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
SkysLastChance Posted October 23, 2019 Share Posted October 23, 2019 I would also suggest looking into ControlSend(). Much more reliable. Link You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
AnRios Posted October 23, 2019 Author Share Posted October 23, 2019 @FrancescoDiMuro I got it, thanks! @SkysLastChance I read the info but still didn't get how it would work to break the loop. Link to comment Share on other sites More sharing options...
SkysLastChance Posted October 23, 2019 Share Posted October 23, 2019 (edited) It's not meant to break the script. It's meant to send your keys more reliably. Send() only works on the active window. It is better coding practice. HotKetSet() with a exit function will break the loop. HotKeySet("{ESC}", "Terminate") Func Terminate() Exit 0 EndFunc Edited October 23, 2019 by SkysLastChance You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 23, 2019 Share Posted October 23, 2019 @AnRios You're welcome Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette 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