kart442 Posted September 20, 2007 Share Posted September 20, 2007 Not sure why this won't work... I would like to press a "HOTKEY" for each func to turn it on and/or off... If you guys could help it would be greatly appreciated... expandcollapse popupGlobal $color1 = 0x0099CC ;blue Global $color2 = 0xB2B2B2 ;red Global $color3 = 0x66CC33 ;green Global $color4 = 0xCCCC00 ;yellow Global $color5 = 0x993399 ;purple #include <File.au3> Dim $csvArray2 $csvFile2 = "C:\rainbowarray.txt" Global $Paused = False HotKeySet("{SPACE}", "TogglePause") HotKeySet("{ESC}", "Terminate") Global $ClickBlue = False Global $ClickRed = False Global $ClickGreen = False Global $ClickYellow = False Global $ClickPurple = False HotKeySet("{1}", "color1") HotKeySet("{2}", "color2") HotKeySet("{3}", "color3") HotKeySet("{4}", "color4") HotKeySet("{5}", "color5") While 1 If FileExists($csvFile2) Then If Not _FileReadToArray($csvFile2, $csvArray2) Then MsgBox(0, "Error", "Error reading " & $csvFile2) Else For $x = 1 To $csvArray2[0] - 1 $csvLine2 = $csvArray2[$x] $csvLineArray2 = StringSplit($csvLine2, ",", 1) $x1 = $csvLineArray2[1] $y1 = $csvLineArray2[2] $x2 = $csvLineArray2[3] $y2 = $csvLineArray2[4] $x3 = $csvLineArray2[5] $y3 = $csvLineArray2[6] Next EndIf EndIf WEnd Func color1() If $ClickBlue = True Then If (PixelGetColor($x1, $y1) = $color1 And PixelGetColor($x2, $y2) = $color1) Then MouseClick("left", $x3, $y3, 1, 0) ToolTip('Script is "Blue"', 0, 0) EndIf EndIf EndFunc ;==>color1 Func color2() If $ClickRed = True Then If (PixelGetColor($x1, $y1) = $color2 And PixelGetColor($x2, $y2) = $color2) Then MouseClick("left", $x3, $y3, 1, 0) ToolTip('Script is "Red"', 0, 0) EndIf EndIf EndFunc ;==>color2 Func color3() If $ClickGreen = True Then If (PixelGetColor($x1, $y1) = $color3 And PixelGetColor($x2, $y2) = $color3) Then MouseClick("left", $x3, $y3, 1, 0) ToolTip('Script is "Green"', 0, 0) EndIf EndIf EndFunc ;==>color3 Func color4() If $ClickYellow = True Then If (PixelGetColor($x1, $y1) = $color4 And PixelGetColor($x2, $y2) = $color4) Then MouseClick("left", $x3, $y3, 1, 0) ToolTip('Script is "Yellow"', 0, 0) EndIf EndIf EndFunc ;==>color4 Func color5() If $ClickPurple = True Then If (PixelGetColor($x1, $y1) = $color5 And PixelGetColor($x2, $y2) = $color5) Then MouseClick("left", $x3, $y3, 1, 0) EndIf EndIf EndFunc ;==>color5 Func TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() Exit 0 EndFunc ;==>Terminate Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 20, 2007 Moderators Share Posted September 20, 2007 Replace:HotKeySet("{1}", "color1") HotKeySet("{2}", "color2") HotKeySet("{3}", "color3") HotKeySet("{4}", "color4") HotKeySet("{5}", "color5")oÝ÷ ÙhØ^¶¬y·¥£!¢é]rÞº-Ø^6ézºZu©l¢· é¤{+ºÚ"µÍÝÙ^TÙ] ][ÝÞÓSTQ_I][ÝË ][ÝØÛÛÜI][ÝÊBÝÙ^TÙ] ][ÝÞÓSTQI][ÝË ][ÝØÛÛÜ][ÝÊBÝÙ^TÙ] ][ÝÞÓSTQßI][ÝË ][ÝØÛÛÜÉ][ÝÊBÝÙ^TÙ] ][ÝÞÓSTQ I][ÝË ][ÝØÛÛÜ ][ÝÊBÝÙ^TÙ] ][ÝÞÓSTQ _I][ÝË ][ÝØÛÛÜI][ÝÊBÝÙ^TÙ] ][ÝÌI][ÝË ][ÝØÛÛÜI][ÝÊBÝÙ^TÙ] ][ÝÌ][ÝË ][ÝØÛÛÜ][ÝÊBÝÙ^TÙ] ][ÝÌÉ][ÝË ][ÝØÛÛÜÉ][ÝÊBÝÙ^TÙ] ][ÝÍ ][ÝË ][ÝØÛÛÜ ][ÝÊBÝÙ^TÙ] ][ÝÍI][ÝË ][ÝØÛÛÜI][ÝÊ Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
kart442 Posted September 20, 2007 Author Share Posted September 20, 2007 Replace:HotKeySet("{1}", "color1") HotKeySet("{2}", "color2") HotKeySet("{3}", "color3") HotKeySet("{4}", "color4") HotKeySet("{5}", "color5")oÝ÷ ÙhØ^¶¬y·¥£!¢é]rÞº-Ø^6ézºZu©l¢· é¤{+ºÚ"µÍÝÙ^TÙ] ][ÝÞÓSTQ_I][ÝË ][ÝØÛÛÜI][ÝÊBÝÙ^TÙ] ][ÝÞÓSTQI][ÝË ][ÝØÛÛÜ][ÝÊBÝÙ^TÙ] ][ÝÞÓSTQßI][ÝË ][ÝØÛÛÜÉ][ÝÊBÝÙ^TÙ] ][ÝÞÓSTQ I][ÝË ][ÝØÛÛÜ ][ÝÊBÝÙ^TÙ] ][ÝÞÓSTQ _I][ÝË ][ÝØÛÛÜI][ÝÊBÝÙ^TÙ] ][ÝÌI][ÝË ][ÝØÛÛÜI][ÝÊBÝÙ^TÙ] ][ÝÌ][ÝË ][ÝØÛÛÜ][ÝÊBÝÙ^TÙ] ][ÝÌÉ][ÝË ][ÝØÛÛÜÉ][ÝÊBÝÙ^TÙ] ][ÝÍ ][ÝË ][ÝØÛÛÜ ][ÝÊBÝÙ^TÙ] ][ÝÍI][ÝË ][ÝØÛÛÜI][ÝÊ Thanks SmOke_N but to no avail.... Is there some other reason it will not work? Is there a problem with the array or func? BTW I continue to learn from your post...hope to understand how this all works one day. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 20, 2007 Moderators Share Posted September 20, 2007 Thanks SmOke_N but to no avail.... Is there some other reason it will not work? Is there a problem with the array or func? BTW I continue to learn from your post...hope to understand how this all works one day.These:(PixelGetColor($x1, $y1) = $color2 And PixelGetColor($x2, $y2) = $color2)oÝ÷ Ù(hºWe¢,¢g)à)jëh×6((PixelGetColor($x1, $y1) == $color2) And (PixelGetColor($x2, $y2) == $color2))oÝ÷ Ø~*쵩Ý~æ¢Ër¢ë!¢é]r*.ªëk&§vØ^Ó~±6éz¿ô߬ºfÞ®ö¥¹ë»-"|¨º¹h¢n¶Øb²Ú&jG¬º·²¢æ«y§-¹©eʶ)àéz»Ûaz·«y©eÊ+:zW¦z{lºÚÈ8¬¦V²Ó~²òâà+¬¶N§Ê¬¥vèm¦åÊZ(¦Øk¢è!¶¦©".ëay+kxzyµÈ^²Ø^éz¼¨ºÇü¨¹Ú,y槺fÞ8^*.綧uê쵩ݶÊç!jx"a{MúÅ©ÝÓ~²½©nzǯz¼¥¢l¢émfzêÞÉèµëÞ©Þy×è®ØZ¶Z(¥·jëÓ~±jwt߬°Yh½êު楶¥jË^éÛ(Ê«r^jëh×6 For $x = 1 To $csvArray2[0] - 1;Not sure why you have -1 there, you won't get the last line $csvLine2 = $csvArray2[$x] $csvLineArray2 = StringSplit($csvLine2, ",", 1) $x1 = $csvLineArray2[1] $y1 = $csvLineArray2[2] $x2 = $csvLineArray2[3] $y2 = $csvLineArray2[4] $x3 = $csvLineArray2[5] $y3 = $csvLineArray2[6] NextoÝ÷ Ø'¡Ø}êÞÛajv®¶sbb33c¶77dÆæT'&"Ò7G&æu7ÆBb33c¶77d'&%³ÒÓÂgV÷C²ÂgV÷C²Â´WBÓW&R&V6W6R÷RBBâFRÆö÷&÷fRà¢b33c·Òb33c¶77dÆæT'&%³Ð¢b33c·Òb33c¶77dÆæT'&%³%Тb33c·"Òb33c¶77dÆæT'&%³5Тb33c·"Òb33c¶77dÆæT'&%³EТb33c·2Òb33c¶77dÆæT'&%³UТb33c·2Òb33c¶77dÆæT'&%³eÐ The two are the same output once your loop has finished. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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