Jump to content

a little help please


corey822
 Share

Recommended Posts

CODE
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("resistor decoding", 406, 149, 256, 161)

$color1 = GUICtrlCreateInput("color1", 56, 40, 65, 21)

$color2 = GUICtrlCreateInput("color2", 136, 40, 65, 21)

$color3 = GUICtrlCreateInput("color3", 216, 40, 65, 21)

$color4 = GUICtrlCreateInput("color4", 288, 40, 65, 21)

$Label1 = GUICtrlCreateLabel("resistor colors", 168, 16, 68, 17)

$Button1 = GUICtrlCreateButton("decode", 136, 88, 121, 25, 0)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Select

Case $nMsg = $GUI_EVENT_CLOSE

Exit

Case $nMsg = $Button1

$string = GUICtrlRead($color1)

$string = StringReplace($string, "black", "0")

$string = StringReplace($string, "brown", "1")

$string = StringReplace($string, "red", "2")

$string = StringReplace($string, "orange", "3")

$string = StringReplace($string, "yellow", "4")

$string = StringReplace($string, "green", "5")

$string = StringReplace($string, "blue", "6")

$string = StringReplace($string, "purple", "7")

$string = StringReplace($string, "grey", "8")

$string = StringReplace($string, "white", "9")

$string = StringReplace($string, ",", "")

GUICtrlSetData($color1, $string)

case $nMsg = $Button1

$string = GUICtrlRead($color2)

$string = StringReplace($string, "black", "0")

$string = StringReplace($string, "brown", "1")

$string = StringReplace($string, "red", "2")

$string = StringReplace($string, "orange", "3")

$string = StringReplace($string, "yellow", "4")

$string = StringReplace($string, "green", "5")

$string = StringReplace($string, "blue", "6")

$string = StringReplace($string, "purple", "7")

$string = StringReplace($string, "grey", "8")

$string = StringReplace($string, "white", "9")

$string = StringReplace($string, ",", "")

GUICtrlSetData($color2, $string)

Case $nMsg = $Button1

$string = GUICtrlRead($color3)

$string = StringReplace($string, "black", "0")

$string = StringReplace($string, "brown", "1")

$string = StringReplace($string, "red", "2")

$string = StringReplace($string, "orange", "3")

$string = StringReplace($string, "yellow", "4")

$string = StringReplace($string, "green", "5")

$string = StringReplace($string, "blue", "6")

$string = StringReplace($string, "purple", "7")

$string = StringReplace($string, "grey", "8")

$string = StringReplace($string, "white", "9")

$string = StringReplace($string, ",", "")

GUICtrlSetData($color3, $string)

case $nMsg = $Button1

$string = GUICtrlRead($color4)

$string = StringReplace($string, "black", "0")

$string = StringReplace($string, "brown", "1")

$string = StringReplace($string, "red", "2")

$string = StringReplace($string, "orange", "3")

$string = StringReplace($string, "yellow", "4")

$string = StringReplace($string, "green", "5")

$string = StringReplace($string, "blue", "6")

$string = StringReplace($string, "purple", "7")

$string = StringReplace($string, "grey", "8")

$string = StringReplace($string, "white", "9")

$string = StringReplace($string, ",", "")

GUICtrlSetData($color4, $string)

EndSelect

WEnd

ok hi all i need a little help if u run that script im trying to create a different way to decode a resistor so if i type in red it changes to the color wat red is but im trying to do it different boxes so when i type in red in each box it will change to corresponding number which for red is 2 but it only changes one box per time how do i actually it wont change other boxes at all.

is there away to call the script for each box differently with out pressing 4 different buttons ?

cheers C.W for u help

C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake

Link to comment
Share on other sites

#include <GUIConstants.au3>

$Form1 = GUICreate("resistor decoding", 406, 149, 256, 161)
$color1 = GUICtrlCreateInput("color1", 56, 40, 65, 21)
$color2 = GUICtrlCreateInput("color2", 136, 40, 65, 21)
$color3 = GUICtrlCreateInput("color3", 216, 40, 65, 21)
$color4 = GUICtrlCreateInput("color4", 288, 40, 65, 21)
$Label1 = GUICtrlCreateLabel("resistor colors", 168, 16, 68, 17)
$Button1 = GUICtrlCreateButton("decode", 136, 88, 121, 25, 0)
GUISetState(@SW_SHOW)


While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
Exit
Case $nMsg = $Button1
    If GUICtrlRead ($color1) = "black" Then
        GUICtrlSetData ($color1, "0")
    ElseIf GUICtrlRead ($color1) = "brown" Then
        GUICtrlSetData ($color1, "1")
    ElseIf GUICtrlRead ($color1) = "red" Then
        GUICtrlSetData ($color1, "2")
    ElseIf GUICtrlRead ($color1) = "orange" Then
        GUICtrlSetData ($color1, "3")
    ElseIf GUICtrlRead ($color1) = "yellow" Then
        GUICtrlSetData ($color1, "4")
    ElseIf GUICtrlRead ($color1) = "green" Then
        GUICtrlSetData ($color1, "5")
    ElseIf GUICtrlRead ($color1) = "blue" Then
        GUICtrlSetData ($color1, "6")
    ElseIf GUICtrlRead ($color1) = "purple" Then
        GUICtrlSetData ($color1, "7")
    ElseIf GUICtrlRead ($color1) = "grey" Then
        GUICtrlSetData ($color1, "8")
    ElseIf GUICtrlRead ($color1) = "white" Then
        GUICtrlSetData ($color1, "9")
    ElseIf GUICtrlRead ($color1) = "" Then
        GUICtrlSetData ($color1, "No color entered !")
    EndIf

    If GUICtrlRead ($color2) = "black" Then
        GUICtrlSetData ($color2, "0")
    ElseIf GUICtrlRead ($color2) = "brown" Then
        GUICtrlSetData ($color2, "1")
    ElseIf GUICtrlRead ($color2) = "red" Then
        GUICtrlSetData ($color2, "2")
    ElseIf GUICtrlRead ($color2) = "orange" Then
        GUICtrlSetData ($color2, "3")
    ElseIf GUICtrlRead ($color2) = "yellow" Then
        GUICtrlSetData ($color2, "4")
    ElseIf GUICtrlRead ($color2) = "green" Then
        GUICtrlSetData ($color2, "5")
    ElseIf GUICtrlRead ($color2) = "blue" Then
        GUICtrlSetData ($color2, "6")
    ElseIf GUICtrlRead ($color2) = "purple" Then
        GUICtrlSetData ($color2, "7")
    ElseIf GUICtrlRead ($color2) = "grey" Then
        GUICtrlSetData ($color2, "8")
    ElseIf GUICtrlRead ($color2) = "white" Then
        GUICtrlSetData ($color2, "9")
    ElseIf GUICtrlRead ($color2) = "" Then
        GUICtrlSetData ($color2, "No text")
    EndIf
    
    If GUICtrlRead ($color3) = "black" Then
        GUICtrlSetData ($color3, "0")
    ElseIf GUICtrlRead ($color3) = "brown" Then
        GUICtrlSetData ($color3, "1")
    ElseIf GUICtrlRead ($color3) = "red" Then
        GUICtrlSetData ($color3, "2")
    ElseIf GUICtrlRead ($color3) = "orange" Then
        GUICtrlSetData ($color3, "3")
    ElseIf GUICtrlRead ($color3) = "yellow" Then
        GUICtrlSetData ($color3, "4")
    ElseIf GUICtrlRead ($color3) = "green" Then
        GUICtrlSetData ($color3, "5")
    ElseIf GUICtrlRead ($color3) = "blue" Then
        GUICtrlSetData ($color3, "6")
    ElseIf GUICtrlRead ($color3) = "purple" Then
        GUICtrlSetData ($color3, "7")
    ElseIf GUICtrlRead ($color3) = "grey" Then
        GUICtrlSetData ($color3, "8")
    ElseIf GUICtrlRead ($color3) = "white" Then
        GUICtrlSetData ($color3, "9")
    ElseIf GUICtrlRead ($color3) = "" Then
        GUICtrlSetData ($color3, "No text")
    EndIf
    
    If GUICtrlRead ($color4) = "black" Then
        GUICtrlSetData ($color4, "0")
    ElseIf GUICtrlRead ($color4) = "brown" Then
        GUICtrlSetData ($color4, "1")
    ElseIf GUICtrlRead ($color4) = "red" Then
        GUICtrlSetData ($color4, "2")
    ElseIf GUICtrlRead ($color4) = "orange" Then
        GUICtrlSetData ($color4, "3")
    ElseIf GUICtrlRead ($color4) = "yellow" Then
        GUICtrlSetData ($color4, "4")
    ElseIf GUICtrlRead ($color4) = "green" Then
        GUICtrlSetData ($color4, "5")
    ElseIf GUICtrlRead ($color4) = "blue" Then
        GUICtrlSetData ($color4, "6")
    ElseIf GUICtrlRead ($color4) = "purple" Then
        GUICtrlSetData ($color4, "7")
    ElseIf GUICtrlRead ($color4) = "grey" Then
        GUICtrlSetData ($color4, "8")
    ElseIf GUICtrlRead ($color4) = "white" Then
        GUICtrlSetData ($color4, "9")
    ElseIf GUICtrlRead ($color4) = "" Then
        GUICtrlSetData ($color4, "No text")
    EndIf
EndSelect
WEnd

looks like someone is too lazy to search the forum and help file !!!

enjoy

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Link to comment
Share on other sites

#include <GUIConstants.au3>

$Form1 = GUICreate("resistor decoding", 406, 149, 256, 161)
$color1 = GUICtrlCreateInput("color1", 56, 40, 65, 21)
$color2 = GUICtrlCreateInput("color2", 136, 40, 65, 21)
$color3 = GUICtrlCreateInput("color3", 216, 40, 65, 21)
$color4 = GUICtrlCreateInput("color4", 288, 40, 65, 21)
$Label1 = GUICtrlCreateLabel("resistor colors", 168, 16, 68, 17)
$Button1 = GUICtrlCreateButton("decode", 136, 88, 121, 25, 0)
GUISetState(@SW_SHOW)


While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
Exit
Case $nMsg = $Button1
    If GUICtrlRead ($color1) = "black" Then
        GUICtrlSetData ($color1, "0")
    ElseIf GUICtrlRead ($color1) = "brown" Then
        GUICtrlSetData ($color1, "1")
    ElseIf GUICtrlRead ($color1) = "red" Then
        GUICtrlSetData ($color1, "2")
    ElseIf GUICtrlRead ($color1) = "orange" Then
        GUICtrlSetData ($color1, "3")
    ElseIf GUICtrlRead ($color1) = "yellow" Then
        GUICtrlSetData ($color1, "4")
    ElseIf GUICtrlRead ($color1) = "green" Then
        GUICtrlSetData ($color1, "5")
    ElseIf GUICtrlRead ($color1) = "blue" Then
        GUICtrlSetData ($color1, "6")
    ElseIf GUICtrlRead ($color1) = "purple" Then
        GUICtrlSetData ($color1, "7")
    ElseIf GUICtrlRead ($color1) = "grey" Then
        GUICtrlSetData ($color1, "8")
    ElseIf GUICtrlRead ($color1) = "white" Then
        GUICtrlSetData ($color1, "9")
    ElseIf GUICtrlRead ($color1) = "" Then
        GUICtrlSetData ($color1, "No color entered !")
    EndIf

    If GUICtrlRead ($color2) = "black" Then
        GUICtrlSetData ($color2, "0")
    ElseIf GUICtrlRead ($color2) = "brown" Then
        GUICtrlSetData ($color2, "1")
    ElseIf GUICtrlRead ($color2) = "red" Then
        GUICtrlSetData ($color2, "2")
    ElseIf GUICtrlRead ($color2) = "orange" Then
        GUICtrlSetData ($color2, "3")
    ElseIf GUICtrlRead ($color2) = "yellow" Then
        GUICtrlSetData ($color2, "4")
    ElseIf GUICtrlRead ($color2) = "green" Then
        GUICtrlSetData ($color2, "5")
    ElseIf GUICtrlRead ($color2) = "blue" Then
        GUICtrlSetData ($color2, "6")
    ElseIf GUICtrlRead ($color2) = "purple" Then
        GUICtrlSetData ($color2, "7")
    ElseIf GUICtrlRead ($color2) = "grey" Then
        GUICtrlSetData ($color2, "8")
    ElseIf GUICtrlRead ($color2) = "white" Then
        GUICtrlSetData ($color2, "9")
    ElseIf GUICtrlRead ($color2) = "" Then
        GUICtrlSetData ($color2, "No text")
    EndIf
    
    If GUICtrlRead ($color3) = "black" Then
        GUICtrlSetData ($color3, "0")
    ElseIf GUICtrlRead ($color3) = "brown" Then
        GUICtrlSetData ($color3, "1")
    ElseIf GUICtrlRead ($color3) = "red" Then
        GUICtrlSetData ($color3, "2")
    ElseIf GUICtrlRead ($color3) = "orange" Then
        GUICtrlSetData ($color3, "3")
    ElseIf GUICtrlRead ($color3) = "yellow" Then
        GUICtrlSetData ($color3, "4")
    ElseIf GUICtrlRead ($color3) = "green" Then
        GUICtrlSetData ($color3, "5")
    ElseIf GUICtrlRead ($color3) = "blue" Then
        GUICtrlSetData ($color3, "6")
    ElseIf GUICtrlRead ($color3) = "purple" Then
        GUICtrlSetData ($color3, "7")
    ElseIf GUICtrlRead ($color3) = "grey" Then
        GUICtrlSetData ($color3, "8")
    ElseIf GUICtrlRead ($color3) = "white" Then
        GUICtrlSetData ($color3, "9")
    ElseIf GUICtrlRead ($color3) = "" Then
        GUICtrlSetData ($color3, "No text")
    EndIf
    
    If GUICtrlRead ($color4) = "black" Then
        GUICtrlSetData ($color4, "0")
    ElseIf GUICtrlRead ($color4) = "brown" Then
        GUICtrlSetData ($color4, "1")
    ElseIf GUICtrlRead ($color4) = "red" Then
        GUICtrlSetData ($color4, "2")
    ElseIf GUICtrlRead ($color4) = "orange" Then
        GUICtrlSetData ($color4, "3")
    ElseIf GUICtrlRead ($color4) = "yellow" Then
        GUICtrlSetData ($color4, "4")
    ElseIf GUICtrlRead ($color4) = "green" Then
        GUICtrlSetData ($color4, "5")
    ElseIf GUICtrlRead ($color4) = "blue" Then
        GUICtrlSetData ($color4, "6")
    ElseIf GUICtrlRead ($color4) = "purple" Then
        GUICtrlSetData ($color4, "7")
    ElseIf GUICtrlRead ($color4) = "grey" Then
        GUICtrlSetData ($color4, "8")
    ElseIf GUICtrlRead ($color4) = "white" Then
        GUICtrlSetData ($color4, "9")
    ElseIf GUICtrlRead ($color4) = "" Then
        GUICtrlSetData ($color4, "No text")
    EndIf
EndSelect
WEnd

looks like someone is too lazy to search the forum and help file !!!

enjoy

lol i did search but didint know wat to search exactly i was about to start thinking along the line of if ok now ill see if ur code works

cheers C.W

C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake

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...