Jump to content

Stop Script Inside For...Next Loop


AnRios
 Share

Recommended Posts

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

  • 1 month later...

@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 by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

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 by SkysLastChance

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

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...