Jump to content

Recommended Posts

Posted

I have the below function in a while loop. while 1....Wend

However when I get my error and the function successfully closes it. The script is still looping?

 
Func  Assert($popup)

    If (WinExists("[TITLE:" & $popup & "]")) Then

        WinActivate("[TITLE:" & $popup & "]")

        Send("{CTRLDOWN}c{CTRLUP}")

        Local $olo = ClipGet()

        ACRAOutputerror($olo)

        Send("{ENTER}")

    EndIf

EndFunc
 
Posted

ExitLoop.

I'm sure you have been told this before.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted
  On 6/5/2013 at 2:16 PM, guinness said:

ExitLoop.

I'm sure you have been told this before.

I know of exit loop but I dont need it to exit the loop I want the whole thing to finish running altogether

Posted

If you Exit the while loop, it will exit the script.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted
  On 6/5/2013 at 2:19 PM, BrewManNH said:

If you Exit the while loop, it will exit the script.

In one of my other scripts I had a list of functions that the script ran through and once it did it successfully ended. I dont see why that wouldnt work here?

Posted

ExitLoop should be used with a loop, not Exit. But the code above doesn't show a loop anywhere.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted (edited)
  On 6/5/2013 at 2:20 PM, guinness said:

ExitLoop should be used with a loop, not Exit. But the code above doesn't show a loop anywhere.

my loop is literally

 
while 1
 
Test_Assert()
 
Wend
 
Edited by olo
  • Solution
Posted

Something like this.

 

while 1
 
If Test_Assert($thepopup) Then ExitLoop
 
Wend
  
Func  Test_Assert($popup)
    Local $return = 0
    If (WinExists("[TITLE:" & $popup & "]")) Then
 
        WinActivate("[TITLE:" & $popup & "]")
 
        Send("{CTRLDOWN}c{CTRLUP}")
 
        Local $olo = ClipGet()
 
        ACRAOutputerror($olo)
 
        Send("{ENTER}")
        $return = 1
    EndIf
    Return $return
EndFunc
 

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

; So Return True in that function e.g.

While 1
    If Test_Assert() Then
        ExitLoop
    EndIf
WEnd

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted (edited)

@olo - How can you expect that to exit, when it doesn't ask for or return a value?

EDIT

The others have given it to you on a platter ... I would have made you work harder for it ... use a few brain cells even.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

  Reveal hidden contents

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Posted
  On 6/5/2013 at 2:27 PM, TheSaint said:

@olo - How can you expect that to exit, when it doesn't ask for or return a value?

Yea just realized that there. Still getting used to programming... :P

Posted
  On 6/5/2013 at 2:28 PM, FireFox said:

Seems like we are set to anwser in a minute.

It's pretty basic coding.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

Seems I'm the only one who returns a boolean value instead of an integer!

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted
  On 6/5/2013 at 2:29 PM, BrewManNH said:

It's pretty basic coding.

The funny thing was not that we answered quickly, but we all answered at the same minute.

Posted
  On 6/5/2013 at 2:32 PM, guinness said:

Seems I'm the only one who returns a boolean value instead of an integer!

It's personal, I don't "like" to return booleans.

Posted (edited)
  On 6/5/2013 at 2:28 PM, olo said:

Yea just realized that there. Still getting used to programming... :P

To succeed in programming, one needs to have their critical thinking cap on at all times.

It pays to step through the code, and ask yourself, what it is doing at each point/line plus what you are wanting or expecting it to do.

It's a two way process.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

  Reveal hidden contents

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Posted
  On 6/5/2013 at 2:32 PM, guinness said:

Seems I'm the only one who returns a boolean value instead of an integer!

1 and 0 are functionally the same as True and False.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...