nimbus42 Posted January 29, 2022 Share Posted January 29, 2022 it doesnt seem to work any ideas? im trying to automate our inventory sales data i hope u can help me expandcollapse popupGlobal $pants = 1 Func Main() While 1 $data1 = PixelSearch(356, 247, 726, 594, 0x6B29A5) If isArray($data1) then send ("{ALTDOWN}") sleep(60) Send("{0 down}") sleep(60) Send("{0 up}") sleep(60) send ("{ALTUP}") SLEEP(50) MouseClick("primary", $data1[0] +5, $data1[1] +5, 1, 0) SLEEP(900) Global $pants = 0 ;--- HELP ME ON THIS, IT DONT SEEM TO WORK else $data2 = PixelSearch(356, 247, 726, 594, 0x6B29A5) If isArray($data2) then MouseClick("primary", $data2[0] +5, $data2[1] +5, 1, 0) SLEEP(500) Else if $pants = 0 Then ;--- HELP ME ON THIS, IT DONT SEEM TO WORK send ("{ALTDOWN}") sleep(60) Send("{9 down}") sleep(60) Send("{9 up}") sleep(60) send ("{ALTUP}") SLEEP(50) Global $pants= 1 ;--- HELP ME ON THIS, IT DONT SEEM TO WORK else Global $pants = 1 ;--- HELP ME ON THIS, IT DONT SEEM TO WORK sleep(100) EndIf endif endif WEnd EndFunc Link to comment Share on other sites More sharing options...
ripdad Posted January 29, 2022 Share Posted January 29, 2022 (edited) You only need to declare the variable once. This is how I would do it inside the function. Your script might need more work afterwards... expandcollapse popupMain() Func Main() Local $data1, $data2, $pants = 1 While 1 $data1 = PixelSearch(356, 247, 726, 594, 0x6B29A5) If IsArray($data1) Then Send("{ALTDOWN}") Sleep(60) Send("{0 down}") Sleep(60) Send("{0 up}") Sleep(60) Send("{ALTUP}") Sleep(50) MouseClick("primary", $data1[0] + 5, $data1[1] + 5, 1, 0) Sleep(900) $pants = 0 Else $data2 = PixelSearch(356, 247, 726, 594, 0x6B29A5) If IsArray($data2) Then MouseClick("primary", $data2[0] + 5, $data2[1] + 5, 1, 0) Sleep(500) Else If $pants = 0 Then Send("{ALTDOWN}") Sleep(60) Send("{9 down}") Sleep(60) Send("{9 up}") Sleep(60) Send("{ALTUP}") Sleep(50) $pants = 1 Else $pants = 1 Sleep(100) EndIf EndIf EndIf WEnd EndFunc Edited January 29, 2022 by ripdad sp "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
ad777 Posted January 29, 2022 Share Posted January 29, 2022 (edited) @nimbus42 i did some fix on your script(i did paste $pants = 0) after else: expandcollapse popupGlobal $pants = 1, $data1, $data2 WinWaitActive("title here") ;; Main() Func Main() While 1 $data1 = PixelSearch(356, 247, 726, 594, 0x6B29A5) If isArray($data1) then send("{ALTDOWN}") sleep(60) Send("{0 down}") sleep(60) Send("{0 up}") sleep(60) send("{ALTUP}") SLEEP(50) MouseClick("primary", $data1[0] + 5, $data1[1] + 5, 1, 0) SLEEP(900) $pants = 0 else $pants = 0 $data2 = PixelSearch(356, 247, 726, 594, 0x6B29A5) If isArray($data2) then MouseClick("primary", $data2[0] + 5, $data2[1] + 5, 1, 0) SLEEP(500) Else if $pants = 0 Then send("{ALTDOWN}") sleep(60) Send("{9 down}") sleep(60) Send("{9 up}") sleep(60) send("{ALTUP}") SLEEP(50) $pants = 1 else $pants = 1 sleep(100) EndIf endif endif WEnd EndFunc ;==>Main Edited January 29, 2022 by ad777 iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 29, 2022 Developers Share Posted January 29, 2022 @ad777, Is your Tidy program still broken? What about you run Tidy before posting code so it is readable? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ad777 Posted January 29, 2022 Share Posted January 29, 2022 @Jos' ok,i will make sure of that next time.😉 Jos 1 iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
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