Sign in to follow this  
Followers 0
pezo89

pixelsearch help requested

2 posts in this topic

Hi There. i was wondering how can i have the pixelsearch if found start while 1, and if not found start the second while?

Ps: this is not the entire code, just the part i need help with

$pixelSearch=PixelSearch(653, 288, 1249, 306,  0xFF00D9) [u]<- this is the activation search for the two while modes[/u]
while 1

toolTip('Script -  "Scriptet er - PÅ"',0, 40)


$pixelSearch=PixelSearch(412, 269, 1332, 769,  0XFFEB75) ;Search the pixelcolor => Start at 0pixel by 0pixel and finish at your DesktopWidth by DesktopHeight
$randum = Random(200, 900, 1)
MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,5) ;Click with left mouse at pixelfound position (with 0 speed = MAX)
MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,5) ;Click with left mouse at pixelfound position (with 0 speed = MAX)
Sleep(Random(100,660))


If IsArray($pixelSearch)=1 Then ;If the pixel color has been found then
$pixelSearch=PixelSearch(412, 269, 1332, 769,  0XFFEB75) ;Search the pixelcolor => Start at 0pixel by 0pixel and finish at your DesktopWidth by DesktopHeight
;$pixelSearch=PixelSearch(412, 269, 1005, 769,  0XFFEB75) ;Search the pixelcolor => Start at 0pixel by 0pixel and finish at your DesktopWidth by DesktopHeight
Sleep(Random(100,500))
MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,5) ;Click with left mouse at pixelfound position (with 0 speed = MAX)
MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,5) ;Click with left mouse at pixelfound position (with 0 speed = MAX)
Sleep(Random(1000,2000))
Send("{Tab}")

Sleep(Random(1000,1500))
$i_var = Random(1, $a_answers[0],1)
Sleep(Random(1000,1500))
Send($a_answers[$i_var])
Sleep(Random(1000,1500))
Send("{Shiftdown}")
Sleep(Random(1000,1500))
Send("{Tab}")
Sleep(Random(1000,1500))
Send("{Left}")
Sleep(Random(1000,1500))
send ("{Enter}")
Sleep(Random(1000,1500))
Send("{Left}")
Sleep(Random(1000,1500))
Send("{ShiftUP}")
Sleep(Random(1000,1500))
Send("{ShiftUP}")
_IELoadWait ($oIE)
Sleep(Random(1000,1500))


EndIf
WEnd

while 1
toolTip('Script -  "Scriptet er - PÅ"',0, 40)


$pixelSearch=PixelSearch(412, 269, 1332, 769,  0XFFEB75) ;Search the pixelcolor => Start at 0pixel by 0pixel and finish at your DesktopWidth by DesktopHeight
$randum = Random(200, 900, 1)
MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,5) ;Click with left mouse at pixelfound position (with 0 speed = MAX)
MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,5) ;Click with left mouse at pixelfound position (with 0 speed = MAX)
Sleep(Random(100,660))


If IsArray($pixelSearch)=1 Then ;If the pixel color has been found then
$pixelSearch=PixelSearch(412, 269, 1332, 769,  0XFFEB75) ;Search the pixelcolor => Start at 0pixel by 0pixel and finish at your DesktopWidth by DesktopHeight
;$pixelSearch=PixelSearch(412, 269, 1005, 769,  0XFFEB75) ;Search the pixelcolor => Start at 0pixel by 0pixel and finish at your DesktopWidth by DesktopHeight
Sleep(Random(100,500))
MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,5) ;Click with left mouse at pixelfound position (with 0 speed = MAX)
MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,5) ;Click with left mouse at pixelfound position (with 0 speed = MAX)
Sleep(Random(1000,2000))
Send("{Tab}")


Sleep(Random(1000,1500))
Send("{Shiftdown}")
Sleep(Random(1000,1500))
Send("{Tab}")
Sleep(Random(1000,1500))
Send("{Left}")
Sleep(Random(1000,1500))
send ("{Enter}")
Sleep(Random(1000,1500))
Send("{Left}")
Sleep(Random(1000,1500))
Send("{ShiftUP}")
Sleep(Random(1000,1500))
Send("{ShiftUP}")
_IELoadWait ($oIE)
Sleep(Random(1000,1500))

Share this post


Link to post
Share on other sites



pezo89,

If you want a choice after an If statement, use Else or ElseIf depending on what you are testing:

If $fred = 1 Then
    ; Do this if $fred = 1
Else
    ; Do this if $fred <> 1
EndIf

If IsArray($fred) Then
    ; Do this if $fred is an array 
ElseIf $fred = 1 Then
    ; Do this if $fred = 1
ElseIf $fred = 2 Then
    ; Do this if $fred = 2
Else
    ; Do this if $fred is not an array and $fred > 2
EndIf

If you are testing for multiple values, Switch or Select structures are usually faster and easier to code/read.

I hope this helps. ;)

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

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