pezo89 Posted December 29, 2009 Posted December 29, 2009 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 expandcollapse popup$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))
Moderators Melba23 Posted December 29, 2009 Moderators Posted December 29, 2009 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 EndIfIf 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now