magician13134 Posted January 5, 2008 Share Posted January 5, 2008 (edited) Hey, I've been writing a small script to make the messages for a simple POV toy, the miniPOV (www.ladyada.net), and I've been able to do all the coding so far, expect for one bug that I just cannot fix. Basically, you press the LEDs to toggle their state, then when you press done, it generates the message, if you tilt your head 90 degrees clockwise, you can read the output (1 = on, 0 = off). Every once in awhile, however, some LEDs that are on in the program show up as '0's. I know for a fact that it's happening in the change() function of my code. I tried to add bug fixes (a while loop, send mouseup, and returns) but nothing seems to work. I know it's there because this never shows up when loading a picture, loading a file, making text or all on. It also never seems to work backwards (lights that are off are never falsely read as on). (Hmmm, I take that back) Here's the source code, any help would be much appreciated by me and much of the miniPOV community, thank you! [autoit]#include <GUIConstants.au3> #include <IE.au3> #include <string.au3> #include <misc.au3> #include "_CharCoords.au3" #include "image_get_info.au3" Opt("TrayMenuMode", 1) Opt("GUIOnEventMode", 1) Opt("TrayOnEventMode", 0) TraySetToolTip("MiniPOV Message Maker by Magic Soft Inc.") FileInstall("on.ico", @TempDir & "\on.ico", 1) FileInstall("off.ico", @TempDir & "\off.ico", 1) FileInstall("move.bmp", @TempDir & "\move.bmp", 1) $cols = Int(InputBox("MiniPOV Message Generator - Magic Soft Inc.", "Number of columns to display on MiniPOV" & @CRLF & "Must be an integer between 50 and 250" & @CRLF & "(Large numbers can cause delays in drawing GUI and reading output)", "75", "", 375, 195)) If @error == 1 Then Exit If Not IsInt($cols) Then $cols = 75 If $cols == "" Then $cols = 75 If $cols < 50 Then $cols = 50 If $cols > 250 Then $cols = 250 $count = 0 $childX = 0 $scrollDelay = 150 Dim $LED[$cols][8][2] $DummyParent = GUICreate("") $GUI = GUICreate("MiniPOV", 15*50+2, 15*8+17+60, -1, -1, $WS_BORDER + $WS_POPUP, -1, $DummyParent) GUISetBkColor(0x000000) GUISetIcon("miniPOV.ico") $waitMessage = GUICtrlCreateLabel("Please Wait..." & @CRLF & "MiniPOV Message Generator by Magic Soft Inc.", 260, 15*4, 250, Default, $SS_CENTER) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xFF0000) $AllOn = GUICtrlCreateButton("All On", 35, 15*8+15, 75) GUICtrlSetOnEvent(-1, "_AllOn") GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFF0000) $AllOff = GUICtrlCreateButton("All Off", 135, 15*8+15, 75) GUICtrlSetOnEvent(-1, "_AllOff") GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFF0000) $InsertText = GUICtrlCreateButton("Text", 235, 15*8+15, 75) GUICtrlSetOnEvent(-1, "_InsertText") GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFF0000) $InsertPic = GUICtrlCreateButton("Image", 335, 15*8+15, 75) GUICtrlSetOnEvent(-1, "_InsertPic") GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFF0000) $LoadPOV = GUICtrlCreateButton("Load", 435, 15*8+15, 75) GUICtrlSetOnEvent(-1, "_LOAD") GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFF0000) $copy = GUICtrlCreateButton("Done!", 535, 15*8+15, 75) GUICtrlSetOnEvent(-1, "_done") GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFF0000) $exit = GUICtrlCreateButton("Exit", 635, 15*8+15, 75) GUICtrlSetOnEvent(-1, "_exit") GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFF0000) $lineNumber = GUICtrlCreateLabel("50", 710, 140, 35, -1, $SS_RIGHT) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetOnEvent(-1, "_gotoLine") GUICtrlSetTip(-1, "Click here to go to a line") $lineNumber2 = GUICtrlCreateLabel("0", 3, 140, 30, -1) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetOnEvent(-1, "_gotoLine") GUICtrlSetTip(-1, "Click here to go to a line") $scrollLeft = GUICtrlCreateButton("<", 310, 15*8+50, 20, 20) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFF0000) $scrollRight = GUICtrlCreateButton(">", 415, 15*8+50, 20, 20) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFF0000) ;$help = GUICtrlCreateButton("?", 475, 15*8+50, 20, 20) ; GUICtrlSetBkColor(-1, 0x000000) ; GUICtrlSetColor(-1, 0xFFFFFF) $MSI = GUICtrlCreateLabel("Written by Magic Soft Inc.", 7, 15*8+55, 155) GUICtrlSetColor(-1, 0x0000FF) GUICtrlSetOnEvent($MSI, "_msi") GUICtrlSetCursor(-1, 0) $LADYADA = GUICtrlCreateLabel("Written for MiniPOV", 15*43+5, 15*8+55, 155) GUICtrlSetColor(-1, 0x0000FF) GUICtrlSetOnEvent($LADYADA, "_ladyada") GUICtrlSetCursor(-1, 0) $move = GUICtrlCreatePic(@TempDir & "\move.bmp", (15*50+2-33) / 2, 15*8+57, 30, 6) GUICtrlSetStyle(-1, -1, $GUI_WS_EX_PARENTDRAG) _disableAll() $TrayRestore = TrayCreateItem("Restore") ;TraySetOnEvent($TrayRestore, "_restore") TrayCreateItem("") $TrayExit = TrayCreateItem("Exit") ;TraySetOnEvent(-1, "_exit") GUISetState() $LEDGUI = GUICreate("LED Array", 15*$cols+2, 15*8+5, 0, 0, $WS_CHILD, -1, $GUI) ; The LED array GUI, this is used for scrolling GUISetBkColor(0x000000) $x = 2 $y = 15*7+2 For $i = 0 to (($cols - 1)) For $j = 0 to 7 $LED[$i][$j][0] = GUICtrlCreateIcon(@TempDir & "\off.ico", -1, $x, $y, 15, 15) GUICtrlSetOnEvent(-1, "change") $LED[$i][$j][1] = 0 ;GUICtrlSetTip(-1, "Line: " & $i) ; Shows line numbers as a tooltip over each LED, but SSSSSSSSLLLLLLLLLLOOOOOOOOOOOOWWWWWWWWW $y-=15 Next $x+=15 $y = 15*7+2 Next GUISetState() GUICtrlDelete($waitMessage) _enableAll() While 1 ;$msg = GUIGetMsg() $msg = TrayGetMsg() If $msg = $TrayExit Then _exit() If $msg = $TrayRestore Then _restore() $mouse = GUIGetCursorInfo($GUI) If $mouse[4] == $scrollLeft and _IsPressed(01) Then _scrollLeft() If $mouse[4] == $scrollRight and _IsPressed(01) Then _scrollRight() If GUICtrlGetState($scrollLeft) <> 144 and $count == 0 Then GUICtrlSetState($scrollLeft, $GUI_DISABLE) ; 144 = disabled, 80 = enabled If GUICtrlGetState($scrollLeft) <> 80 and $count <> 0 Then GUICtrlSetState($scrollLeft, $GUI_ENABLE) If GUICtrlGetState($scrollRight) <> 144 and $count == $cols - 50 Then GUICtrlSetState($scrollRight, $GUI_DISABLE) If GUICtrlGetState($scrollRight) <> 80 and $count <> $cols - 50 Then GUICtrlSetState($scrollRight, $GUI_ENABLE) Sleep(10) WEnd Func _scrollLeft() If GUICtrlGetState($scrollLeft) == 144 Then Return While _IsPressed(01) $childX+=15 ; Move left 1 row $count-=1 WinMove($LEDGUI, "", $childX, 0) GUICtrlSetData($lineNumber, $count + 50) GUICtrlSetData($lineNumber2, $count) If GUICtrlGetState($scrollLeft) <> $GUI_DISABLE and $count == 0 Then GUICtrlSetState($scrollLeft, $GUI_DISABLE) ExitLoop EndIf sleep($scrollDelay) WEnd EndFunc Func _scrollRight() If GUICtrlGetState($scrollRight) == 144 Then Return While _IsPressed(01) $childX-=15 ; Move right 1 row $count+=1 WinMove($LEDGUI, "", $childX, 0) GUICtrlSetData($lineNumber, $count + 50) GUICtrlSetData($lineNumber2, $count) If GUICtrlGetState($scrollRight) <> $GUI_DISABLE and $count == $cols - 50 Then GUICtrlSetState($scrollRight, $GUI_DISABLE) ExitLoop EndIf sleep($scrollDelay) WEnd EndFunc Func _gotoLine() $TempGUI = GUICreate("Go To", 280, 90, -1, -1, -1, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) $line = GUICtrlCreateInput("0", 96, 8, 57, 21, $ES_READONLY) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetColor(-1, 0x000000) GUICtrlCreateUpdown(-1, $UDS_ARROWKEYS + $UDS_NOTHOUSANDS) GUICtrlSetLimit(-1, $cols - 50, 0) GUICtrlCreateLabel("Destination line:", 16, 10, 79, 17) GUICtrlCreateLabel("Current lines: " & $count & " - " & $count + 50, 16, 40, 95, 17) GUICtrlCreateLabel("Last line: " & $cols, 16, 64, 61, 17) $ok = GUICtrlCreateButton("Go To", 192, 8, 75, 25, 0) $cancel = GUICtrlCreateButton("Cancel", 192, 56, 75, 25, 0) GUISetState(@SW_SHOW) Opt("GUIOnEventMode", 0) While 1 $msg = GUIGetMsg() If $msg = $cancel Then ExitLoop If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $ok Then $line = GUICtrlRead($line) If $line > $cols - 50 Then $line = $cols - 50 If $line == $count Then ExitLoop Else $count = $line $childX = $count * -15 WinMove($LEDGUI, "", $childX, -1) GUICtrlSetData($lineNumber, $count + 50) GUICtrlSetData($lineNumber2, $count) EndIf ExitLoop EndIf WEnd GUIDelete($tempGUI) Opt("GUIOnEventMode", 1) Return EndFunc Func change() $mouse = GUIGetCursorInfo($GUI) If IsArray($mouse) Then $i = Floor($mouse[0]/15) $j = 8-Floor($mouse[1]/15)-1 If $i < 0 or $j < 0 or $i > ($cols - 1) or $j > 7 Then Return If $LED[$i][$j][1] == 1 Then While $LED[$i][$j][1] == 1 $LED[$i][$j][1] = 0 WEnd GUICtrlSetImage(@GUI_CtrlID, @TempDir & "\off.ico") MouseUp("main") Return Else While $LED[$i][$j][1] == 0 $LED[$i][$j][1] = 1 WEnd GUICtrlSetImage(@GUI_CtrlID, @TempDir & "\on.ico") MouseUp("main") Return EndIf EndIf EndFunc Func _AllOn() For $i = 0 to ($cols - 1) For $j = 0 to 7 ;If $LED[$i][$j][1] <> 1 Then GUICtrlSetImage($LED[$i][$j][0], @TempDir & "\on.ico") $LED[$i][$j][1] = 1 ;EndIf Next Next EndFunc Func _AllOff() For $i = 0 to ($cols - 1) For $j = 0 to 7 ;If $LED[$i][$j][1] == 1 Then GUICtrlSetImage($LED[$i][$j][0], @TempDir & "\off.ico") $LED[$i][$j][1] = 0 ;EndIf Next Next EndFunc Func _InsertText() $TempGUI = GUICreate("Insert text", 330, 103, -1, -1, -1, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) GUICtrlCreateLabel("Enter the text for your MiniPOV to display:", 16, 8, 199, 17) $text = GUICtrlCreateInput("", 16, 32, 297, 21) $ok = GUICtrlCreateButton("Insert", 240, 64, 75, 25, 0) $line = GUICtrlCreateInput($count, 64, 64, 57, 21, $ES_READONLY) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetColor(-1, 0x000000) GUICtrlCreateUpdown(-1, $UDS_ARROWKEYS + $UDS_NOTHOUSANDS) GUICtrlSetLimit(-1, $cols, 0) GUICtrlCreateLabel("Start line:", 16, 66, 48, 17) GUISetState(@SW_SHOW) Opt("GUIOnEventMode", 0) While 1 $msg = GUIGetMsg() If $msg = $ok Then ExitLoop If $msg = $GUI_EVENT_CLOSE Then Opt("GUIOnEventMode", 1) GUIDelete($tempGUI) Return EndIf WEnd Opt("GUIOnEventMode", 1) $line = Int(GUICtrlRead($line)) $text = GUICtrlRead($text) $text = StringSplit($text, "") GUIDelete($tempGUI) $k = $line $l = 0 For $i = 1 to $text[0] If StringIsAlpha($text[$i]) Then; Find ascii If StringIsUpper($text[$i]) Then $char = Asc($text[$i]) - 65 Else $char = Asc($text[$i]) - 97 + 26 EndIf Else If StringIsInt($text[$i]) Then $char = Asc($text[$i]) + 4 ElseIf StringIsSpace($text[$i]) Then $char = 78 ElseIf $text[$i] = "!" Then $char = 64 ElseIf $text[$i] = "@" Then $char = 65 ElseIf $text[$i] = "#" Then $char = 66 ElseIf $text[$i] = "$" Then $char = 67 ElseIf $text[$i] = "%" Then $char = 68 ElseIf $text[$i] = "^" Then $char = 69 ElseIf $text[$i] = "&" Then $char = 70 ElseIf $text[$i] = "?" Then $char = 77 ElseIf $text[$i] = "(" Then $char = 71 ElseIf $text[$i] = ")" Then $char = 72 ElseIf $text[$i] = "-" Then $char = 62 ElseIf $text[$i] = "_" Then $char = 73 ElseIf $text[$i] = "+" Then $char = 74 ElseIf $text[$i] = "=" Then $char = 63 ElseIf $text[$i] = "`" Then $char = 76 ElseIf $text[$i] = "~" Then $char = 75 Else MsgBox(0, "Unrecognized character!", "A space has been inserted for you to add it yourself") $char = 78 EndIf EndIf $char = $character[$char] $char = StringSplit($char, "") For $j = 1 to (50 - 1) If $k > ($cols - 1) Then Return If $char[$j] = "1" Then GUICtrlSetImage($LED[$k][$l][0], @TempDir & "\on.ico") $LED[$k][$l][1] = 1 Else GUICtrlSetImage($LED[$k][$l][0], @TempDir & "\off.ico") $LED[$k][$l][1] = 0 EndIf If $l < 6 Then $l+=1 Else $l = 0 $k+=1 EndIf Next Next EndFunc Func _InsertPic() $location = FileOpenDialog("Choose a picture", @WorkingDir, "Picture files (*.bmp)") $info = _ImageGetInfo($location) $width = _ImageGetParam($info, "Width") $height = _ImageGetParam($info, "Height") If $width / $cols >= $height / 8 Then $height = $height / ($width / $cols) $width = $width / ($width / $cols) Else $width = $height / ($height / 8) $height = $height / ($height / 8) EndIf SplashImageOn("", $location, $width, $height, 0, 0, 1) For $x = 1 to $width For $y = 1 to $height $z = Hex(PixelGetColor($x, $y), 6) $grey_1 = int(dec(StringLeft($z,2))*0.3) $grey_2 = int(dec(StringMid($z,3,2))*0.59) $grey_3 = int(dec(StringRight($z,2))*0.11) $greyscale = StringSplit(hex($grey_1 + $grey_2 + $grey_3),"000000",1) $greyscale = StringSplit($greyscale[2], "") If Asc($greyscale[1]) <= 55 Then GUICtrlSetImage($LED[$x-1][7-($y-1)][0], @TempDir & "\off.ico") $LED[$x-1][7-($y-1)][1] = 0 Else GUICtrlSetImage($LED[$x-1][7-($y-1)][0], @TempDir & "\on.ico") $LED[$x-1][7-($y-1)][1] = 1 EndIf Next Next SplashOff() EndFunc Func _load() $location = FileOpenDialog("Choose a MiniPOV text file", @ScriptDir, "Text Files (*.txt)|All files (*.*)") If @error or $location == 0 or $location == "" Then Return $file = FileRead($location) $verify = StringSplit($file, "B8(", 1) ;If $verify[0] <> 51 Then ; MsgBox(48, "Error!", "Not a valid MiniPOV file!") ; Return ;EndIf $file = StringReplace($file, "B8(", "") $file = StringReplace($file, ")," & @CRLF, "") $file = StringSplit($file, "") $x = 0 For $i = 0 to ($cols - 1) For $j = 0 to 7 If $x < $file[0] Then $x+=1 If $file[$x] = 0 Then $LED[$i][$j][1] = 0 GUICtrlSetImage($LED[$i][$j][0], @TempDir & "\off.ico") Else $LED[$i][$j][1] = 1 GUICtrlSetImage($LED[$i][$j][0], @TempDir & "\on.ico") EndIf Next Next EndFunc Func _done() Opt("GUIOnEventMode", 0) $output = "" $lastRow = $cols For $i = 0 to ($cols - 1) For $j = 0 to 7 If $LED[$cols - ($i + 1)][$j][1] == 1 Then $lastRow = $cols - $i EndIf Next If $lastRow <> $cols Then ExitLoop Next For $i = 0 to $lastRow - 1 $output&="B8(" For $j = 0 to 7 If $LED[$i][$j][1] = 1 Then $output&="1" Else $output&="0" EndIf Next $output&=")," & @CRLF Next $tempGUI = GUICreate("Your MiniPOV message", 200, 400, -1, -1, -1, $WS_EX_TOOLWINDOW, $DummyParent) $outputEdit = GUICtrlCreateEdit($output, 5, 5, 190, 355) $copyButton = GUICtrlCreateButton("Copy to clipbaord", 50, 365, 100, 30) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $copyButton Then ClipPut($output) MsgBox(0, "", "Successfully copied to clipboard!") EndIf WEnd Opt("GUIOnEventMode", 1) GUIDelete($tempGUI) $tempGUI = "" EndFunc Func _WinAnimate($v_gui, $i_mode, $i_duration = 750) If @OSVersion == "WIN_XP" OR @OSVersion == "WIN_2000" OR @OSVersion == "WIN_VISTA" Then DllCall("user32.dll", "int", "AnimateWindow", "hwnd", WinGetHandle($v_gui), "int", $i_duration, "long", $i_mode) Local $ai_gle = DllCall('kernel32.dll', 'int', 'GetLastError') If $ai_gle[0] <> 0 Then SetError(1) Return 0 EndIf Return 1 EndIf EndFunc Func _msi() _IECreate("www.magicsoftinc.com") EndFunc Func _ladyada() $oIE = _IECreate("www.ladyada.net") EndFunc Func _restore() GUISetState(@SW_RESTORE, $GUI) EndFunc Func _exit() If MsgBox(4, "Quit?", "Are you sure you want to exit?") = 6 Then _deconstruct() EndFunc Func _enableAll() GUICtrlSetState($AllOn, $GUI_ENABLE) GUICtrlSetState($AllOff, $GUI_ENABLE) GUICtrlSetState($InsertText, $GUI_ENABLE) GUICtrlSetState($InsertPic, $GUI_ENABLE) GUICtrlSetState($LoadPOV, $GUI_ENABLE) GUICtrlSetState($copy, $GUI_ENABLE) GUICtrlSetState($exit, $GUI_ENABLE) GUICtrlSetState($scrollLeft, $GUI_ENABLE) GUICtrlSetState($scrollRight, $GUI_ENABLE) ;GUICtrlSetState($help, $GUI_ENABLE) EndFunc Func _disableAll() GUICtrlSetState($AllOn, $GUI_DISABLE) GUICtrlSetState($AllOff, $GUI_DISABLE) GUICtrlSetState($InsertText, $GUI_DISABLE) GUICtrlSetState($InsertPic, $GUI_DISABLE) GUICtrlSetState($LoadPOV, $GUI_DISABLE) GUICtrlSetState($copy, $GUI_DISABLE) GUICtrlSetState($exit, $GUI_DISABLE) GUICtrlSetState($scrollLeft, $GUI_DISABLE) GUICtrlSetState($scrollRight, $GUI_DISABLE) ;GUICtrlSetState($help, $GUI_DISABLE) EndFunc Func _deconstruct() For $i = 0 to 78 $character[$i] = "" Next _WinAnimate($GUI, 0x00050010) Exit EndFuncƒo Edited January 5, 2008 by magician13134 Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
magician13134 Posted January 5, 2008 Author Share Posted January 5, 2008 Hmm, for some reason I can't edit that post, here's _charCoords expandcollapse popupDim $character[79] ;While 1 ; MsgBox(0, "", Asc(InputBox("", "", "", "", 200, 200))) ;WEnd ; Uppercase character coordinates $character[0]="1000000110000010111010010011101110011000001000000" $character[1]="1000001111111110010011001001100100101101100000000" $character[2]="0000000011111010000011000001100000101000110000000" $character[3]="1000001111111110000011000001010001000111000000000" $character[4]="0000000100000111111111001001101110111000110000000" $character[5]="0000000100000111111111001001001110100000110000000" $character[6]="0000000011111010000011000001101000101100110010000" $character[7]="1000001111111110010010001000100100111111111000001" $character[8]="0000000100000110000011111111100000110000010000000" $character[9]="0000000011000010000011000001011111100000010000000" $character[10]="1000001111111110010010001000001010111000111000001" $character[11]="0000000100000111111111000001100000011100000000000" $character[12]="1000001111111110001110001000100011111111111000001" $character[13]="1000001111111110001110011000110000111111110000001" $character[14]="0000000011111010000011000001100000101111100000000" $character[15]="0000000100000111111111010001001000100011100000000" $character[16]="0000000001111001000011100001110000110111100000000" $character[17]="0000000100000111111111010001001000101011101000000" $character[18]="0000000110011010010011001001100101001100110000000" $character[19]="0000000000001110000011111111100000100000110000000" $character[20]="0000001011111110000011000000100000101111110000001" $character[21]="0000001000111111100011000000011100100001110000001" $character[22]="0000001011111110000010111100100000101111110000001" $character[23]="1000001110001100101000001000001010011000111000001" $character[24]="0000001000001110001011111000100010100000110000001" $character[25]="0000000110001110100011001001100010111000110000000" ; Lowercase $character[26]="0000000110100010101001010100101010011110001000000" $character[27]="1000001111111110010001000100100010001110000000000" $character[28]="0000000011100010001001000100100010010011000000000" $character[29]="0000000011100010001001000100100100111111111000000" $character[30]="0000000011100010101001010100101010010110000000000" $character[31]="0000000000000010001001111110100010110001010000000" $character[32]="0000000000111010100011010001101001001111110000001" $character[33]="1000001111111110010000000100100010011110001000000" $character[34]="0000000100010010001001111101100000010000000000000" $character[35]="0000000100010010001001000101011110000000000000000" $character[36]="1000001111111100100001010100110110010001000000000" $character[37]="0000000100000010000011111111100000010000000000000" $character[38]="1000100111110010001001111000100010011110001000000" $character[39]="1000100111110010010000000100100010011110001000000" $character[40]="0000000011100010001001000100100010001110000000000" $character[41]="0000000100000111111111010010001000100100010001110" $character[42]="0000000000111000100010010001101001011111111000001" $character[43]="0000000100010011111001001000100010000001000000000" $character[44]="0000000100100010101001010100101010001001000000000" $character[45]="0000100011111010001001000100100010001000000000000" $character[46]="0000100011110010000001000000010010011111001000000" $character[47]="0000100001110011001001000000011010000011000000100" $character[48]="0000100011110010001000110000100010001111000000100" $character[49]="0000000100010011011000010000110110010001000000000" $character[50]="0000000100001110011001110000000110000000110000000" $character[51]="0000000100110011001001010100100110011001000000000" ; Others $character[52]="0000000011111010000011000001100000101111100000000" $character[53]="0000000100000010000011111111100000010000000000000" $character[54]="0000000110001010100011001001100010110000100000000" $character[55]="0000000010001010000011001001100100101101100000000" $character[56]="0000000001100000101001010010111111110100000000000" $character[57]="0000000010000010011111001001100100101100010000000" $character[58]="0000000011110010010101001001100100101100010000000" $character[59]="0000000000001100000011100001001100100001110000000" $character[60]="0000000011011010010011001001100100101101100000000" $character[61]="0000000100011010010011001001010100100111100000000" $character[62]="0000000000100000010000001000000100000010000000000" $character[63]="0000000001010000101000010100001010000101000000000" $character[64]="0000000000000000000001011111000000000000000000000" $character[65]="0000000111111000000010011001010010101111100000000" $character[66]="0000000010010011111100100101111111001001010000000" $character[67]="0000000010010011010100101011001001000000000000000" $character[68]="0000000000101001011011011010010100000000000000000" $character[69]="0000000000010000000100000001000001000001000000000" $character[70]="0000000011000010011001010010111001010000000000000" $character[71]="0000000000000000000000111100100001100000000000000" $character[72]="0000000000000010000110111100000000000000000000000" $character[73]="0000000000000000000000000000000000000000000000000" $character[74]="0000000000100000010001111111000100000010000000000" $character[75]="0000000001000000010000011000001000000010000000000" $character[76]="0000000000000000000010000010000000000000000000000" $character[77]="0000000000001010000011011001000011000000000000000" $character[78]="0000000000000000000000000000000000000000000000000" Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 5, 2008 Share Posted January 5, 2008 It looks like you are just toggling the boolean in $LED[$i][$j][1] for the matching LED icon, whose CtrlId is in $LED[$i][$j][0]. The translation of the mouse coordinates looks clunky. If the 3D array is not too huge, this might be faster and more reliable: Func change() ; @GUI_CtrlID = LED icon that was clicked on Local $LED_CLicked = @GUI_CtrlId ; Find the one that was clicked in 3D array $LED For $i = 0 To UBound($LED) -1 For $j = 0 To UBound($LED, 2) - 1 If $LED[$i][$j][0] = $LED_CLicked Then $LED[$i][$j][1] = Not $LED[$i][$j][1] If $LED[$i][$j][1] Then GUICtrlSetImage($LED_CLicked, @TempDir & "\on.ico") Else GUICtrlSetImage($LED_CLicked, @TempDir & "\off.ico") EndIf Return EndIf Next Next EndFunc Hope that helps. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
magician13134 Posted January 6, 2008 Author Share Posted January 6, 2008 Ahhhhhhh! That makes sense! Thank you very much! I totally forget about the @GUI_CtrlId macro! Thanks! Hmm, one thing I noticed now is that when you click 'done' it loads all the lines, even if there are empty ones, it didn't used to do that... I'll take a look at that, but if anyone figures out why that is before I do, I'd love to see it! Thanks again PsaltyDS!!!!!! Visit Magic Soft Inc. for some of my software 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