Sign in to follow this  
Followers 0
DelioPontes

How to stop a loopt with a hot key! I follow this example...but the script give a error...

6 posts in this topic

#1 ·  Posted (edited)

Hi all!

 

I need your help again...

 

I tried to use this example below to stop a loop with a hotkey

'?do=embed' frameborder='0' data-embedContent>>

 

But for some reason the script give a error...:

 

"Func" statement has no matching "EndFunc".:

Func _Stop()

 

 

Can someone help me showing me what Im doing wrong?

 

Thanks in advance!

 

 

 

The code until now:

 

#include <MsgBoxConstants.au3>
 
Example()
Func Example()
 
 
Local $sAnswer = InputBox("BUZ OFF!!!", @CRLF & "Project name?", "" , "", 200,150) & ""
If @error = 1 Then Exit MsgBox($MB_SYSTEMMODAL, "BUZ OFF!!!", "OK.  Bye!" & @CRLF & @CRLF & "Closing in 5 seconds...", 5)
if not WinExists($sAnswer) then Exit Msgbox(0,"BUZ OFF!!","Sorry, no Project found!" & @CRLF & @CRLF & "Closing in 5 seconds...", 5)
$count = -1
 
HotKeySet("{ESC}", "_Stop")
Global $Stop = 0
 
 
WinActivate ($sAnswer)
 
Do
 
Local $hWnd = WinWait($sAnswer)
 
WinSetState($hWnd, "", @SW_SHOWNORMAL)
 
if WinExists("Colorize scan"& "") then
WinWaitClose("Colorize scan"& "")
endif
 
if WinExists("Saving shared data...") then
WinWaitClose("Saving shared data...")
EndIf
 
if WinExists("Saving shared data... (Not Responding)") then
WinWaitClose("Saving shared data... (Not Responding)")
EndIf
 
IF WinExists($sAnswer) Then
WinActivate ($sAnswer)
Send("^s")
$count += 1
EndIf
 
if WinExists("Share Changes") then
WinActivate ("Share Changes")
ControlClick("Share Changes", "", "[CLASS:Button; INSTANCE:1]")
 $count += 1
endif
 
if WinExists("SCENE","Saving shared data failed! Error Code: 18.") then
WinActivate ("SCENE","Saving shared data failed! Error Code: 18.")
ControlClick("SCENE", "", "[CLASS:Button; INSTANCE:1]")
$count += 1
endif
 
if WinExists("SCENE","Saving shared data failed! Error Code: 25.") then
WinActivate ("SCENE","Saving shared data failed! Error Code: 25.")
ControlClick("SCENE", "", "[CLASS:Button; INSTANCE:1]")
EndIf
 
 
Until $Stop = 1 or WinExists("SCENE", "Successfully saved shared data to revision" & "")
 
Msgbox(0,"BUZ OFF!!", @CRLF & "        Number of automatic clicks:" &  " " & $Count & @CRLF & @CRLF & "Version 1.0")
Func _Stop()
$Stop = 1
EndFunc
Exit
Edited by Melba23
Added code tags

Share this post


Link to post
Share on other sites



Please post in code tags in the future..

Your problem is the first lines, you call the function Example and then defines the function, but it has no matching end func, further you then declare another function inside this function. As i see it you can just remove these two lines as they make no sense.

Example()
Func Example""

Share this post


Link to post
Share on other sites

I also need help.Because i am facing this similar problem too.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hi all!

 

I need your help again...

 

I tried to use this example below to stop a loop with a hotkey

'?do=embed' frameborder='0' data-embedContent>>

 

But for some reason the script give a error...:

 

"Func" statement has no matching "EndFunc".:

Func _Stop()

 

 

Can someone help me showing me what Im doing wrong?

 

Thanks in advance!

 

 

 

The code until now:

 

#include <MsgBoxConstants.au3>
 
Example()
Func Example()
 
 
Local $sAnswer = InputBox("BUZ OFF!!!", @CRLF & "Project name?", "" , "", 200,150) & ""
If @error = 1 Then Exit MsgBox($MB_SYSTEMMODAL, "BUZ OFF!!!", "OK.  Bye!" & @CRLF & @CRLF & "Closing in 5 seconds...", 5)
if not WinExists($sAnswer) then Exit Msgbox(0,"BUZ OFF!!","Sorry, no Project found!" & @CRLF & @CRLF & "Closing in 5 seconds...", 5)
$count = -1
 
HotKeySet("{ESC}", "_Stop")
Global $Stop = 0
 
 
WinActivate ($sAnswer)
 
Do
 
Local $hWnd = WinWait($sAnswer)
 
WinSetState($hWnd, "", @SW_SHOWNORMAL)
 
if WinExists("Colorize scan"& "") then
WinWaitClose("Colorize scan"& "")
endif
 
if WinExists("Saving shared data...") then
WinWaitClose("Saving shared data...")
EndIf
 
if WinExists("Saving shared data... (Not Responding)") then
WinWaitClose("Saving shared data... (Not Responding)")
EndIf
 
IF WinExists($sAnswer) Then
WinActivate ($sAnswer)
Send("^s")
$count += 1
EndIf
 
if WinExists("Share Changes") then
WinActivate ("Share Changes")
ControlClick("Share Changes", "", "[CLASS:Button; INSTANCE:1]")
 $count += 1
endif
 
if WinExists("SCENE","Saving shared data failed! Error Code: 18.") then
WinActivate ("SCENE","Saving shared data failed! Error Code: 18.")
ControlClick("SCENE", "", "[CLASS:Button; INSTANCE:1]")
$count += 1
endif
 
if WinExists("SCENE","Saving shared data failed! Error Code: 25.") then
WinActivate ("SCENE","Saving shared data failed! Error Code: 25.")
ControlClick("SCENE", "", "[CLASS:Button; INSTANCE:1]")
EndIf
 
 
Until $Stop = 1 or WinExists("SCENE", "Successfully saved shared data to revision" & "")
 
Msgbox(0,"BUZ OFF!!", @CRLF & "        Number of automatic clicks:" &  " " & $Count & @CRLF & @CRLF & "Version 1.0")
Func _Stop()
$Stop = 1
EndFunc
Exit

 

I also need help.Because i am facing this similar problem too.

Maybe this one can help:

#include <MsgBoxConstants.au3>
 
HotKeySet("{ESC}", "_Stop")

Example()
Func Example()
 

;script goes here

EndFunc

Func _Stop() 
$Stop = 1 
EndFunc

Edit: and try to read the help file...

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites

 

Please post in code tags in the future..

Your problem is the first lines, you call the function Example and then defines the function, but it has no matching end func, further you then declare another function inside this function. As i see it you can just remove these two lines as they make no sense.

Example()
Func Example""

 

 

Thanks a lot for help!!!

Its working fine now!

And I will keep in mind code tags!

Share this post


Link to post
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
Sign in to follow this  
Followers 0