Jump to content

Limit loop


awfstieg
 Share

Recommended Posts

Hi, i made a code which contain:

while 1
    $get_costumer_data = PixelSearch(-498, 350, -366, 351, 0x254C1D, 1)
    If Not @error Then
        MouseClick ("left", $get_costumer_data[0], $get_costumer_data[1],1,1)
        ContinueLoop
    EndIf

    $correct = PixelSearch(-813, 356,-810, 361, 0x214866, 1)
    if not @error Then
        MouseClick ("left", -1196, 437,1,1)
        ContinueLoop
    EndIf

    $false = PixelSearch(-813, 356,-810, 361, 0xF36D25, 1)
    If Not @error Then
        MouseClick ("left", -474, 832,1,1)  ;ask_for_new_data
        MouseClick("left", -267, 358, 1, 1) ;ban_user
        ContinueLoop
    EndIf
WEnd

i want to make $false to  ;ask_for_new_data limited to 3 times, if it still get $false then ;ban_user, 

i've searched the forum but didn't get any result, help please.

Link to comment
Share on other sites

Maybe this?

$var = 0
Do
    $false = PixelSearch(-813, 356,-810, 361, 0xF36D25, 1)
    If $false = @error Then
        ExitLoop
    Else
        $var = $var + 1
        ConsoleWrite('ask_for_new_data - '&@MSEC&@CRLF)
        MouseClick("left", -474, 832,1,1)  ;ask_for_new_data
        If $var = 3 Then
        ConsoleWrite('ban_user - '&@MSEC&@CRLF)
        MouseClick("left", -267, 358, 1, 1) ;ban_user
        EndIf
    EndIf
Until $var = 3 Or $false <> @error

There are many ways to do the same.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

@careca : i try to understand your script but something isn't clear for me. Could you please be so kind and explain it to me ?

If $false = @error Then
   ExitLoop
Else ...

How could $false = @error ever happen because :
1) If the pixel is found, @error = 0, $false is now an array so testing $false and hoping it will be equal to 0 (or "" or False) to exit the loop, it will not work.

2) If the pixel is not found, @error = 1, $false = 0 . There too, ExitLoop will never happen.

Also re-using @error in the last line of the script (the Until part of the loop) seems very dangerous, especially @error has been reset to 0 after each function of the Else statement (thanks to the help file)

Personnally, i always add immediately a line like this, when I need to test @error later in the script :
$iKeep_error = @error
Then you can test $iKeep_error wherever you want, with an incredible peace of mind :)

Link to comment
Share on other sites

"How could $false = @error ever happen"

Pixel is not found > @error, what is the doubt?

Pixel is found, no error, so the code will jump to the else bit.

3) I see what you mean, it's a valid point, anyway this is to serve as a guide, something to build uppon.

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

5 hours ago, careca said:

Maybe this?

$var = 0
Do
    $false = PixelSearch(-813, 356,-810, 361, 0xF36D25, 1)
    If $false = @error Then
        ExitLoop
    Else
        $var = $var + 1
        ConsoleWrite('ask_for_new_data - '&@MSEC&@CRLF)
        MouseClick("left", -474, 832,1,1)  ;ask_for_new_data
        If $var = 3 Then
        ConsoleWrite('ban_user - '&@MSEC&@CRLF)
        MouseClick("left", -267, 358, 1, 1) ;ban_user
        EndIf
    EndIf
Until $var = 3 Or $false <> @error

There are many ways to do the same.

i'm sorry, i still confused. should i put $var & Do inside while? outside while? or replace while with do..until?

it tried what you suggested but after ask_for_new_data happened 3 times and went back to the top it will do infinity loop again.

p.s. please bear with me, i just started this scripting thingy days ago :'(

Link to comment
Share on other sites

Did you set it up like this?

While 1
    $get_costumer_data = PixelSearch(-498, 350, -366, 351, 0x254C1D, 1)
    If Not @error Then
        MouseClick("left", $get_costumer_data[0], $get_costumer_data[1], 1, 1)
        ContinueLoop
    EndIf

    $correct = PixelSearch(-813, 356, -810, 361, 0x214866, 1)
    If Not @error Then
        MouseClick("left", -1196, 437, 1, 1)
        ContinueLoop
    EndIf
    ;=============================================================================
    $var = 0 ;we reset the var "count" to zero before the loop
    Do
        $false = PixelSearch(-813, 356, -810, 361, 0xF36D25, 1)
        If $false = @error Then ;found pixel so don't do any action and leave loop
            ExitLoop
        Else
            $var = $var + 1 ;increase var count
            ConsoleWrite('ask_for_new_data - ' & @MSEC & @CRLF)
            MouseClick("left", -474, 832, 1, 1) ;ask_for_new_data
            If $var = 3 Then ;if it's the third and last time in the loop, ban user.
                ConsoleWrite('ban_user - ' & @MSEC & @CRLF)
                MouseClick("left", -267, 358, 1, 1) ;ban_user
            EndIf
        EndIf
    Until $var = 3 Or $false <> @error ;leave loop if pixelsearch didn't give error, or it's the third loop.
    ;=============================================================================
WEnd

 

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

This is such a strange concept for me... how can someone be in an administrative position where they have the authority to possibly ban someone but yet it's based off of pixel search and generic mouse clicks?... I'd think any administrator would have access to more intuitive parts of a program or whatever the user is trying to access.

This seems like an attempt to mask another program and make the user enter info and give like a pseudo ban by preventing the user from using the program

Edited by markyrocks
Link to comment
Share on other sites

  • Moderators

markyrocks,

I quite agree - so why did you not report the thread so that the Mods are aware? We cannot see everything and it was purely by chance that I read this thread in detail. So in future please help us and use the "Report" button if you suspect anything.

awfstieg,

Given the doubts expressed above, please give some more details of just what you are trying to do and why you need to do it in such a roundabout way.

M23

P.S. And just to be absolutely clear - because apparently it still needs to be emphasised:

This is the Mod team determining the legality of the thread, so everyone else please keep out.

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

7 hours ago, markyrocks said:

This is such a strange concept for me... how can someone be in an administrative position where they have the authority to possibly ban someone but yet it's based off of pixel search and generic mouse clicks?... I'd think any administrator would have access to more intuitive parts of a program or whatever the user is trying to access.

This seems like an attempt to mask another program and make the user enter info and give like a pseudo ban by preventing the user from using the program

 

21 minutes ago, Melba23 said:

markyrocks,

I quite agree - so why did you not report the thread so that the Mods are aware? We cannot see everything and it was purely by chance that I read this thread in detail. So in future please help us and use the "Report" button if you suspect anything.

awfstieg,

Given the doubts expressed above, please give some more details of just what you are trying to do and why you need to do it in such a roundabout way.

M23

P.S. And just to be absolutely clear - because apparently it still needs to be emphasised:

This is the Mod team determining the legality of the thread, so everyone else please keep out.

No, i'm not making a program to harm anyone. i'm currently making a game automaton to earn exp for myself. 

And i know that's ilegal, that's why i changed all the words in it. 

you can ban me after this. 

thank you for everything, and i am sorry. 

Link to comment
Share on other sites

  • Moderators

awfstieg,

No-one is going to ban you at the moment - just please stick to the Forum rules in future. Thread locked.

M23

 

Edited by Melba23
Fixed formatting

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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