Jump to content
Sign in to follow this  
szucsaaron

Do...Until help

Recommended Posts

szucsaaron

Hi

In my script i made a do until loop and i want to end it with Isarray but when i tryed nothing happens it doesnt shows an error but it keeps doing the loop and it wont stop.

See my script:

Do

If Not @error then

Msgbox (1,"Hello","hello")

Sleep (1000)

Msgbox(1,"Hello","hello")

EndIf

Until IsArray($coord)

and the script would go on

Edited by szucsaaron

Share this post


Link to post
Share on other sites
water

Can you please post the code you have? This way it's much easier to help.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
szucsaaron

there you go sorry i forgot that part

Share this post


Link to post
Share on other sites
szucsaaron

i want it to end when the $coord is array

Share this post


Link to post
Share on other sites
szucsaaron

but it keeps going on

Share this post


Link to post
Share on other sites
Melba23

szucsaaron,

Please use the "Edit" button rather then posting single phrases every few seconds. You already have 5 posts and so padding your post count serves no useful purpose. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
water

You have to set $coord to an array in the Do / Until loop. Else you'll never exit the loop (as you can see now).


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
szucsaaron

and how do i do that?

sorry but im newbie ;)

Share this post


Link to post
Share on other sites
water

It depends on what you try to do with your script.

The code you posted looks like a cut down version of your script. Can you post the whole script or at least tell us what you try to do?

If you post your code please enclose it in

 
tags.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
szucsaaron

sorry but i cant post the whole script itself because its one of my friends but he has no internet now

but he said he want something with pixelsearch and he wants this continue to go on if something can be seen on the desktop like u know he has win 7 so his screensaver keeps on changing

and when the screensaver goes to one of thoose he wants that this should end (do...until)

Share this post


Link to post
Share on other sites
szucsaaron

$coord = PixelSearch(539, 495, 778, 620 0xFCF097)
Do
If Not @error then
Msgbox (1,"Hello","hello")
Sleep (1000)
Msgbox(1,"Hello","hello")
EndIf
Until IsArray($coord)
Until IsArray($coord)
    Sleep(1000)
    If IsArray($coord) Then
        MouseMove($coord[0], $coord[1])
        MouseClick("LEFT")
        Sleep(10000)
    EndIf

thats all what he dictated for me because he said its a long way till the end and the beggining

Edited by szucsaaron

Share this post


Link to post
Share on other sites
BrewManNH

Try putting the pixelsearch line INSIDE the first Do loop (just before the If Not @error line), otherwise $coord will never get updated.


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!

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

Share this post


Link to post
Share on other sites
szucsaaron

but it doesnt need refreshing it just should exit that loop when the $coord is shown on his desktop right?

Share this post


Link to post
Share on other sites
BrewManNH

No, how do you expect the $coord array to get created if you're not actually looking for the pixel? Trust me on this, put the line inside the Do loop where I said to put it, it should work, if that pixel color ever shows up.


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!

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

Share this post


Link to post
Share on other sites
szucsaaron

should it look like this?

Do
$coord = PixelSearch(539, 495, 778, 620 0xFCF097)
If Not @error then
Msgbox (1,"Hello","hello")
Sleep (1000)
Msgbox(1,"Hello","hello")
EndIf
Until IsArray($coord)
    Sleep(1000)
    If IsArray($coord) Then
        MouseMove($coord[0], $coord[1])
        MouseClick("LEFT")
        Sleep(10000)
    EndIf
Edited by szucsaaron

Share this post


Link to post
Share on other sites
BrewManNH

Well, you'll need a comma between the 620 and 0xFCF097, but that is what I was suggesting.


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!

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

Share this post


Link to post
Share on other sites
water

You can remove the second check for array because this part of the code will only be executed when $coord is an array:

Do
    $coord = PixelSearch(539, 495, 778, 620 0xFCF097)
    If Not @error Then
        MsgBox(1, "Hello", "hello")
        Sleep(1000)
        MsgBox(1, "Hello", "hello")
    EndIf
Until IsArray($coord)
Sleep(1000)
MouseMove($coord[0], $coord[1])
MouseClick("LEFT")
Sleep(10000)

Another question: What do you want to do with your script? PixelSearch often is used for some kind of game automation?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
szucsaaron

My pc has some kinda virus what gives ads and it shall be like a relflex u know which closes them and its from different parts and theese warn me that u know but thanks anyway i'll try it out

Share this post


Link to post
Share on other sites
water

But shouldn't you first try to get rid of the virus?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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  

×