Jump to content

read color Resistor.


sak
 Share

Recommended Posts

Script code program Refer color resistor.

Who are just beginning to learn a technician electronics industries Do not miss.

I wrote several days trying to design so successful.

Try to see test offline. :)

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>

Opt("MustDeclareVars", 1)

Global $Form, $Graphic0, $Graphic1, $Graphic2, $Graphic3, $Graphic4, $Graphic5
Global $Graphic6, $Graphic7, $Graphic8, $Graphic9, $GrapSilver1, $GrapGold1
Global $Graphic10, $Graphic11, $Graphic12, $Graphic13, $Graphic14, $Graphic15
Global $Graphic16, $Graphic17, $Graphic18, $Graphic19, $GrapSilver2, $GrapGold2
Global $Graphic20, $Graphic21, $Graphic22, $Graphic23, $Graphic24, $Graphic25
Global $Graphic26, $Graphic27, $Graphic28, $Graphic29, $GrapSilver3, $GrapGold3
Global $Graphic30, $Graphic31, $Graphic32, $Graphic33, $Graphic34, $Graphic35
Global $Graphic36, $Graphic37, $Graphic38, $Graphic39, $GrapSilver4, $GrapGold4
Global $Label0, $Label1, $Label2, $Label3, $Label4, $Label5, $Label6, $Label7, $Label8
Global $Input1, $Input2, $Input3, $Input4, $Input5, $Button1, $Button2
Global $nMsg, $var1, $var2, $var3, $var4, $allvar

main()
Func main()
$Form = GUICreate("Resistor Color bar Decoder", 455, 330, -1, -1)
$Graphic0 = GUICtrlCreateGraphic(75, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetCursor(-1, 0)
$Graphic1 = GUICtrlCreateGraphic(106, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xB33B00)
GUICtrlSetCursor(-1, 0)
$Graphic2 = GUICtrlCreateGraphic(137, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF5500)
GUICtrlSetCursor(-1, 0)
$Graphic3 = GUICtrlCreateGraphic(168, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xF79900)
GUICtrlSetCursor(-1, 0)
$Graphic4 = GUICtrlCreateGraphic(199, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFF00)
GUICtrlSetCursor(-1, 0)
$Graphic5 = GUICtrlCreateGraphic(230, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x00FF00)
GUICtrlSetCursor(-1, 0)
$Graphic6 = GUICtrlCreateGraphic(261, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 0)
$Graphic7 = GUICtrlCreateGraphic(292, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlSetCursor(-1, 0)
$Graphic8 = GUICtrlCreateGraphic(323, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39A87)
GUICtrlSetCursor(-1, 0)
$Graphic9 = GUICtrlCreateGraphic(350, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetCursor(-1, 0)
$GrapSilver1 = GUICtrlCreateGraphic(381, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xC0C0C0)
GUICtrlSetCursor(-1, 0)
$GrapGold1 = GUICtrlCreateGraphic(412, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39E00)
GUICtrlSetCursor(-1, 0)
$Graphic10 = GUICtrlCreateGraphic(75, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetCursor(-1, 0)
$Graphic11 = GUICtrlCreateGraphic(106, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xB33B00)
GUICtrlSetCursor(-1, 0)
$Graphic12 = GUICtrlCreateGraphic(137, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF5500)
GUICtrlSetCursor(-1, 0)
$Graphic13 = GUICtrlCreateGraphic(168, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xF79900)
GUICtrlSetCursor(-1, 0)
$Graphic14 = GUICtrlCreateGraphic(199, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFF00)
GUICtrlSetCursor(-1, 0)
$Graphic15 = GUICtrlCreateGraphic(230, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x00FF00)
GUICtrlSetCursor(-1, 0)
$Graphic16 = GUICtrlCreateGraphic(261, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 0)
$Graphic17 = GUICtrlCreateGraphic(292, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlSetCursor(-1, 0)
$Graphic18 = GUICtrlCreateGraphic(323, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39A87)
GUICtrlSetCursor(-1, 0)
$Graphic19 = GUICtrlCreateGraphic(350, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetCursor(-1, 0)
$GrapSilver2 = GUICtrlCreateGraphic(381, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xC0C0C0)
GUICtrlSetCursor(-1, 0)
$GrapGold2 = GUICtrlCreateGraphic(412, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39E00)
GUICtrlSetCursor(-1, 0)
$Graphic20 = GUICtrlCreateGraphic(75, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetCursor(-1, 0)
$Graphic21 = GUICtrlCreateGraphic(106, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xB33B00)
GUICtrlSetCursor(-1, 0)
$Graphic22 = GUICtrlCreateGraphic(137, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF5500)
GUICtrlSetCursor(-1, 0)
$Graphic23 = GUICtrlCreateGraphic(168, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xF79900)
GUICtrlSetCursor(-1, 0)
$Graphic24 = GUICtrlCreateGraphic(199, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFF00)
GUICtrlSetCursor(-1, 0)
$Graphic25 = GUICtrlCreateGraphic(230, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x00FF00)
GUICtrlSetCursor(-1, 0)
$Graphic26 = GUICtrlCreateGraphic(261, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 0)
$Graphic27 = GUICtrlCreateGraphic(292, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlSetCursor(-1, 0)
$Graphic28 = GUICtrlCreateGraphic(323, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39A87)
GUICtrlSetCursor(-1, 0)
$Graphic29 = GUICtrlCreateGraphic(350, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetCursor(-1, 0)
$GrapSilver3 = GUICtrlCreateGraphic(381, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xC0C0C0)
GUICtrlSetCursor(-1, 0)
$GrapGold3 = GUICtrlCreateGraphic(412, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39E00)
GUICtrlSetCursor(-1, 0)
$Graphic30 = GUICtrlCreateGraphic(75, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetCursor(-1, 0)
$Graphic31 = GUICtrlCreateGraphic(106, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xB33B00)
GUICtrlSetCursor(-1, 0)
$Graphic32 = GUICtrlCreateGraphic(137, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF5500)
GUICtrlSetCursor(-1, 0)
$Graphic33 = GUICtrlCreateGraphic(168, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xF79900)
GUICtrlSetCursor(-1, 0)
$Graphic34 = GUICtrlCreateGraphic(199, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFF00)
GUICtrlSetCursor(-1, 0)
$Graphic35 = GUICtrlCreateGraphic(230, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x00FF00)
GUICtrlSetCursor(-1, 0)
$Graphic36 = GUICtrlCreateGraphic(261, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 0)
$Graphic37 = GUICtrlCreateGraphic(292, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlSetCursor(-1, 0)
$Graphic38 = GUICtrlCreateGraphic(323, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39A87)
GUICtrlSetCursor(-1, 0)
$Graphic39 = GUICtrlCreateGraphic(350, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetCursor(-1, 0)
$GrapSilver4 = GUICtrlCreateGraphic(381, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xC0C0C0)
GUICtrlSetCursor(-1, 0)
$GrapGold4 = GUICtrlCreateGraphic(412, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39E00)
GUICtrlSetCursor(-1, 0)
$Label0 = GUICtrlCreateLabel("Click to select the color. To convert the color code is a code number.", 50, 15, 350, 17, $SS_CENTER)
$Label1 = GUICtrlCreateLabel("Color code1", 10, 51, 60, 17)
$Label2 = GUICtrlCreateLabel("Color code2", 10, 83, 60, 17)
$Label3 = GUICtrlCreateLabel("Color code3", 10, 113, 60, 17)
$Label4 = GUICtrlCreateLabel("Color code4", 10, 143, 60, 17)
$Label5 = GUICtrlCreateLabel("Arithmetic code", 110, 190, 93, 17)
$Label6 = GUICtrlCreateLabel("Results", 280, 190, 93, 17)
$Label7 = GUICtrlCreateLabel("=", 220, 220, 14, 24, $SS_CENTER)
$Label8 = GUICtrlCreateLabel("Create by:sak2005 [Thailand]", 150, 310, 150, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$Input1 = GUICtrlCreateInput("", 90, 210, 20, 30, BitOR($ES_CENTER,$ES_READONLY), 1)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 120, 210, 20, 30, BitOR($ES_CENTER,$ES_READONLY), 1)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Input3 = GUICtrlCreateInput("", 150, 210, 20, 30, BitOR($ES_CENTER,$ES_READONLY), 1)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Input4 = GUICtrlCreateInput("", 180, 210, 20, 30, BitOR($ES_CENTER,$ES_READONLY), 1)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Input5 = GUICtrlCreateInput("", 250, 210, 100, 30, BitOR($ES_CENTER,$ES_READONLY), 1)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Enter", 125, 270, 75, 25, $WS_GROUP)
GUICtrlSetCursor(-1, 0)
$Button2 = GUICtrlCreateButton("Clear", 245, 270, 75, 25, $WS_GROUP)
GUICtrlSetCursor(-1, 0)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Graphic0
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic1
            GUICtrlSetData($Input1, "1")
        Case $Graphic2
            GUICtrlSetData($Input1, "2")
        Case $Graphic3
            GUICtrlSetData($Input1, "3")
        Case $Graphic4
            GUICtrlSetData($Input1, "4")
        Case $Graphic5
            GUICtrlSetData($Input1, "5")
        Case $Graphic6
            GUICtrlSetData($Input1, "6")
        Case $Graphic7
            GUICtrlSetData($Input1, "7")
        Case $Graphic8
            GUICtrlSetData($Input1, "8")
        Case $Graphic9
            GUICtrlSetData($Input1, "9")
        Case $GrapSilver1
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $GrapGold1
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic10
            GUICtrlSetData($Input2, "0")
        Case $Graphic11
            GUICtrlSetData($Input2, "1")
        Case $Graphic12
            GUICtrlSetData($Input2, "2")
        Case $Graphic13
            GUICtrlSetData($Input2, "3")
        Case $Graphic14
            GUICtrlSetData($Input2, "4")
        Case $Graphic15
            GUICtrlSetData($Input2, "5")
        Case $Graphic16
            GUICtrlSetData($Input2, "6")
        Case $Graphic17
            GUICtrlSetData($Input2, "7")
        Case $Graphic18
            GUICtrlSetData($Input2, "8")
        Case $Graphic19
            GUICtrlSetData($Input2, "9")
        Case $GrapSilver2
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $GrapGold2
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic20
            GUICtrlSetData($Input3, "0")
        Case $Graphic21
            GUICtrlSetData($Input3, "1")
        Case $Graphic22
            GUICtrlSetData($Input3, "2")
        Case $Graphic23
            GUICtrlSetData($Input3, "3")
        Case $Graphic24
            GUICtrlSetData($Input3, "4")
        Case $Graphic25
            GUICtrlSetData($Input3, "5")
        Case $Graphic26
            GUICtrlSetData($Input3, "6")
        Case $Graphic27
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic28
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic29
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $GrapSilver3
            GUICtrlSetData($Input3, "S")
        Case $GrapGold3
            GUICtrlSetData($Input3, "G")
        Case $Graphic30
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic31
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic32
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic33
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic34
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic35
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic36
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic37
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic38
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic39
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $GrapSilver4
            GUICtrlSetData($Input4, "S")
        Case $GrapGold4
            GUICtrlSetData($Input4, "G")
        Case $Button1
            $var1 = GUICtrlRead($Input1)
            If $var1 = '' Then
                MsgBox(0, "", "You have not selected a color code1")
                ContinueLoop
            EndIf
            $var2 = GUICtrlRead($Input2)
            If $var2 = '' Then
                MsgBox(0, "", "You have not selected a color code2")
                ContinueLoop
            EndIf
            $var3 = GUICtrlRead($Input3)
            If $var3 = '' Then
                MsgBox(0, "", "You have not selected a color code3")
                ContinueLoop
            EndIf
            $var4 = GUICtrlRead($Input4)
            If $var4 = '' Then
                MsgBox(0, "", "You have not selected a color code4")
                ContinueLoop
            EndIf
            If $var3 = 1 Then
                $allvar = $var1&$var2&0&'.Ohm'
            ElseIf $var3 = 2 Then
                $allvar = $var1&'.'&$var2&'.K'
            ElseIf $var3 = 3 Then
                $allvar = $var1&$var2&'.K'
            ElseIf $var3 = 4 Then
                $allvar = $var1&$var2&'0.K'
            ElseIf $var3 = 5 Then
                $allvar = $var1&'.'&$var2&'.M'
            ElseIf $var3 = 6 Then
                $allvar = $var1&$var2&'.M'
            ElseIf $var3 = 'S' Then
                $allvar = '0.'&$var1&$var2&'.Ohm'
            ElseIf $var3 = 'G' Then
                $allvar = $var1&'.'&$var2&'.Ohm'
            ElseIf $var3 = 0 Then
                $allvar = $var1&$var2&'.Ohm'
            EndIf
            GUICtrlSetData($Input5, $allvar)
        Case $Button2
            GUICtrlSetData($Input1, "")
            GUICtrlSetData($Input2, "")
            GUICtrlSetData($Input3, "")
            GUICtrlSetData($Input4, "")
            GUICtrlSetData($Input5, "")
    EndSwitch
WEnd
EndFunc

post-63570-0-65299400-1300055461_thumb.j

Edited by sak
Link to comment
Share on other sites

It's a good idea, but you might want to limit the 4th color band to just the tolerance colors rather than including all of them. Seeing as how you can only use Silver and Gold, having all showing might be confusing to some. Also, you should make the 4th color band optional because it's rarely used, and not needed to find out the value of a resistor.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Updated to new The answer will be automatic.

When you click on full 4 color palette.

Like do not know or not?

If there are errors where Help guide with :)

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>

Opt("MustDeclareVars", 1)

Global $Form, $Graphic0, $Graphic1, $Graphic2, $Graphic3, $Graphic4, $Graphic5
Global $Graphic6, $Graphic7, $Graphic8, $Graphic9, $GrapSilver1, $GrapGold1
Global $Graphic10, $Graphic11, $Graphic12, $Graphic13, $Graphic14, $Graphic15
Global $Graphic16, $Graphic17, $Graphic18, $Graphic19, $GrapSilver2, $GrapGold2
Global $Graphic20, $Graphic21, $Graphic22, $Graphic23, $Graphic24, $Graphic25
Global $Graphic26, $Graphic27, $Graphic28, $Graphic29, $GrapSilver3, $GrapGold3
Global $Graphic30, $Graphic31, $Graphic32, $Graphic33, $Graphic34, $Graphic35
Global $Graphic36, $Graphic37, $Graphic38, $Graphic39, $GrapSilver4, $GrapGold4
Global $Label0, $Label1, $Label2, $Label3, $Label4, $Label5, $Label6, $Label7, $Label8
Global $Input1, $Input2, $Input3, $Input4, $Input5, $Button2
Global $nMsg, $var1, $var2, $var3, $var4, $allvar

main()
Func main()
$Form = GUICreate("Resistor Color bar Decoder", 455, 280, -1, -1)
$Graphic0 = GUICtrlCreateGraphic(75, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetCursor(-1, 0)
$Graphic1 = GUICtrlCreateGraphic(106, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xB33B00)
GUICtrlSetCursor(-1, 0)
$Graphic2 = GUICtrlCreateGraphic(137, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF5500)
GUICtrlSetCursor(-1, 0)
$Graphic3 = GUICtrlCreateGraphic(168, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xF79900)
GUICtrlSetCursor(-1, 0)
$Graphic4 = GUICtrlCreateGraphic(199, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFF00)
GUICtrlSetCursor(-1, 0)
$Graphic5 = GUICtrlCreateGraphic(230, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x00FF00)
GUICtrlSetCursor(-1, 0)
$Graphic6 = GUICtrlCreateGraphic(261, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 0)
$Graphic7 = GUICtrlCreateGraphic(292, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlSetCursor(-1, 0)
$Graphic8 = GUICtrlCreateGraphic(323, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39A87)
GUICtrlSetCursor(-1, 0)
$Graphic9 = GUICtrlCreateGraphic(350, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetCursor(-1, 0)
$GrapSilver1 = GUICtrlCreateGraphic(381, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xC0C0C0)
GUICtrlSetCursor(-1, 0)
$GrapGold1 = GUICtrlCreateGraphic(412, 40, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39E00)
GUICtrlSetCursor(-1, 0)
$Graphic10 = GUICtrlCreateGraphic(75, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetCursor(-1, 0)
$Graphic11 = GUICtrlCreateGraphic(106, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xB33B00)
GUICtrlSetCursor(-1, 0)
$Graphic12 = GUICtrlCreateGraphic(137, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF5500)
GUICtrlSetCursor(-1, 0)
$Graphic13 = GUICtrlCreateGraphic(168, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xF79900)
GUICtrlSetCursor(-1, 0)
$Graphic14 = GUICtrlCreateGraphic(199, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFF00)
GUICtrlSetCursor(-1, 0)
$Graphic15 = GUICtrlCreateGraphic(230, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x00FF00)
GUICtrlSetCursor(-1, 0)
$Graphic16 = GUICtrlCreateGraphic(261, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 0)
$Graphic17 = GUICtrlCreateGraphic(292, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlSetCursor(-1, 0)
$Graphic18 = GUICtrlCreateGraphic(323, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39A87)
GUICtrlSetCursor(-1, 0)
$Graphic19 = GUICtrlCreateGraphic(350, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetCursor(-1, 0)
$GrapSilver2 = GUICtrlCreateGraphic(381, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xC0C0C0)
GUICtrlSetCursor(-1, 0)
$GrapGold2 = GUICtrlCreateGraphic(412, 72, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39E00)
GUICtrlSetCursor(-1, 0)
$Graphic20 = GUICtrlCreateGraphic(75, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetCursor(-1, 0)
$Graphic21 = GUICtrlCreateGraphic(106, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xB33B00)
GUICtrlSetCursor(-1, 0)
$Graphic22 = GUICtrlCreateGraphic(137, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF5500)
GUICtrlSetCursor(-1, 0)
$Graphic23 = GUICtrlCreateGraphic(168, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xF79900)
GUICtrlSetCursor(-1, 0)
$Graphic24 = GUICtrlCreateGraphic(199, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFF00)
GUICtrlSetCursor(-1, 0)
$Graphic25 = GUICtrlCreateGraphic(230, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x00FF00)
GUICtrlSetCursor(-1, 0)
$Graphic26 = GUICtrlCreateGraphic(261, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 0)
$Graphic27 = GUICtrlCreateGraphic(292, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlSetCursor(-1, 0)
$Graphic28 = GUICtrlCreateGraphic(323, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39A87)
GUICtrlSetCursor(-1, 0)
$Graphic29 = GUICtrlCreateGraphic(350, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetCursor(-1, 0)
$GrapSilver3 = GUICtrlCreateGraphic(381, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xC0C0C0)
GUICtrlSetCursor(-1, 0)
$GrapGold3 = GUICtrlCreateGraphic(412, 104, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39E00)
GUICtrlSetCursor(-1, 0)
$Graphic30 = GUICtrlCreateGraphic(75, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetCursor(-1, 0)
$Graphic31 = GUICtrlCreateGraphic(106, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xB33B00)
GUICtrlSetCursor(-1, 0)
$Graphic32 = GUICtrlCreateGraphic(137, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF5500)
GUICtrlSetCursor(-1, 0)
$Graphic33 = GUICtrlCreateGraphic(168, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xF79900)
GUICtrlSetCursor(-1, 0)
$Graphic34 = GUICtrlCreateGraphic(199, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFF00)
GUICtrlSetCursor(-1, 0)
$Graphic35 = GUICtrlCreateGraphic(230, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x00FF00)
GUICtrlSetCursor(-1, 0)
$Graphic36 = GUICtrlCreateGraphic(261, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 0)
$Graphic37 = GUICtrlCreateGraphic(292, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlSetCursor(-1, 0)
$Graphic38 = GUICtrlCreateGraphic(323, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39A87)
GUICtrlSetCursor(-1, 0)
$Graphic39 = GUICtrlCreateGraphic(350, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetCursor(-1, 0)
$GrapSilver4 = GUICtrlCreateGraphic(381, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xC0C0C0)
GUICtrlSetCursor(-1, 0)
$GrapGold4 = GUICtrlCreateGraphic(412, 136, 30, 30, BitOR($SS_NOTIFY,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xA39E00)
GUICtrlSetCursor(-1, 0)
$Label0 = GUICtrlCreateLabel("Click to select the color. To convert the color code is a code number.", 50, 15, 350, 17, $SS_CENTER)
$Label1 = GUICtrlCreateLabel("Color code1", 10, 51, 60, 17)
$Label2 = GUICtrlCreateLabel("Color code2", 10, 83, 60, 17)
$Label3 = GUICtrlCreateLabel("Color code3", 10, 113, 60, 17)
$Label4 = GUICtrlCreateLabel("Color code4", 10, 143, 60, 17)
$Label5 = GUICtrlCreateLabel("Arithmetic code", 80, 190, 93, 17)
$Label6 = GUICtrlCreateLabel("Auto Results", 220, 190, 93, 17)
$Label7 = GUICtrlCreateLabel("=", 180, 220, 14, 24, $SS_CENTER)
$Label8 = GUICtrlCreateLabel("Create by:sak2005 [Thailand]", 150, 260, 150, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$Input1 = GUICtrlCreateInput("", 60, 210, 20, 30, BitOR($ES_CENTER,$ES_READONLY), 1)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 90, 210, 20, 30, BitOR($ES_CENTER,$ES_READONLY), 1)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Input3 = GUICtrlCreateInput("", 120, 210, 20, 30, BitOR($ES_CENTER,$ES_READONLY), 1)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Input4 = GUICtrlCreateInput("", 150, 210, 20, 30, BitOR($ES_CENTER,$ES_READONLY), 1)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Input5 = GUICtrlCreateInput("", 200, 210, 100, 30, BitOR($ES_CENTER,$ES_READONLY), 1)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("Clear", 315, 215, 75, 25, $WS_GROUP)
GUICtrlSetCursor(-1, 0)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Graphic0
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic1
            GUICtrlSetData($Input1, "1")
        Case $Graphic2
            GUICtrlSetData($Input1, "2")
        Case $Graphic3
            GUICtrlSetData($Input1, "3")
        Case $Graphic4
            GUICtrlSetData($Input1, "4")
        Case $Graphic5
            GUICtrlSetData($Input1, "5")
        Case $Graphic6
            GUICtrlSetData($Input1, "6")
        Case $Graphic7
            GUICtrlSetData($Input1, "7")
        Case $Graphic8
            GUICtrlSetData($Input1, "8")
        Case $Graphic9
            GUICtrlSetData($Input1, "9")
        Case $GrapSilver1
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $GrapGold1
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic10
            GUICtrlSetData($Input2, "0")
        Case $Graphic11
            GUICtrlSetData($Input2, "1")
        Case $Graphic12
            GUICtrlSetData($Input2, "2")
        Case $Graphic13
            GUICtrlSetData($Input2, "3")
        Case $Graphic14
            GUICtrlSetData($Input2, "4")
        Case $Graphic15
            GUICtrlSetData($Input2, "5")
        Case $Graphic16
            GUICtrlSetData($Input2, "6")
        Case $Graphic17
            GUICtrlSetData($Input2, "7")
        Case $Graphic18
            GUICtrlSetData($Input2, "8")
        Case $Graphic19
            GUICtrlSetData($Input2, "9")
        Case $GrapSilver2
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $GrapGold2
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic20
            GUICtrlSetData($Input3, "0")
        Case $Graphic21
            GUICtrlSetData($Input3, "1")
        Case $Graphic22
            GUICtrlSetData($Input3, "2")
        Case $Graphic23
            GUICtrlSetData($Input3, "3")
        Case $Graphic24
            GUICtrlSetData($Input3, "4")
        Case $Graphic25
            GUICtrlSetData($Input3, "5")
        Case $Graphic26
            GUICtrlSetData($Input3, "6")
        Case $Graphic27
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic28
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic29
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $GrapSilver3
            GUICtrlSetData($Input3, "S")
        Case $GrapGold3
            GUICtrlSetData($Input3, "G")
        Case $Graphic30
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic31
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic32
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic33
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic34
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic35
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic36
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic37
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic38
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $Graphic39
            ToolTip("This color not use.")
            Sleep(1000)
            ToolTip("")
        Case $GrapSilver4
            GUICtrlSetData($Input4, "S")
        Case $GrapGold4
            GUICtrlSetData($Input4, "G")
        Case 0
            If GUICtrlRead($Input1) <> '' And GUICtrlRead($Input2) <> '' And _
                GUICtrlRead($Input3) <> ''And GUICtrlRead($Input4) <> '' Then
                $var1 = GUICtrlRead($Input1)
                $var2 = GUICtrlRead($Input2)
                $var3 = GUICtrlRead($Input3)
                $var4 = GUICtrlRead($Input4)
                If $var3 = 1 Then
                    $allvar = $var1&$var2&0&'.Ohm'
                ElseIf $var3 = 2 Then
                    $allvar = $var1&'.'&$var2&'.K'
                ElseIf $var3 = 3 Then
                    $allvar = $var1&$var2&'.K'
                ElseIf $var3 = 4 Then
                    $allvar = $var1&$var2&'0.K'
                ElseIf $var3 = 5 Then
                    $allvar = $var1&'.'&$var2&'.M'
                ElseIf $var3 = 6 Then
                    $allvar = $var1&$var2&'.M'
                ElseIf $var3 = 'S' Then
                    $allvar = '0.'&$var1&$var2&'.Ohm'
                ElseIf $var3 = 'G' Then
                    $allvar = $var1&'.'&$var2&'.Ohm'
                ElseIf $var3 = 0 Then
                    $allvar = $var1&$var2&'.Ohm'
                EndIf
                     GUICtrlSetData($Input5, $allvar)
            Else
            If GUICtrlRead($Input1) = '' And GUICtrlRead($Input2) = '' And _
                GUICtrlRead($Input3) = ''And GUICtrlRead($Input4) = '' Then
                GUICtrlSetData($Input5, "")
                Sleep(500)
            EndIf
            EndIf
        Case $Button2
            GUICtrlSetData($Input1, "")
            GUICtrlSetData($Input2, "")
            GUICtrlSetData($Input3, "")
            GUICtrlSetData($Input4, "")
    EndSwitch
WEnd
EndFunc
Edited by sak
Link to comment
Share on other sites

Nice.

For Reverence: http://www.google.nl/search?q=resistor+color+bands41d10

Posted Image

Edited by iEvKI3gv9Wrkd41u

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

AZJIO

Script code that you edit the previously obtainable.

But the program and script code after the return to the download is incomplete.

Ask you to review and edit again. :)

Asking you to edit the following.

A color bar that is not black to dry out the rumors.

2 bar color is not silver and gold to dry out the rumors.

3 bar color is not purple gray and white at all plentiful.

4 bar using only two colors silver and gold the rest is not................

When choosing color bands 3, then display the results way out. :)

Edited by sak
Link to comment
Share on other sites

sak

Unavailable color added to the exceptions and are not displayed

To return to the previous need to remove _ind ()

Acknowledge

I'm not good at English.

Rely on Google Translate.

Some of my text messages may not be accurate.

You have to guess a little.

Edited by sak
Link to comment
Share on other sites

wakillon

I went to the site and download your WiFaRi to try and see.

One level is good.

But do not use color correction to some bars.

Thank you for the program and script code of your.

I will try to use their own brains to edit some of the increase in need.

Link to comment
Share on other sites

wakillon

Oops! Now, who will assess each

If it is not yours.

I try to edit the script does not work more.

It is more difficult for me to understand.

Would have studied longer on the script. :)

Edited by sak
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...