Jump to content

Abit over my head with GUI


Recommended Posts

I have abit of a problem with coding the GUI.

the other scripts that read the INI file are already done and work correctly when reading values from ini file

The TreeView and the other functions collide when trying to write to an ini file.

Problems with the GUI are as follows:

1. The functions are in conflict with writing to ini

2. Binding slider controls to write values to ini file. as they are now at the moment they do nothing more than display the value at the label and that is in conflict aswell.

3. Let the checkbox "Apply lure" present either 1 (for checked) and 0 (for unchecked). this has been a real problem for me since it either present value 4 or 0 and it is very random without any logic at all.

that code is deleted since I do not master it. but the placement is still there for when it will work

4. Let the "Go Fish! button start another script (FishItDay.au3 resp. FishItMoon.au3)

;FishIt
; My Very First GUI so be gentle
; PrinsBertil aka KungCarlXVI
; 
#include <GuiConstants.au3>
#include <Constants.au3>
#include <GuiTreeView.au3>

Opt("GUIOnEventMode", 1)

Global $INIFile = @ScriptDir & "\Settings.ini"
Global $ColorDay = StringSplit("Alterac Mountains (130),0xC49D72,0x48567D,0xA6361E|" & _
                                "Arathi Highlands (130),0x97644F,0x393045,0x8B2920|" & _
                                "Burning Steppes (330),0xB1925C,0x3A373E,0xAB3A1C|" & _
                                "Deadwind Pass (330),0x4C4D47,0x273244,0x43211F|" & _
                                "Dun Morogh (1),0x5A5F58,0x2D365D,0x522619|" & _
                                "Duskwood (55),0x705F4D,0x2F2148,0x6E2215|" & _
                                "Eastern Plaguelands (330),0xA76F25,0x55442A,0x923111|" & _
                                "Elwynn Forest (1),0xA96540,0x4A3242,0x8E280F|" & _
                                "Eversong Woods (20),0xAD5C2D,0x2C1D22,0xA82209|" & _
                                "Ghostlands (20),0xBE9C52,0x2E393F,0xA33E14|" & _
                                "Hillsbrad Foothills (55),0xB29C6B,0x404D6D,0x953423|" & _
                                "Isle of Quel'Danas (380),0xB0965B,0x52546B,0xB53512|" & _
                                "Loch Modan (20),0xBC997B,0x4F5379,0xA43D1E|" & _
                                "Redridge Mountains (55),0xBBA349,0x584936,0x98370A|" & _
                                "Silverpine Forest (20),0xBFA27A,0x3D3358,0x942D1C|" & _
                                "Stranglethorn Vale (130),0xCBA042,0x3D3824,0xA53D1A|" & _
                                "Swamp of sorrows (130),0xA98237,0x48422C,0xA13216|" & _
                                "The Hinterlands (205),0xBC9B3E,0x3A3B29,0xB02E0A|" & _
                                "Tirisfal Glades (1),0x645252,0x1D1E3D,0x4E180E|" & _
                                "Western Plaguelands (205),0xB98E30,0x58502C,0xA63517|" & _
                                "Westfall (55),0xBD9E6F,0x444750,0xA9321E|" & _
                                "Wetlands (55),0xAD8F77,0x4D4A67,0x9D422D|" & _
                                "Ashenvale (55),0xB2947C,0x43486E,0xB53C1F|" & _
                                "Azshara (205),0x9F7052,0x3E3D4B,0x9A2919|" & _
                                "Azuremyst Isle (20),0x555249,0x2D3C63,0x6E2419|" & _
                                "Bloodmyst Isle (1),0xB19B6A,0x535472,0x992A0F|" & _
                                "Darkshore (20),0xBB9D77,0x55587B,0xA0331E|" & _
                                "Desolace (130),0xA67149,0x553648,0x952412|" & _
                                "Durotar (1),0xBD9480,0x52557E,0xA6391A|" & _
                                "Dustwallow Marsh (130),0xB49882,0x514E61,0x97291A|" & _
                                "Felwood (205),0x877630,0x2E361E,0x571E0B|" & _
                                "Feralas (205),0x596C35,0x263C39,0x492914|" & _
                                "Moonglade (205),0x028068,0x004265,0x003522|" & _
                                "Mulgore (1),0xBF9E73,0x4B4E81,0x9D322A|" & _
                                "Stonetalon Mountain (55),0xBD9E43,0x4F4B40,0x9C3D11|" & _
                                "Tanaris (205),0x8B724A,0x343549,0x73261C|" & _
                                "Teldrassil (1),0xC09978,0x585475,0xAB3527|" & _
                                "The Barrens (20),0x807849,0x2A4D46,0x783111|" & _
                                "Thousand Needles (130),0xB49870,0x4F4D75,0x953411|" & _
                                "Un'Goro Crater (205),0xB89E7B,0x464B69,0xB84129|" & _
                                "Winterspring (330),0x5A514A,0x393A4C,0x4C2D28|" & _
                                "Hellfire (280),0x8A7548,0x3E4148,0x6F311C|" & _
                                "Nagrand (380),0xAB8560,0x474C72,0xA53B11|" & _
                                "Netherstorm (380),0x7A4F62,0x3D2E73,0x7D221D|" & _
                                "Shadowmoon Valley (?),0xB99877,0x443F67,0xA13415|" & _
                                "Terokkar Forest (355),0xB39070,0x60547C,0xB73418|" & _
                                "Zangramarsh (305),0x424A55,0x202856,0x481C1D", "|")


Global $ColorMoon = StringSplit("Alterac Mountains (130),0x50412E,0x25252F,0x4F1B10|" & _
                                "Arathi Highlands (130),0x495257,0x21345C,0x33241D|" & _
                                "Burning Steppes (330),0xB3935A,0x5F5764,0x8E3316|" & _
                                "Deadwind Pass (330),0x474A43,0x233040,0x422424|" & _
                                "Dun Morogh (1),0x264444,0x071D42,0x241613|" & _
                                "Duskwood (55),0x374F51,0x182A52,0x31190F|" & _
                                "Eastern Plaguelands (330),0x7A5528,0x312E1D,0x6B240E|" & _
                                "Elwynn Forest (1),0x374949,0x1A2448,0x341C18|" & _
                                "Eversong Woods (20),0x4A4D60,0x1C2357,0x461C1E|" & _
                                "Ghostlands (20),0xAB8E62,0x524E6F,0xA53C1F|" & _
                                "Hillsbrad Foothills (55),0x9E7D5A,0x3D3B53,0x802B0C|" & _
                                "Isle of Quel'Danas (380),0x3E4557,0x111A45,0x35130A|" & _
                                "Loch Modan (20),0xB79A7C,0x4C597B,0x913E1C|" & _
                                "Redridge Mountains (55),0xA19170,0x3F4867,0x983812|" & _
                                "Silverpine Forest (20),0xB79379,0x443B6A,0x782A14|" & _
                                "Stranglethorn Vale (130),0x719267,0x3D4B66,0x902C15|" & _
                                "Swamp of sorrows (130),0xAE9350,0x3F4553,0x7B200E|" & _
                                "The Hinterlands (205),0x9D8E6F,0x374369,0x812727|" & _
                                "Tirisfal Glades (1),0x8E8B6A,0x2F4167,0x60260E|" & _
                                "Western Plaguelands (205),0x9F742F,0x37332A,0x6B1B02|" & _
                                "Westfall (55),0xA28E73,0x324458,0x6E290C|" & _
                                "Wetlands (55),0x7D706A,0x3D4760,0x7E3A2F|" & _
                                "Ashenvale (55),0x8A7759,0x3E344D,0x96301A|" & _
                                "Azshara (205),0x6B4C4A,0x2A2647,0x611E15|" & _
                                "Azuremyst Isle (20),0x4F5B57,0x293660,0x502419|" & _
                                "Bloodmyst Isle (1),0xBFA37E,0x3B314C,0xB73B19|" & _
                                "Darkshore (20),0xB79973,0x465782,0xB13929|" & _
                                "Desolace (130),0xBBA082,0x4C486D,0x953302|" & _
                                "Durotar (1),0xBD9480,0x5F5780,0x932D14|" & _
                                "Dustwallow Marsh (130),0xAB8F6A,0x59506B,0x9C332F|" & _
                                "Felwood (205),0x6D7127,0x192A1A,0x4D2001|" & _
                                "Feralas (205),0x425F33,0x1C2B30,0x3A1F0E|" & _
                                "Moonglade (205),0x006852,0x05375A,0x04251A|" & _
                                "Mulgore (1),0xBBA082,0x605482,0xA72C1A|" & _
                                "Stonetalon Mountain (55),0xC19D83,0x454A6A,0xA23123|" & _
                                "Tanaris (205),0xA9916F,0x525679,0x9F3E1E|" & _
                                "Teldrassil (1),0x786A79,0x34397D,0x632526|" & _
                                "The Barrens (20),0xAF977B,0x52547B,0x8C3218|" & _
                                "Thousand Needles (130),0xA79273,0x48557F,0x8E3C31|" & _
                                "Un'Goro Crater (205),0xB29472,0x545D7C,0x7D272A|" & _
                                "Winterspring (330),0x484D47,0x253255,0x542008|" & _
                                "Hellfire (280),0x7E7443,0x3E4243,0x752E12|" & _
                                "Nagrand (380),0xAB9C71,0x3C5277,0x92360D|" & _
                                "Netherstorm (380),0x84546A,0x3A3168,0x731F1F|" & _
                                "Shadowmoon Valley (?),0xA0845D,0x594F74,0x983D1E|" & _
                                "Terokkar Forest (355),0xAC926D,0x555988,0xA73721|" & _
                                "Zangramarsh (305),0x44505E,0x1E2D68,0x442218", "|")
; GUI
    $MyGUI = GuiCreate("FishIt", 480, 500, -1, -1)
    GUISetOnEvent($GUI_EVENT_CLOSE, "EventDay", $MyGUI)
    GUISetOnEvent($GUI_EVENT_CLOSE, "EventMoon", $MyGUI)
    GuiSetIcon(@SystemDir & "\mspaint.exe", 0)
    $title = "FishIt"
    
; INPUT

    if FileExists($INIFile) Then
        $CatchAmountDay = IniRead ($INIFile, "CatchAmount", "CatchAmountDay", "100")
        $LatencyDay = IniRead ($INIFile, "Latency", "LatencyDay", "100")
        $ResolutionXDay = IniRead ($INIFile, "Resolution", "ResolutionXDay", "800")
        $ResolutionYDay = IniRead ($INIFile, "Resolution", "ResolutionYDay", "600")
        $PoleDay = IniRead ($INIFile, "Pole", "PoleDay", "1") 
        $LureDay = IniRead ($INIFile, "Lure", "LureDay", "2") 


        $CatchAmountMoon = IniRead ($INIFile, "CatchAmount", "CatchAmountMoon", "100")
        $LatencyMoon = IniRead ($INIFile, "Latency", "LatencyMoon", "100")
        $ResolutionXMoon = IniRead ($INIFile, "Resolution", "ResolutionXMoon", "800")
        $ResolutionYMoon = IniRead ($INIFile, "Resolution", "ResolutionYMoon", "600")
        $PoleMoon = IniRead ($INIFile, "Pole", "PoleMoon", "1")
        $LureMoon = IniRead ($INIFile, "Lure", "LureMoon", "2") 


    Else
        $CatchAmountDay = "100"
        $LatencyDay = "100"
        $ResolutionXDay = "800"
        $ResolutionYDay = "600"
        $PoleDay = "1"
        $LureDay = "2"
        
        $CatchAmountMoon = "100"
        $LatencyMoon = "100"
        $ResolutionXMoon = "800"
        $ResolutionYMoon = "600"
        $PoleMoon = "1"
        $LureMoon = "1"
    EndIf

    $SplashTolerance = IniRead ($INIFile, "Splash", "SplashTolerance", "20") 
    $SplashPixelSearch = IniRead ($INIFile, "Splash", "SplashPixelSearch", "1") 
    $BobberSearchTolerance = IniRead ($INIFile, "Bobber","BobberSearchTolerance", "20") 
    $BobberPixelSearch = IniRead ($INIFile, "Bobber","BobberPixelSearch", "2") 


; ENDIT

HotKeySet("{Pause}", "ExitScript")

Func ExitScript()
    Exit
EndFunc

; TAB
    GuiCtrlCreateTab(0, 0, 480, 500)
    GuiCtrlCreateTabItem("Daylight")
    GuiCtrlCreateLabel("Place (Skill) ", 40, 40)
    
; TREEVIEW DAYLIGHT
    $PlacesDay = GuiCtrlCreateTreeView(20, 60, 220, 420,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS),$WS_EX_CLIENTEDGE)


    $EasternKingdoms = GuiCtrlCreateTreeViewItem("Eastern Kingdoms", $PlacesDay)
        $AlteracMountains = GuiCtrlCreateTreeViewItem("Alterac Mountains (130)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $AlteracMountains)
            GuiCtrlCreateTreeViewItem("Blue Feather", $AlteracMountains)
            GuiCtrlCreateTreeViewItem("Red Feather", $AlteracMountains)

        $ArathiHighlands = GuiCtrlCreateTreeViewItem("Arathi Highlands (130)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $ArathiHighlands)
            GuiCtrlCreateTreeViewItem("Blue Feather", $ArathiHighlands)
            GuiCtrlCreateTreeViewItem("Red Feather", $ArathiHighlands)

        $BurningSteppes = GuiCtrlCreateTreeViewItem("Burning Steppes (330)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $BurningSteppes)
            GuiCtrlCreateTreeViewItem("Blue Feather", $BurningSteppes)
            GuiCtrlCreateTreeViewItem("Red Feather", $BurningSteppes)

        $DeadwindPass = GuiCtrlCreateTreeViewItem("Deadwind Pass (330)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $DeadwindPass)
            GuiCtrlCreateTreeViewItem("Blue Feather", $DeadwindPass)
            GuiCtrlCreateTreeViewItem("Red Feather", $DeadwindPass)

        $DunMorogh = GuiCtrlCreateTreeViewItem("Dun Morogh (1)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $DunMorogh)
            GuiCtrlCreateTreeViewItem("Blue Feather", $DunMorogh)
            GuiCtrlCreateTreeViewItem("Red Feather", $DunMorogh)

        $Duskwood = GuiCtrlCreateTreeViewItem("Duskwood (55)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $Duskwood)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Duskwood)
            GuiCtrlCreateTreeViewItem("Red Feather", $Duskwood)

        $EasternPlaguelands = GuiCtrlCreateTreeViewItem("Eastern Plaguelands (330)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $EasternPlaguelands)
            GuiCtrlCreateTreeViewItem("Blue Feather", $EasternPlaguelands)
            GuiCtrlCreateTreeViewItem("Red Feather", $EasternPlaguelands)

        $ElwynnForest = GuiCtrlCreateTreeViewItem("Elwynn Forest (1)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $ElwynnForest)
            GuiCtrlCreateTreeViewItem("Blue Feather", $ElwynnForest)
            GuiCtrlCreateTreeViewItem("Red Feather", $ElwynnForest)

        $EversongWoods = GuiCtrlCreateTreeViewItem("Eversong Woods (20)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $EversongWoods)
            GuiCtrlCreateTreeViewItem("Blue Feather", $EversongWoods)
            GuiCtrlCreateTreeViewItem("Red Feather", $EversongWoods)

        $Ghostlands = GuiCtrlCreateTreeViewItem("Ghostlands (20)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $Ghostlands)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Ghostlands)
            GuiCtrlCreateTreeViewItem("Red Feather", $Ghostlands)

        $HillsbradFoothills = GuiCtrlCreateTreeViewItem("Hillsbrad Foothills (55)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $HillsbradFoothills)
            GuiCtrlCreateTreeViewItem("Blue Feather", $HillsbradFoothills)
            GuiCtrlCreateTreeViewItem("Red Feather", $HillsbradFoothills)

        $IsleofQuelDanas = GuiCtrlCreateTreeViewItem("Isle of Quel'Danas (380)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $IsleofQuelDanas)
            GuiCtrlCreateTreeViewItem("Blue Feather", $IsleofQuelDanas)
            GuiCtrlCreateTreeViewItem("Red Feather", $IsleofQuelDanas)

        $LochModan = GuiCtrlCreateTreeViewItem("Loch Modan (20)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $LochModan)
            GuiCtrlCreateTreeViewItem("Blue Feather", $LochModan)
            GuiCtrlCreateTreeViewItem("Red Feather", $LochModan)

        $RedridgeMountains = GuiCtrlCreateTreeViewItem("Redridge Mountains (55)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $RedridgeMountains)
            GuiCtrlCreateTreeViewItem("Blue Feather", $RedridgeMountains)
            GuiCtrlCreateTreeViewItem("Red Feather", $RedridgeMountains)

        $SilverpineForest = GuiCtrlCreateTreeViewItem("Silverpine Forest (20)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $SilverpineForest)
            GuiCtrlCreateTreeViewItem("Blue Feather", $SilverpineForest)
            GuiCtrlCreateTreeViewItem("Red Feather", $SilverpineForest)

        $StranglethornVale = GuiCtrlCreateTreeViewItem("Stranglethorn Vale (130)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $StranglethornVale)
            GuiCtrlCreateTreeViewItem("Blue Feather", $StranglethornVale)
            GuiCtrlCreateTreeViewItem("Red Feather", $StranglethornVale)

        $Swampofsorrows = GuiCtrlCreateTreeViewItem("Swamp of sorrows (130)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $Swampofsorrows)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Swampofsorrows)
            GuiCtrlCreateTreeViewItem("Red Feather", $Swampofsorrows)

        $TheHinterlands = GuiCtrlCreateTreeViewItem("The Hinterlands (205)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $TheHinterlands)
            GuiCtrlCreateTreeViewItem("Blue Feather", $TheHinterlands)
            GuiCtrlCreateTreeViewItem("Red Feather", $TheHinterlands)

        $TirisfalGlades = GuiCtrlCreateTreeViewItem("Tirisfal Glades (1)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $TirisfalGlades)
            GuiCtrlCreateTreeViewItem("Blue Feather", $TirisfalGlades)
            GuiCtrlCreateTreeViewItem("Red Feather", $TirisfalGlades)

        $WesternPlaguelands = GuiCtrlCreateTreeViewItem("Western Plaguelands (205)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $WesternPlaguelands)
            GuiCtrlCreateTreeViewItem("Blue Feather", $WesternPlaguelands)
            GuiCtrlCreateTreeViewItem("Red Feather", $WesternPlaguelands)

        $Westfall = GuiCtrlCreateTreeViewItem("Westfall (55)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $Westfall)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Westfall)
            GuiCtrlCreateTreeViewItem("Red Feather", $Westfall)

        $Wetlands = GuiCtrlCreateTreeViewItem("Wetlands (55)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $Wetlands)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Wetlands)
            GuiCtrlCreateTreeViewItem("Red Feather", $Wetlands)



    $Kalimdor = GuiCtrlCreateTreeViewItem("Kalimdor", $PlacesDay)
        $Ashenvale = GuiCtrlCreateTreeViewItem("Ashenvale (55)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Ashenvale)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Ashenvale)
            GuiCtrlCreateTreeViewItem("Red Feather", $Ashenvale)

        $Azshara = GuiCtrlCreateTreeViewItem("Azshara (205)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Azshara)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Azshara)
            GuiCtrlCreateTreeViewItem("Red Feather", $Azshara)

        $AzuremystIsle = GuiCtrlCreateTreeViewItem("Azuremyst Isle (20)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $AzuremystIsle)
            GuiCtrlCreateTreeViewItem("Blue Feather", $AzuremystIsle)
            GuiCtrlCreateTreeViewItem("Red Feather", $AzuremystIsle)

        $BloodmystIsle = GuiCtrlCreateTreeViewItem("Bloodmyst Isle (1)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $BloodmystIsle)
            GuiCtrlCreateTreeViewItem("Blue Feather", $BloodmystIsle)
            GuiCtrlCreateTreeViewItem("Red Feather", $BloodmystIsle)

        $Darkshore = GuiCtrlCreateTreeViewItem("Darkshore (20)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Darkshore)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Darkshore)
            GuiCtrlCreateTreeViewItem("Red Feather", $Darkshore)

        $Desolace = GuiCtrlCreateTreeViewItem("Desolace (130)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Desolace)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Desolace)
            GuiCtrlCreateTreeViewItem("Red Feather", $Desolace)

        $Durotar = GuiCtrlCreateTreeViewItem("Durotar (1)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Durotar)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Durotar)
            GuiCtrlCreateTreeViewItem("Red Feather", $Durotar)

        $DustwallowMarsh = GuiCtrlCreateTreeViewItem("Dustwallow Marsh (130)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $DustwallowMarsh)
            GuiCtrlCreateTreeViewItem("Blue Feather", $DustwallowMarsh)
            GuiCtrlCreateTreeViewItem("Red Feather", $DustwallowMarsh)

        $Felwood = GuiCtrlCreateTreeViewItem("Felwood (205)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Felwood)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Felwood)
            GuiCtrlCreateTreeViewItem("Red Feather", $Felwood)

        $Feralas = GuiCtrlCreateTreeViewItem("Feralas (205)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Feralas)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Feralas)
            GuiCtrlCreateTreeViewItem("Red Feather", $Feralas)

        $Moonglade = GuiCtrlCreateTreeViewItem("Moonglade (205)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Moonglade)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Moonglade)
            GuiCtrlCreateTreeViewItem("Red Feather", $Moonglade)

        $Mulgore = GuiCtrlCreateTreeViewItem("Mulgore (1)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Mulgore)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Mulgore)
            GuiCtrlCreateTreeViewItem("Red Feather", $Mulgore)

        $StonetalonMountain = GuiCtrlCreateTreeViewItem("Stonetalon Mountain (55)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $StonetalonMountain)
            GuiCtrlCreateTreeViewItem("Blue Feather", $StonetalonMountain)
            GuiCtrlCreateTreeViewItem("Red Feather", $StonetalonMountain)

        $Tanaris = GuiCtrlCreateTreeViewItem("Tanaris (205)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Tanaris)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Tanaris)
            GuiCtrlCreateTreeViewItem("Red Feather", $Tanaris)

        $Teldrassil = GuiCtrlCreateTreeViewItem("Teldrassil (1)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Teldrassil)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Teldrassil)
            GuiCtrlCreateTreeViewItem("Red Feather", $Teldrassil)

        $TheBarrens = GuiCtrlCreateTreeViewItem("The Barrens (20)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $TheBarrens)
            GuiCtrlCreateTreeViewItem("Blue Feather", $TheBarrens)
            GuiCtrlCreateTreeViewItem("Red Feather", $TheBarrens)

        $ThousandNeedles = GuiCtrlCreateTreeViewItem("Thousand Needles (130)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $ThousandNeedles)
            GuiCtrlCreateTreeViewItem("Blue Feather", $ThousandNeedles)
            GuiCtrlCreateTreeViewItem("Red Feather", $ThousandNeedles)

        $UnGoroCrater = GuiCtrlCreateTreeViewItem("Un'Goro Crater (205)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $UnGoroCrater)
            GuiCtrlCreateTreeViewItem("Blue Feather", $UnGoroCrater)
            GuiCtrlCreateTreeViewItem("Red Feather", $UnGoroCrater)

        $Winterspring = GuiCtrlCreateTreeViewItem("Winterspring (330)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Winterspring)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Winterspring)
            GuiCtrlCreateTreeViewItem("Red Feather", $Winterspring)



    $Outland = GuiCtrlCreateTreeViewItem("Outland", $PlacesDay)
        $Hellfire = GuiCtrlCreateTreeViewItem("Hellfire (280)", $Outland)
            GuiCtrlCreateTreeViewItem("Bobber", $Hellfire)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Hellfire)
            GuiCtrlCreateTreeViewItem("Red Feather", $Hellfire)

        $Nagrand = GuiCtrlCreateTreeViewItem("Nagrand (380)", $Outland)
            GuiCtrlCreateTreeViewItem("Bobber", $Nagrand)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Nagrand)
            GuiCtrlCreateTreeViewItem("Red Feather", $Nagrand)
            
        $ShadowmoonValley = GuiCtrlCreateTreeViewItem("Shadowmoon Valley (?)", $Outland)
            GuiCtrlCreateTreeViewItem("Bobber", $ShadowmoonValley)
            GuiCtrlCreateTreeViewItem("Blue Feather", $ShadowmoonValley)
            GuiCtrlCreateTreeViewItem("Red Feather", $ShadowmoonValley)

        $Netherstorm = GuiCtrlCreateTreeViewItem("Netherstorm (380)", $Outland)
            GuiCtrlCreateTreeViewItem("Bobber", $Netherstorm)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Netherstorm)
            GuiCtrlCreateTreeViewItem("Red Feather", $Netherstorm)

        $TerokkarForest = GuiCtrlCreateTreeViewItem("Terokkar Forest (355)", $Outland)
            GuiCtrlCreateTreeViewItem("Bobber", $TerokkarForest)
            GuiCtrlCreateTreeViewItem("Blue Feather", $TerokkarForest)
            GuiCtrlCreateTreeViewItem("Red Feather", $TerokkarForest)

        $Zangramarsh = GuiCtrlCreateTreeViewItem("Zangramarsh (305)", $Outland)
            GuiCtrlCreateTreeViewItem("Bobber", $Zangramarsh)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Zangramarsh)
            GuiCtrlCreateTreeViewItem("Red Feather", $Zangramarsh)



    $Cities = GuiCtrlCreateTreeViewItem("Cities", $PlacesDay)
        $Darnassus = GuiCtrlCreateTreeViewItem("Darnassus (1)", $Cities)
            GuiCtrlCreateTreeViewItem("Bobber", $Darnassus)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Darnassus)
            GuiCtrlCreateTreeViewItem("Red Feather", $Darnassus)

        $Ironforge = GuiCtrlCreateTreeViewItem("Ironforge (1)", $Cities)
            GuiCtrlCreateTreeViewItem("Bobber", $Ironforge)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Ironforge)
            GuiCtrlCreateTreeViewItem("Red Feather", $Ironforge)

        $Orgrimmar = GuiCtrlCreateTreeViewItem("Orgrimmar (1)", $Cities)
            GuiCtrlCreateTreeViewItem("Bobber", $Orgrimmar)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Orgrimmar)
            GuiCtrlCreateTreeViewItem("Red Feather", $Orgrimmar)

        $Silvermoon = GuiCtrlCreateTreeViewItem("Silvermoon (1)", $Cities)
            GuiCtrlCreateTreeViewItem("Bobber", $Silvermoon)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Silvermoon)
            GuiCtrlCreateTreeViewItem("Red Feather", $Silvermoon)

        $Stormwind = GuiCtrlCreateTreeViewItem("Stormwind (1)", $Cities)
            GuiCtrlCreateTreeViewItem("Bobber", $Stormwind)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Stormwind)
            GuiCtrlCreateTreeViewItem("Red Feather", $Stormwind)

        $ThunderBluff = GuiCtrlCreateTreeViewItem("Thunder Bluff (1)", $Cities)
            GuiCtrlCreateTreeViewItem("Bobber", $ThunderBluff)
            GuiCtrlCreateTreeViewItem("Blue Feather", $ThunderBluff)
            GuiCtrlCreateTreeViewItem("Red Feather", $ThunderBluff)


    $Instances = GuiCtrlCreateTreeViewItem("Instances", $PlacesDay)
        $somewhere = GuiCtrlCreateTreeViewItem("somewhere", $Instances)
            GuiCtrlCreateTreeViewItem("Bobber", $somewhere)
            GuiCtrlCreateTreeViewItem("Blue Feather", $somewhere)
            GuiCtrlCreateTreeViewItem("Red Feather", $somewhere)


    $UserColor = GuiCtrlCreateTreeViewItem("User Color", $PlacesDay)
        GuiCtrlCreateTreeViewItem("Bobber", $UserColor)
        GuiCtrlCreateTreeViewItem("Blue Feather", $UserColor)
        GuiCtrlCreateTreeViewItem("Red Feather", $UserColor)
    $DummyDay = GUICtrlCreateDummy()

For $ListDay = $PlacesDay To $DummyDay
    GUICtrlSetOnEvent($ListDay, "EventDay")
Next   

$BobberColorDay = GuiCtrlCreateLabel("", 420, 60, 40, 40,-1,$WS_EX_CLIENTEDGE)


Func EventDay()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            Switch GUICtrlRead(@GUI_CtrlId, 1)
                Case "Bobber"
                    GUICtrlSetBkColor($BobberColorDay, FindColorDay(@GUI_CtrlId, 1))
                Case "Blue Feather"
                    GUICtrlSetBkColor($BobberColorDay, FindColorDay(@GUI_CtrlId, 2))
                Case "Red Feather"
                    GUICtrlSetBkColor($BobberColorDay, FindColorDay(@GUI_CtrlId, 3))
                Case Else
                    GUICtrlSetBkColor($BobberColorDay, 0xFFFF00)
            EndSwitch
    EndSwitch     
EndFunc

Func FindColorDay($cID, $LGD)
    For $ListDay = 1 To $ColorDay[0]
        If StringInStr($ColorDay[$ListDay], GUICtrlRead(_GUICtrlTreeView_GetParentParam($PlacesDay, $cID),1)) Then
            Local $SSC = StringSplit($ColorDay[$ListDay], ",")
            IniWrite($INIFile, "ColorChoice", "ColorBobberDay", $SSC[$LGD + 1])
            Return $SSC[$LGD + 1]
        EndIf   
    Next
EndFunc

; SLIDER

;BOBBER SLIDER

; LABEL
        
        GuiCtrlCreateLabel("Bobber", 260, 60)
        $BobberDayVariation_Label = GUICtrlCreateLabel("Variation (Contrast) ", 260, 80, 200)
        $BobberDayVariation_Slider = GUICtrlCreateSlider(260, 100, 200, 30)
        GuiCtrlSetLimit ($BobberDayVariation_Slider, 30, 1)
        GuiCtrlSetData($BobberDayVariation_Slider, 20)

        $BobberDayPixel_Label = GUICtrlCreateLabel("Pixel Search ", 260, 140, 200)
        $BobberDayPixel_Slider = GUICtrlCreateSlider(260, 160, 200, 30)
        GUICtrlSetLimit($BobberDayPixel_Slider, 5, 1)
        GuiCtrlSetData($BobberDayPixel_Slider, 3)

;SPLASH SLIDER

    $SplashColorDay = GuiCtrlCreateLabel("", 420, 220, 40, 40,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS),$WS_EX_CLIENTEDGE)
    GuiCtrlSetBkColor($SplashColorDay, 0xF6F6F6)

; LABEL

        GuiCtrlCreateLabel("Splash", 260, 220)
        $SplashDayVariation_Label = GUICtrlCreateLabel("Variation (Contrast) ", 260, 240, 200)
        $SplashDayVariation_Slider = GUICtrlCreateSlider(260, 260, 200, 30)
        GuiCtrlSetLimit ($SplashDayVariation_Slider, 30, 1)
        GuiCtrlSetData($SplashDayVariation_Slider, 30)

        $SplashDayPixel_Label = GUICtrlCreateLabel("Pixel Search ", 260, 300, 200)
        $SplashDayPixel_Slider = GUICtrlCreateSlider(260, 320, 200, 30)
        GUICtrlSetLimit($SplashDayPixel_Slider, 5, 1)
        GuiCtrlSetData($SplashDayPixel_Slider, 3)



; INPUT
; Build Controls

    GuiCtrlCreateLabel("Fishes", 260, 365)
    $CatchAmountDayChange = GUICtrlCreateInput("", 260, 380, 40, 20)
    GUICtrlSetLimit($CatchAmountDayChange, 3)

    GuiCtrlCreateLabel("Latency", 260, 405)
    $LatencyDayChange = GuiCtrlCreateInput("", 260, 420, 40, 20)
    GUICtrlSetLimit($LatencyDayChange,4)

    GuiCtrlCreateLabel("Resolution", 260, 445)
    $ResolutionXDayChange = GuiCtrlCreateInput("", 260, 460, 40, 20)
    GUICtrlSetLimit($ResolutionXDayChange,4)

    GuiCtrlCreateLabel("X", 302, 463)
    $ResolutionYDayChange  = GuiCtrlCreateInput("", 310, 460, 40, 20)
    GUICtrlSetLimit($ResolutionYDayChange,4)

    $PoleDayChange = GuiCtrlCreateInput("", 380, 385, 13, 16)
    GUICtrlSetLimit($PoleDayChange ,1)
    GuiCtrlCreateLabel("Pole", 395, 385)
    
    $LureDayChange = GuiCtrlCreateInput("", 380, 410, 13, 16)
    GUICtrlSetLimit($LureDayChange ,1)
    GuiCtrlCreateLabel("Lure", 395, 410)

; CHECKBOX
    GuiCtrlCreateCheckbox("Apply Lure?", 380, 430, 80, 20)
    GuiCtrlSetState(-1, 1)

; Set Control Data
    GUICtrlSetData($CatchAmountDayChange, $CatchAmountDay)
    guictrlsetdata($LatencyDayChange, $LatencyDay)
    guictrlsetdata($ResolutionXDayChange, $ResolutionXDay)
    guictrlsetdata($ResolutionYDayChange, $ResolutionYDay)
    guictrlsetdata($PoleDayChange, $PoleDay)
    guictrlsetdata($LureDayChange, $LureDay)

; BUTTON
    $ChangeData = GuiCtrlCreateButton("Go Fish!", 380, 460, 80, 30)





;MOONLIGHT TAB
    GuiCtrlCreateTabItem("Moonlight")
    GuiCtrlCreateLabel("Place (Skill) ", 40, 40)
    
; TREEVIEW MOONLIGHT
    $PlacesMoon = GuiCtrlCreateTreeView(20, 60, 220,        420,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS),$WS_EX_CLIENTEDGE)


    $EasternKingdoms = GuiCtrlCreateTreeViewItem("Eastern Kingdoms", $PlacesMoon)
        $AlteracMountains = GuiCtrlCreateTreeViewItem("Alterac Mountains (130)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $AlteracMountains)
            GuiCtrlCreateTreeViewItem("Blue Feather", $AlteracMountains)
            GuiCtrlCreateTreeViewItem("Red Feather", $AlteracMountains)

        $ArathiHighlands = GuiCtrlCreateTreeViewItem("Arathi Highlands (130)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $ArathiHighlands)
            GuiCtrlCreateTreeViewItem("Blue Feather", $ArathiHighlands)
            GuiCtrlCreateTreeViewItem("Red Feather", $ArathiHighlands)

        $BurningSteppes = GuiCtrlCreateTreeViewItem("Burning Steppes (330)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $BurningSteppes)
            GuiCtrlCreateTreeViewItem("Blue Feather", $BurningSteppes)
            GuiCtrlCreateTreeViewItem("Red Feather", $BurningSteppes)

        $DeadwindPass = GuiCtrlCreateTreeViewItem("Deadwind Pass (330)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $DeadwindPass)
            GuiCtrlCreateTreeViewItem("Blue Feather", $DeadwindPass)
            GuiCtrlCreateTreeViewItem("Red Feather", $DeadwindPass)

        $DunMorogh = GuiCtrlCreateTreeViewItem("Dun Morogh (1)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $DunMorogh)
            GuiCtrlCreateTreeViewItem("Blue Feather", $DunMorogh)
            GuiCtrlCreateTreeViewItem("Red Feather", $DunMorogh)

        $Duskwood = GuiCtrlCreateTreeViewItem("Duskwood (55)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $Duskwood)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Duskwood)
            GuiCtrlCreateTreeViewItem("Red Feather", $Duskwood)

        $EasternPlaguelands = GuiCtrlCreateTreeViewItem("Eastern Plaguelands (330)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $EasternPlaguelands)
            GuiCtrlCreateTreeViewItem("Blue Feather", $EasternPlaguelands)
            GuiCtrlCreateTreeViewItem("Red Feather", $EasternPlaguelands)

        $ElwynnForest = GuiCtrlCreateTreeViewItem("Elwynn Forest (1)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $ElwynnForest)
            GuiCtrlCreateTreeViewItem("Blue Feather", $ElwynnForest)
            GuiCtrlCreateTreeViewItem("Red Feather", $ElwynnForest)

        $EversongWoods = GuiCtrlCreateTreeViewItem("Eversong Woods (20)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $EversongWoods)
            GuiCtrlCreateTreeViewItem("Blue Feather", $EversongWoods)
            GuiCtrlCreateTreeViewItem("Red Feather", $EversongWoods)

        $Ghostlands = GuiCtrlCreateTreeViewItem("Ghostlands (20)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $Ghostlands)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Ghostlands)
            GuiCtrlCreateTreeViewItem("Red Feather", $Ghostlands)

        $HillsbradFoothills = GuiCtrlCreateTreeViewItem("Hillsbrad Foothills (55)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $HillsbradFoothills)
            GuiCtrlCreateTreeViewItem("Blue Feather", $HillsbradFoothills)
            GuiCtrlCreateTreeViewItem("Red Feather", $HillsbradFoothills)

        $IsleofQuelDanas = GuiCtrlCreateTreeViewItem("Isle of Quel'Danas (380)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $IsleofQuelDanas)
            GuiCtrlCreateTreeViewItem("Blue Feather", $IsleofQuelDanas)
            GuiCtrlCreateTreeViewItem("Red Feather", $IsleofQuelDanas)

        $LochModan = GuiCtrlCreateTreeViewItem("Loch Modan (20)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $LochModan)
            GuiCtrlCreateTreeViewItem("Blue Feather", $LochModan)
            GuiCtrlCreateTreeViewItem("Red Feather", $LochModan)

        $RedridgeMountains = GuiCtrlCreateTreeViewItem("Redridge Mountains (55)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $RedridgeMountains)
            GuiCtrlCreateTreeViewItem("Blue Feather", $RedridgeMountains)
            GuiCtrlCreateTreeViewItem("Red Feather", $RedridgeMountains)

        $SilverpineForest = GuiCtrlCreateTreeViewItem("Silverpine Forest (20)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $SilverpineForest)
            GuiCtrlCreateTreeViewItem("Blue Feather", $SilverpineForest)
            GuiCtrlCreateTreeViewItem("Red Feather", $SilverpineForest)

        $StranglethornVale = GuiCtrlCreateTreeViewItem("Stranglethorn Vale (130)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $StranglethornVale)
            GuiCtrlCreateTreeViewItem("Blue Feather", $StranglethornVale)
            GuiCtrlCreateTreeViewItem("Red Feather", $StranglethornVale)

        $Swampofsorrows = GuiCtrlCreateTreeViewItem("Swamp of sorrows (130)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $Swampofsorrows)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Swampofsorrows)
            GuiCtrlCreateTreeViewItem("Red Feather", $Swampofsorrows)

        $TheHinterlands = GuiCtrlCreateTreeViewItem("The Hinterlands (205)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $TheHinterlands)
            GuiCtrlCreateTreeViewItem("Blue Feather", $TheHinterlands)
            GuiCtrlCreateTreeViewItem("Red Feather", $TheHinterlands)

        $TirisfalGlades = GuiCtrlCreateTreeViewItem("Tirisfal Glades (1)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $TirisfalGlades)
            GuiCtrlCreateTreeViewItem("Blue Feather", $TirisfalGlades)
            GuiCtrlCreateTreeViewItem("Red Feather", $TirisfalGlades)

        $WesternPlaguelands = GuiCtrlCreateTreeViewItem("Western Plaguelands (205)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $WesternPlaguelands)
            GuiCtrlCreateTreeViewItem("Blue Feather", $WesternPlaguelands)
            GuiCtrlCreateTreeViewItem("Red Feather", $WesternPlaguelands)

        $Westfall = GuiCtrlCreateTreeViewItem("Westfall (55)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $Westfall)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Westfall)
            GuiCtrlCreateTreeViewItem("Red Feather", $Westfall)

        $Wetlands = GuiCtrlCreateTreeViewItem("Wetlands (55)", $EasternKingdoms)
            GuiCtrlCreateTreeViewItem("Bobber", $Wetlands)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Wetlands)
            GuiCtrlCreateTreeViewItem("Red Feather", $Wetlands)



    $Kalimdor = GuiCtrlCreateTreeViewItem("Kalimdor", $PlacesMoon)
        $Ashenvale = GuiCtrlCreateTreeViewItem("Ashenvale (55)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Ashenvale)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Ashenvale)
            GuiCtrlCreateTreeViewItem("Red Feather", $Ashenvale)

        $Azshara = GuiCtrlCreateTreeViewItem("Azshara (205)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Azshara)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Azshara)
            GuiCtrlCreateTreeViewItem("Red Feather", $Azshara)

        $AzuremystIsle = GuiCtrlCreateTreeViewItem("Azuremyst Isle (20)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $AzuremystIsle)
            GuiCtrlCreateTreeViewItem("Blue Feather", $AzuremystIsle)
            GuiCtrlCreateTreeViewItem("Red Feather", $AzuremystIsle)

        $BloodmystIsle = GuiCtrlCreateTreeViewItem("Bloodmyst Isle (1)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $BloodmystIsle)
            GuiCtrlCreateTreeViewItem("Blue Feather", $BloodmystIsle)
            GuiCtrlCreateTreeViewItem("Red Feather", $BloodmystIsle)

        $Darkshore = GuiCtrlCreateTreeViewItem("Darkshore (20)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Darkshore)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Darkshore)
            GuiCtrlCreateTreeViewItem("Red Feather", $Darkshore)

        $Desolace = GuiCtrlCreateTreeViewItem("Desolace (130)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Desolace)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Desolace)
            GuiCtrlCreateTreeViewItem("Red Feather", $Desolace)

        $Durotar = GuiCtrlCreateTreeViewItem("Durotar (1)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Durotar)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Durotar)
            GuiCtrlCreateTreeViewItem("Red Feather", $Durotar)

        $DustwallowMarsh = GuiCtrlCreateTreeViewItem("Dustwallow Marsh (130)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $DustwallowMarsh)
            GuiCtrlCreateTreeViewItem("Blue Feather", $DustwallowMarsh)
            GuiCtrlCreateTreeViewItem("Red Feather", $DustwallowMarsh)

        $Felwood = GuiCtrlCreateTreeViewItem("Felwood (205)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Felwood)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Felwood)
            GuiCtrlCreateTreeViewItem("Red Feather", $Felwood)

        $Feralas = GuiCtrlCreateTreeViewItem("Feralas (205)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Feralas)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Feralas)
            GuiCtrlCreateTreeViewItem("Red Feather", $Feralas)

        $Moonglade = GuiCtrlCreateTreeViewItem("Moonglade (205)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Moonglade)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Moonglade)
            GuiCtrlCreateTreeViewItem("Red Feather", $Moonglade)

        $Mulgore = GuiCtrlCreateTreeViewItem("Mulgore (1)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Mulgore)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Mulgore)
            GuiCtrlCreateTreeViewItem("Red Feather", $Mulgore)

        $StonetalonMountain = GuiCtrlCreateTreeViewItem("Stonetalon Mountain (55)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $StonetalonMountain)
            GuiCtrlCreateTreeViewItem("Blue Feather", $StonetalonMountain)
            GuiCtrlCreateTreeViewItem("Red Feather", $StonetalonMountain)

        $Tanaris = GuiCtrlCreateTreeViewItem("Tanaris (205)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Tanaris)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Tanaris)
            GuiCtrlCreateTreeViewItem("Red Feather", $Tanaris)

        $Teldrassil = GuiCtrlCreateTreeViewItem("Teldrassil (1)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Teldrassil)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Teldrassil)
            GuiCtrlCreateTreeViewItem("Red Feather", $Teldrassil)

        $TheBarrens = GuiCtrlCreateTreeViewItem("The Barrens (20)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $TheBarrens)
            GuiCtrlCreateTreeViewItem("Blue Feather", $TheBarrens)
            GuiCtrlCreateTreeViewItem("Red Feather", $TheBarrens)

        $ThousandNeedles = GuiCtrlCreateTreeViewItem("Thousand Needles (130)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $ThousandNeedles)
            GuiCtrlCreateTreeViewItem("Blue Feather", $ThousandNeedles)
            GuiCtrlCreateTreeViewItem("Red Feather", $ThousandNeedles)

        $UnGoroCrater = GuiCtrlCreateTreeViewItem("Un'Goro Crater (205)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $UnGoroCrater)
            GuiCtrlCreateTreeViewItem("Blue Feather", $UnGoroCrater)
            GuiCtrlCreateTreeViewItem("Red Feather", $UnGoroCrater)

        $Winterspring = GuiCtrlCreateTreeViewItem("Winterspring (330)", $Kalimdor)
            GuiCtrlCreateTreeViewItem("Bobber", $Winterspring)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Winterspring)
            GuiCtrlCreateTreeViewItem("Red Feather", $Winterspring)



    $Outland = GuiCtrlCreateTreeViewItem("Outland", $PlacesMoon)
        $Hellfire = GuiCtrlCreateTreeViewItem("Hellfire (280)", $Outland)
            GuiCtrlCreateTreeViewItem("Bobber", $Hellfire)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Hellfire)
            GuiCtrlCreateTreeViewItem("Red Feather", $Hellfire)

        $Nagrand = GuiCtrlCreateTreeViewItem("Nagrand (380)", $Outland)
            GuiCtrlCreateTreeViewItem("Bobber", $Nagrand)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Nagrand)
            GuiCtrlCreateTreeViewItem("Red Feather", $Nagrand)

        $Netherstorm = GuiCtrlCreateTreeViewItem("Netherstorm (380)", $Outland)
            GuiCtrlCreateTreeViewItem("Bobber", $Netherstorm)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Netherstorm)
            GuiCtrlCreateTreeViewItem("Red Feather", $Netherstorm)

        $ShadowmoonValley = GuiCtrlCreateTreeViewItem("Shadowmoon Valley (?)", $Outland)
            GuiCtrlCreateTreeViewItem("Bobber", $ShadowmoonValley)
            GuiCtrlCreateTreeViewItem("Blue Feather", $ShadowmoonValley)
            GuiCtrlCreateTreeViewItem("Red Feather", $ShadowmoonValley)

        $TerokkarForest = GuiCtrlCreateTreeViewItem("Terokkar Forest (355)", $Outland)
            GuiCtrlCreateTreeViewItem("Bobber", $TerokkarForest)
            GuiCtrlCreateTreeViewItem("Blue Feather", $TerokkarForest)
            GuiCtrlCreateTreeViewItem("Red Feather", $TerokkarForest)

        $Zangramarsh = GuiCtrlCreateTreeViewItem("Zangramarsh (305)", $Outland)
            GuiCtrlCreateTreeViewItem("Bobber", $Zangramarsh)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Zangramarsh)
            GuiCtrlCreateTreeViewItem("Red Feather", $Zangramarsh)



    $Cities = GuiCtrlCreateTreeViewItem("Cities", $PlacesMoon)
        $Darnassus = GuiCtrlCreateTreeViewItem("Darnassus (1)", $Cities)
            GuiCtrlCreateTreeViewItem("Bobber", $Darnassus)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Darnassus)
            GuiCtrlCreateTreeViewItem("Red Feather", $Darnassus)

        $Ironforge = GuiCtrlCreateTreeViewItem("Ironforge (1)", $Cities)
            GuiCtrlCreateTreeViewItem("Bobber", $Ironforge)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Ironforge)
            GuiCtrlCreateTreeViewItem("Red Feather", $Ironforge)

        $Orgrimmar = GuiCtrlCreateTreeViewItem("Orgrimmar (1)", $Cities)
            GuiCtrlCreateTreeViewItem("Bobber", $Orgrimmar)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Orgrimmar)
            GuiCtrlCreateTreeViewItem("Red Feather", $Orgrimmar)

        $Silvermoon = GuiCtrlCreateTreeViewItem("Silvermoon (1)", $Cities)
            GuiCtrlCreateTreeViewItem("Bobber", $Silvermoon)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Silvermoon)
            GuiCtrlCreateTreeViewItem("Red Feather", $Silvermoon)

        $Stormwind = GuiCtrlCreateTreeViewItem("Stormwind (1)", $Cities)
            GuiCtrlCreateTreeViewItem("Bobber", $Stormwind)
            GuiCtrlCreateTreeViewItem("Blue Feather", $Stormwind)
            GuiCtrlCreateTreeViewItem("Red Feather", $Stormwind)

        $ThunderBluff = GuiCtrlCreateTreeViewItem("Thunder Bluff (1)", $Cities)
            GuiCtrlCreateTreeViewItem("Bobber", $ThunderBluff)
            GuiCtrlCreateTreeViewItem("Blue Feather", $ThunderBluff)
            GuiCtrlCreateTreeViewItem("Red Feather", $ThunderBluff)


    $Instances = GuiCtrlCreateTreeViewItem("Instances", $PlacesMoon)
        $somewhere = GuiCtrlCreateTreeViewItem("somewhere", $Instances)
            GuiCtrlCreateTreeViewItem("Bobber", $somewhere)
            GuiCtrlCreateTreeViewItem("Blue Feather", $somewhere)
            GuiCtrlCreateTreeViewItem("Red Feather", $somewhere)


    $UserColor = GuiCtrlCreateTreeViewItem("User Color", $PlacesMoon)
        GuiCtrlCreateTreeViewItem("Bobber", $UserColor)
        GuiCtrlCreateTreeViewItem("Blue Feather", $UserColor)
        GuiCtrlCreateTreeViewItem("Red Feather", $UserColor)

        
    $DummyMoon = GUICtrlCreateDummy()

For $ListMoon = $PlacesMoon To $DummyMoon
    GUICtrlSetOnEvent($ListMoon, "EventMoon")
Next   
    $BobberColorMoon = GuiCtrlCreateLabel("", 420, 60, 40, 40,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS),$WS_EX_CLIENTEDGE)

Func EventMoon()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            Switch GUICtrlRead(@GUI_CtrlId, 1)
                Case "Bobber"
                    GUICtrlSetBkColor($BobberColorMoon, FindColorMoon(@GUI_CtrlId, 1))
                Case "Blue Feather"
                    GUICtrlSetBkColor($BobberColorMoon, FindColorMoon(@GUI_CtrlId, 2))
                Case "Red Feather"
                    GUICtrlSetBkColor($BobberColorMoon, FindColorMoon(@GUI_CtrlId, 3))
                Case Else
                    GUICtrlSetBkColor($BobberColorMoon, 0xFFFF00)
            EndSwitch
    EndSwitch     
EndFunc

Func FindColorMoon($cID, $LGD)
    For $ListMoon = 1 To $ColorMoon[0]
        If StringInStr($ColorMoon[$ListMoon], GUICtrlRead(_GUICtrlTreeView_GetParentParam($PlacesMoon, $cID),1)) Then
            Local $SSC = StringSplit($ColorMoon[$ListMoon], ",")
            IniWrite($INIFile, "ColorChoice", "ColorBobberMoon", $SSC[$LGD + 1])
            Return $SSC[$LGD + 1]
        EndIf   
    Next
EndFunc




; SLIDER


    

;BOBBER SLIDER
        GuiCtrlCreateLabel("Bobber", 260, 60)
        $BobberNightVariation_Label = GUICtrlCreateLabel("Variation (Contrast) ", 260, 80, 200)
        $BobberNightVariation_Slider = GUICtrlCreateSlider(260, 100, 200, 30)
        GUICtrlSetLimit( 1, 30)
        GuiCtrlSetData(-1, 20)

        $BobberNightPixel_Label = GUICtrlCreateLabel("Pixel Search ", 260, 140, 200)
        $BobberNightPixel_Slider = GUICtrlCreateSlider(260, 160, 200, 30)
        GUICtrlSetLimit( 1, 5)
        GuiCtrlSetData(-1, 3)

;SPLASH SLIDER

    $SplashColorMoon = GuiCtrlCreateLabel("", 420, 220, 40, 40,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS),$WS_EX_CLIENTEDGE)
    GuiCtrlSetBkColor($SplashColorMoon, 0xF6F6F6)

; LABEL

        GuiCtrlCreateLabel("Splash", 260, 220)
        $SplashNightVariation_Label = GUICtrlCreateLabel("Variation (Contrast) ", 260, 240, 200)
        $SplashNightVariation_Slider = GUICtrlCreateSlider(260, 260, 200, 30)
        GuiCtrlSetData(-1, 30)

        $SplashNightPixel_Label = GUICtrlCreateLabel("Pixel Search ", 260, 300, 200)
        $SplashNightPixel_Slider = GUICtrlCreateSlider(260, 320, 200, 30)
        GuiCtrlSetData(-1, 30)


; INPUT

    GuiCtrlCreateLabel("Fishes", 260, 365)
    $CatchAmountMoonChange = GUICtrlCreateInput("", 260, 380, 40, 20)
    GUICtrlSetLimit($CatchAmountMoonChange, 3)

    GuiCtrlCreateLabel("Latency", 260, 405)
    $LatencyMoonChange = GuiCtrlCreateInput("", 260, 420, 40, 20)
    GUICtrlSetLimit($LatencyMoonChange,4)

    GuiCtrlCreateLabel("Resolution", 260, 445)
    $ResolutionXMoonChange = GuiCtrlCreateInput("", 260, 460, 40, 20)
    GUICtrlSetLimit($ResolutionXMoonChange,4)

    GuiCtrlCreateLabel("X", 302, 463)
    $ResolutionYMoonChange  = GuiCtrlCreateInput("", 310, 460, 40, 20)
    GUICtrlSetLimit($ResolutionYMoonChange,4)
    
    $PoleMoonChange = GuiCtrlCreateInput("", 380, 385, 13, 16)
    GUICtrlSetLimit($PoleMoonChange,1)
    GuiCtrlCreateLabel("Pole", 395, 385)
    
    $LureMoonChange = GuiCtrlCreateInput("", 380, 410, 13, 16)
    GUICtrlSetLimit($LureMoonChange,1)
    GuiCtrlCreateLabel("Lure", 395, 410)

; Set Control Data
    GUICtrlSetData($CatchAmountMoonChange, $CatchAmountMoon)
    guictrlsetdata($LatencyMoonChange, $LatencyMoon)
    guictrlsetdata($ResolutionXMoonChange, $ResolutionXMoon)
    guictrlsetdata($ResolutionYMoonChange, $ResolutionYMoon)
    guictrlsetdata($PoleMoonChange, $PoleMoon)
    guictrlsetdata($LureMoonChange, $LureMoon)


; CHECKBOX
    GuiCtrlCreateCheckbox("Apply Lure?", 380, 430, 80, 20)
    GuiCtrlSetState(-1, $GUI_CHECKED)

; BUTTON
    $ChangeData = GuiCtrlCreateButton("Go Fish!", 380, 460, 80, 30)


;HELP TAB
    GuiCtrlCreateTabItem("Help")
    GuiCtrlCreateLabel("Here it will be general help *UNDER CONSTRUCTION*" _ 
   & @CRLF & "" _ 
   & @CRLF & "First of all! Start out by making a Fishing Bar eg." _ 
   & @CRLF & "Button 1: Cast Pole" _ 
   & @CRLF & "Button 2: Apply Lure Macro" _ 
   & @CRLF & "Button 3: Find Fish" _ 
   & @CRLF & "Button 4: Mount" _ 
   & @CRLF & "Button 5-9: Various spells to defend myself, like deathcoil" _ 
   & @CRLF & "Button 0: /DND Fishing" _ 
   & @CRLF & "" _ 
   & @CRLF & "Apply Lure Macro:" _ 
   & @CRLF & "/script UseContainerItem(0, 1);" _ 
   & @CRLF & "/script PickupInventoryItem(16); " _ 
   & @CRLF & "This picks up the item in your top left corner of your backpack (B) and puts it on your mainhand" _ 
   & @CRLF & "" _ 
   & @CRLF & "All colors have been extracted when facing South East, this gives the best contrast" _ 
   & @CRLF & "witch makes it easier for FishIt to discover the bobber and splash." _ 
   & @CRLF & "So you should be facing South East aswell (keep the sun/moon in your back)" _ 
   & @CRLF & "" _ 
   & @CRLF & "Zoom in to the max, so you are looking through the characters eyes," _ 
   & @CRLF & "or else the bot will find your character most of the time =P" _ 
   & @CRLF & "" _ 
   & @CRLF & "Keep the horizon at about one third from the top of the screen, this cause of that the bot" _ 
   & @CRLF & "will be able to find the bobber most of the time, so the bobber wont get outside the search area." _ 
   & @CRLF & "" _ 
   & @CRLF & "" _ 
   & @CRLF & "" _ 
   & @CRLF & "" _ 
   & @CRLF & "" _ 
   & @CRLF & "" _ 
   & @CRLF & "" _ 
   & @CRLF & "" _ 
   & @CRLF & "" _ 
   & @CRLF & "" _ 
   & @CRLF & "*UNDER CONSTRUCTION*", 20, 30, 600, 580)



; GUI MESSAGE LOOP
GUISetState(@SW_SHOW)

; SLIDERS VALUE
GUIRegisterMsg($WM_HSCROLL, "WM_HVSCROLL")
GUIRegisterMsg($WM_VSCROLL, "WM_HVSCROLL")


Func WM_HVSCROLL($hWndGUI, $MsgID, $WParam, $LParam)
    Switch $LParam
    ;DAYLIGHT    
Local    
        Case GUICtrlGetHandle($BobberDayVariation_Slider)
            GUICtrlSetData($BobberDayVariation_Label, "Variation (Contrast) " & GUICtrlRead($BobberDayVariation_Slider))
        Case GUICtrlGetHandle($BobberDayPixel_Slider)
            GUICtrlSetData($BobberDayPixel_Label, "Pixel Search " & GUICtrlRead($BobberDayPixel_Slider))
        Case GUICtrlGetHandle($SplashDayVariation_Slider)
            GUICtrlSetData($SplashDayVariation_Label, "Variation (Contrast) " & GUICtrlRead($SplashDayVariation_Slider))
        Case GUICtrlGetHandle($SplashDayPixel_Slider)
            GUICtrlSetData($SplashDayPixel_Label, "Pixel Search " & GUICtrlRead($SplashDayPixel_Slider))
;MOONLIGHT  
        Case GUICtrlGetHandle($BobberNightVariation_Slider)
            GUICtrlSetData($BobberNightVariation_Label, "Variation (Contrast) " & GUICtrlRead($BobberNightVariation_Slider))
        Case GUICtrlGetHandle($BobberNightPixel_Slider)
            GUICtrlSetData($BobberNightPixel_Label, "Pixel Search " & GUICtrlRead($BobberNightPixel_Slider))
        Case GUICtrlGetHandle($SplashNightVariation_Slider)
            GUICtrlSetData($SplashNightVariation_Label, "Variation (Contrast) " & GUICtrlRead($SplashNightVariation_Slider))
        Case GUICtrlGetHandle($SplashNightPixel_Slider)
            GUICtrlSetData($SplashNightPixel_Label, "Pixel Search " & GUICtrlRead($SplashNightPixel_Slider))
            
            
    EndSwitch
EndFunc


;INOUT INI
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            call("SetData")
            Exit
        
    case $ChangeData
            call("SetData")
        ;DAYLIGHT
                guictrlsetdata($CatchAmountDayChange, $CatchAmountDay)
                guictrlsetdata($LatencyDayChange, $LatencyDay)
                guictrlsetdata($ResolutionXDayChange, $ResolutionXDay)
                guictrlsetdata($ResolutionYDayChange, $ResolutionYDay)
                guictrlsetdata($PoleDayChange, $PoleDay)
                guictrlsetdata($LureDayChange, $LureDay)

                
        ;MOONLIGHT  
                guictrlsetdata($CatchAmountMoonChange, $CatchAmountMoon)
                guictrlsetdata($LatencyMoonChange, $LatencyMoon)
                guictrlsetdata($ResolutionXMoonChange, $ResolutionXMoon)
                guictrlsetdata($ResolutionYMoonChange, $ResolutionYMoon)
                guictrlsetdata($PoleMoonChange, $PoleMoon)
                guictrlsetdata($LureMoonChange, $LureMoon)
                
                
    EndSwitch
WEnd

Func SetData()
;DAYLIGHT   
$CatchAmountDay = GUICtrlRead($CatchAmountDayChange)
    if $CatchAmountDay = "" then $CatchAmountDay = "100"
    
$LatencyDay = Guictrlread($LatencyDayChange)
    if $LatencyDay = "" then $LatencyDay = "100"

$ResolutionXDay = guictrlread($ResolutionXDayChange)
    if $ResolutionXDay = "" then $ResolutionXDay = "800"

$ResolutionYDay = GUICtrlRead($ResolutionYDayChange)
    if $ResolutionYDay = "" then $ResolutionYDay = "600"

$PoleDay = GUICtrlRead($PoleDayChange)
    if $PoleDay = "" then $PoleDay = "1"
    
$LureDay = GUICtrlRead($LureDayChange)
    if $LureDay = "" then $LureDay = "2"
    

;MOONLIGHT  
$CatchAmountMoon = GUICtrlRead($CatchAmountMoonChange)
    if $CatchAmountMoon = "" then $CatchAmountMoon = "100"
    
$LatencyMoon = Guictrlread($LatencyMoonChange)
    if $LatencyMoon = "" then $LatencyMoon = "100"

$ResolutionXMoon = guictrlread($ResolutionXMoonChange)
    if $ResolutionXMoon = "" then $ResolutionXMoon = "800"

$ResolutionYMoon = GUICtrlRead($ResolutionYMoonChange)
    if $ResolutionYMoon = "" then $ResolutionYMoon = "600"
    
$PoleMoon = GUICtrlRead($PoleMoonChange)
    if $PoleMoon = "" then $PoleMoon = "1"
    
$LureMoon = GUICtrlRead($LureMoonChange)
    if $LureMoon = "" then $LureMoon = "2"

;DAYLIGHT
IniWrite($INIFile, "CatchAmount", "CatchAmountDay", $CatchAmountDay)
IniWrite($INIFile, "Latency", "LatencyDay", $LatencyDay)
IniWrite($INIFile, "Resolution", "ResolutionXDay", $ResolutionXDay)
IniWrite($INIFile, "Resolution", "ResolutionYDay", $ResolutionYDay)
IniWrite($INIFile, "Pole", "PoleDay", $PoleDay)
IniWrite($INIFile, "Lure", "LureDay", $LureDay)
;MOONLIGHT
IniWrite($INIFile, "CatchAmount", "CatchAmountMoon", $CatchAmountMoon)
IniWrite($INIFile, "Latency", "LatencyMoon", $LatencyMoon)
IniWrite($INIFile, "Resolution", "ResolutionXMoon", $ResolutionXMoon)
IniWrite($INIFile, "Resolution", "ResolutionYMoon", $ResolutionYMoon)
IniWrite($INIFile, "Pole", "PoleMoon", $PoleMoon)
IniWrite($INIFile, "Lure", "LureMoon", $LureMoon)


EndFunc



While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd
Edited by PrinsBertil
Link to comment
Share on other sites

I have abit of a problem with coding the GUI.

the other scripts that read the INI file are already done and work correctly when reading values from ini file

The TreeView and the other functions collide when trying to write to an ini file.

Problems with the GUI are as follows:

1. The functions are in conflict with writing to ini

2. Binding slider controls to write values to ini file. as they are now at the moment they do nothing more than display the value at the label and that is in conflict aswell.

3. Let the checkbox "Apply lure" present either 1 (for checked) and 0 (for unchecked). this has been a real problem for me since it either present value 4 or 0 and it is very random without any logic at all.

that code is deleted since I do not master it. but the placement is still there for when it will work

4. Let the "Go Fish! button start another script (FishItDay.au3 resp. FishItMoon.au3)

I recommend that you use Scite for your editor and then use the Tidy feature to neaten up the code and make it easier to read.

Also when you post code place it between code tags [ code] code here... [ /code]. But don't include the spaces between the square brackets.

The code you posted is too long for me to deal with. Can you post the minimum code which shows the problem you have?

You can save a bit of code because if the ini file doesn't exist IniRead still returns the default string so you don't need the

If FileExists/else

You have a lot of duplication. Duplication means you spend more time writing and more time fixing problems.

For example

$DeadwindPass = GuiCtrlCreateTreeViewItem("Deadwind Pass (330)", $EasternKingdoms)
GuiCtrlCreateTreeViewItem("Bobber", $DeadwindPass)
GuiCtrlCreateTreeViewItem("Blue Feather", $DeadwindPass)
GuiCtrlCreateTreeViewItem("Red Feather", $DeadwindPass)

$DunMorogh = GuiCtrlCreateTreeViewItem("Dun Morogh (1)", $EasternKingdoms)
GuiCtrlCreateTreeViewItem("Bobber", $DunMorogh)
GuiCtrlCreateTreeViewItem("Blue Feather", $DunMorogh)
GuiCtrlCreateTreeViewItem("Red Feather", $DunMorogh)

Could be

$DeadwindPass = SetItemsA("Deadwind Pass (330)", $EasternKingdoms)
$DunMorogh = SetItemsA("Dun Morogh (1)", $EasternKingdoms)


Func SetItemsA($sA, $iA)
    Local $tvi = GUICtrlCreateTreeViewItem($sA, $iA)
    GUICtrlCreateTreeViewItem("Bobber", $tvi)
    GUICtrlCreateTreeViewItem("Blue Feather", $tviA)
    GUICtrlCreateTreeViewItem("Red Feather", $tvi)
    Return $tvi
EndFunc  ;==>SetItemsA
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thanks for helpin me tidy the script abit.

$DeadwindPass = SetItemsA("Deadwind Pass (330)", $EasternKingdoms)
$DunMorogh = SetItemsA("Dun Morogh (1)", $EasternKingdoms)


Func SetItemsA($sA, $iA)
    Local $tvi = GUICtrlCreateTreeViewItem($sA, $iA)
    GUICtrlCreateTreeViewItem("Bobber", $tvi)
    GUICtrlCreateTreeViewItem("Blue Feather", $tviA)
    GUICtrlCreateTreeViewItem("Red Feather", $tvi)
    Return $tvi
EndFunc ;==>SetItemsA

Makes it alot smaller.

And sorry for the quote instead of code.

I wasn't really paying any attention to what I was typing exactly, I had to divert course of the ship to avoid a collision. (not as dramatic as i may sound =P)

For Problem 1.

1. The functions are in conflict with writing to ini

I think it is the

#include <GuiConstants.au3>
#include <Constants.au3>
#include <GuiTreeView.au3>

Opt("GUIOnEventMode", 1)

Global $INIFile = @ScriptDir & "\Settings.ini"
Global $ColorDay = StringSplit("Alterac Mountains (130),0xC49D72,0x48567D,0xA6361E|" & _
        "Arathi Highlands (130),0x97644F,0x393045,0x8B2920|" & _
        "Burning Steppes (330),0xB1925C,0x3A373E,0xAB3A1C|" & _
        "Deadwind Pass (330),0x4C4D47,0x273244,0x43211F", "|")
        
        
Func SetItemsA($sA, $iA)
    Local $tvi = GUICtrlCreateTreeViewItem($sA, $iA)
    GUICtrlCreateTreeViewItem("Bobber", $tvi)
    GUICtrlCreateTreeViewItem("Blue Feather", $tvi)
    GUICtrlCreateTreeViewItem("Red Feather", $tvi)
    Return $tvi
EndFunc  ;==>SetItemsA


; GUI
$MyGUI = GUICreate("FishIt", 480, 500, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "EventDay", $MyGUI)
GUISetIcon(@SystemDir & "\mspaint.exe", 0)
$title = "FishIt"
        
; TAB
GUICtrlCreateTab(0, 0, 480, 500)
GUICtrlCreateTabItem("Daylight")
GUICtrlCreateLabel("Place (Skill) ", 40, 40)

; TREEVIEW DAYLIGHT
$PlacesDay = GUICtrlCreateTreeView(20, 60, 220, 420, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)

$EasternKingdoms = GUICtrlCreateTreeViewItem("Eastern Kingdoms", $PlacesDay)
$AlteracMountains = SetItemsA("Alterac Mountains (130)", $EasternKingdoms)
$ArathiHighlands = SetItemsA("Arathi Highlands (130)", $EasternKingdoms)
$ArathiHighlands = SetItemsA("Arathi Highlands (130)", $EasternKingdoms)
$BurningSteppes = SetItemsA("Burning Steppes (330)", $EasternKingdoms)
$DummyDay = GUICtrlCreateDummy()
For $ListDay = $PlacesDay To $DummyDay
    GUICtrlSetOnEvent($ListDay, "EventDay")
Next

$BobberColorDay = GUICtrlCreateLabel("", 420, 60, 40, 40, -1, $WS_EX_CLIENTEDGE)

Func EventDay()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            Switch GUICtrlRead(@GUI_CtrlId, 1)
                Case "Bobber"
                    GUICtrlSetBkColor($BobberColorDay, FindColorDay(@GUI_CtrlId, 1))
                Case "Blue Feather"
                    GUICtrlSetBkColor($BobberColorDay, FindColorDay(@GUI_CtrlId, 2))
                Case "Red Feather"
                    GUICtrlSetBkColor($BobberColorDay, FindColorDay(@GUI_CtrlId, 3))
                Case Else
                    GUICtrlSetBkColor($BobberColorDay, 0xFFFF00)
            EndSwitch
    EndSwitch
EndFunc  ;==>EventDay

Func FindColorDay($cID, $LGD)
    For $ListDay = 1 To $ColorDay[0]
        If StringInStr($ColorDay[$ListDay], GUICtrlRead(_GUICtrlTreeView_GetParentParam($PlacesDay, $cID), 1)) Then
            Local $SSC = StringSplit($ColorDay[$ListDay], ",")
            IniWrite($INIFile, "ColorChoice", "ColorBobberDay", $SSC[$LGD + 1])
            Return $SSC[$LGD + 1]
        EndIf
    Next
EndFunc  ;==>FindColorDay




;IS IN CONFLICT TO WRITE TO INI WITH FOLLOWING FUNCTION (I think)

$CatchAmountDay = IniRead($INIFile, "CatchAmount", "CatchAmountDay", "100")
$LatencyDay = IniRead($INIFile, "Latency", "LatencyDay", "100")
$ResolutionXDay = IniRead($INIFile, "Resolution", "ResolutionXDay", "800")
$ResolutionYDay = IniRead($INIFile, "Resolution", "ResolutionYDay", "600")
$PoleDay = IniRead($INIFile, "Pole", "PoleDay", "1")
$LureDay = IniRead($INIFile, "Lure", "LureDay", "2")

GUICtrlCreateLabel("Fishes", 260, 365)
$CatchAmountDayChange = GUICtrlCreateInput("", 260, 380, 40, 20)
GUICtrlSetLimit($CatchAmountDayChange, 3)

GUICtrlCreateLabel("Latency", 260, 405)
$LatencyDayChange = GUICtrlCreateInput("", 260, 420, 40, 20)
GUICtrlSetLimit($LatencyDayChange, 4)

GUICtrlCreateLabel("Resolution", 260, 445)
$ResolutionXDayChange = GUICtrlCreateInput("", 260, 460, 40, 20)
GUICtrlSetLimit($ResolutionXDayChange, 4)

GUICtrlCreateLabel("X", 302, 463)
$ResolutionYDayChange = GUICtrlCreateInput("", 310, 460, 40, 20)
GUICtrlSetLimit($ResolutionYDayChange, 4)

$PoleDayChange = GUICtrlCreateInput("", 380, 385, 13, 16)
GUICtrlSetLimit($PoleDayChange, 1)
GUICtrlCreateLabel("Pole", 395, 385)

$LureDayChange = GUICtrlCreateInput("", 380, 410, 13, 16)
GUICtrlSetLimit($LureDayChange, 1)
GUICtrlCreateLabel("Lure", 395, 410)

; CHECKBOX
GUICtrlCreateCheckbox("Apply Lure?", 380, 430, 80, 20)
GUICtrlSetState(-1, 1)


GUISetState(@SW_SHOW)
; Set Control Data
GUICtrlSetData($CatchAmountDayChange, $CatchAmountDay)
GUICtrlSetData($LatencyDayChange, $LatencyDay)
GUICtrlSetData($ResolutionXDayChange, $ResolutionXDay)
GUICtrlSetData($ResolutionYDayChange, $ResolutionYDay)
GUICtrlSetData($PoleDayChange, $PoleDay)
GUICtrlSetData($LureDayChange, $LureDay)


; BUTTON
$ChangeData = GUICtrlCreateButton("Go Fish!", 380, 460, 80, 30)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Call("SetData")
            Exit

        Case $ChangeData
            Call("SetData")
        ;DAYLIGHT
            GUICtrlSetData($CatchAmountDayChange, $CatchAmountDay)
            GUICtrlSetData($LatencyDayChange, $LatencyDay)
            GUICtrlSetData($ResolutionXDayChange, $ResolutionXDay)
            GUICtrlSetData($ResolutionYDayChange, $ResolutionYDay)
            GUICtrlSetData($PoleDayChange, $PoleDay)
            GUICtrlSetData($LureDayChange, $LureDay)
        EndSwitch
    WEnd
    
Func SetData()
;DAYLIGHT
    $CatchAmountDay = GUICtrlRead($CatchAmountDayChange)
    If $CatchAmountDay = "" Then $CatchAmountDay = "100"
    
    $LatencyDay = GUICtrlRead($LatencyDayChange)
    If $LatencyDay = "" Then $LatencyDay = "100"

    $ResolutionXDay = GUICtrlRead($ResolutionXDayChange)
    If $ResolutionXDay = "" Then $ResolutionXDay = "800"

    $ResolutionYDay = GUICtrlRead($ResolutionYDayChange)
    If $ResolutionYDay = "" Then $ResolutionYDay = "600"

    $PoleDay = GUICtrlRead($PoleDayChange)
    If $PoleDay = "" Then $PoleDay = "1"
    
    $LureDay = GUICtrlRead($LureDayChange)
    If $LureDay = "" Then $LureDay = "2"
    
    IniWrite($INIFile, "CatchAmount", "CatchAmountDay", $CatchAmountDay)
    IniWrite($INIFile, "Latency", "LatencyDay", $LatencyDay)
    IniWrite($INIFile, "Resolution", "ResolutionXDay", $ResolutionXDay)
    IniWrite($INIFile, "Resolution", "ResolutionYDay", $ResolutionYDay)
    IniWrite($INIFile, "Pole", "PoleDay", $PoleDay)
    IniWrite($INIFile, "Lure", "LureDay", $LureDay)
    EndFunc  ;==>SetData

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd
Link to comment
Share on other sites

Thanks for helpin me tidy the script abit.

That's OK.

You have selected to use onevent, but then youare using GuiGetMsg() which doesn't work for OnEvent mode. However, you only had one event defined, and that was duplicated in your whil/wend loop. SO I made a couple of minor changes.

Try this

#include <GuiConstants.au3>
#include <Constants.au3>
#include <GuiTreeView.au3>

Opt("GUIOnEventMode", 0);1)

Global $INIFile = @ScriptDir & "\Settings.ini"
Global $ColorDay = StringSplit("Alterac Mountains (130),0xC49D72,0x48567D,0xA6361E|" & _
        "Arathi Highlands (130),0x97644F,0x393045,0x8B2920|" & _
        "Burning Steppes (330),0xB1925C,0x3A373E,0xAB3A1C|" & _
        "Deadwind Pass (330),0x4C4D47,0x273244,0x43211F", "|")
        
        
Func SetItemsA($sA, $iA)
    Local $tvi = GUICtrlCreateTreeViewItem($sA, $iA)
    GUICtrlCreateTreeViewItem("Bobber", $tvi)
    GUICtrlCreateTreeViewItem("Blue Feather", $tvi)
    GUICtrlCreateTreeViewItem("Red Feather", $tvi)
    Return $tvi
EndFunc ;==>SetItemsA


; GUI
$MyGUI = GUICreate("FishIt", 480, 500, -1, -1)
;GUISetOnEvent($GUI_EVENT_CLOSE, "EventDay", $MyGUI)
GUISetIcon(@SystemDir & "\mspaint.exe", 0)
$title = "FishIt"
        
; TAB
GUICtrlCreateTab(0, 0, 480, 500)
GUICtrlCreateTabItem("Daylight")
GUICtrlCreateLabel("Place (Skill) ", 40, 40)

; TREEVIEW DAYLIGHT
$PlacesDay = GUICtrlCreateTreeView(20, 60, 220, 420, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)

$EasternKingdoms = GUICtrlCreateTreeViewItem("Eastern Kingdoms", $PlacesDay)
$AlteracMountains = SetItemsA("Alterac Mountains (130)", $EasternKingdoms)
$ArathiHighlands = SetItemsA("Arathi Highlands (130)", $EasternKingdoms)
$ArathiHighlands = SetItemsA("Arathi Highlands (130)", $EasternKingdoms)
$BurningSteppes = SetItemsA("Burning Steppes (330)", $EasternKingdoms)
$DummyDay = GUICtrlCreateDummy()
For $ListDay = $PlacesDay To $DummyDay
    GUICtrlSetOnEvent($ListDay, "EventDay")
Next

$BobberColorDay = GUICtrlCreateLabel("", 420, 60, 40, 40, -1, $WS_EX_CLIENTEDGE)

Func EventDay()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            Switch GUICtrlRead(@GUI_CtrlId, 1)
                Case "Bobber"
                    GUICtrlSetBkColor($BobberColorDay, FindColorDay(@GUI_CtrlId, 1))
                Case "Blue Feather"
                    GUICtrlSetBkColor($BobberColorDay, FindColorDay(@GUI_CtrlId, 2))
                Case "Red Feather"
                    GUICtrlSetBkColor($BobberColorDay, FindColorDay(@GUI_CtrlId, 3))
                Case Else
                    GUICtrlSetBkColor($BobberColorDay, 0xFFFF00)
            EndSwitch
    EndSwitch
EndFunc ;==>EventDay

Func FindColorDay($cID, $LGD)
    For $ListDay = 1 To $ColorDay[0]
        If StringInStr($ColorDay[$ListDay], GUICtrlRead(_GUICtrlTreeView_GetParentParam($PlacesDay, $cID), 1)) Then
            Local $SSC = StringSplit($ColorDay[$ListDay], ",")
            IniWrite($INIFile, "ColorChoice", "ColorBobberDay", $SSC[$LGD + 1])
            Return $SSC[$LGD + 1]
        EndIf
    Next
EndFunc ;==>FindColorDay




;IS IN CONFLICT TO WRITE TO INI WITH FOLLOWING FUNCTION (I think)

$CatchAmountDay = IniRead($INIFile, "CatchAmount", "CatchAmountDay", "100")
$LatencyDay = IniRead($INIFile, "Latency", "LatencyDay", "100")
$ResolutionXDay = IniRead($INIFile, "Resolution", "ResolutionXDay", "800")
$ResolutionYDay = IniRead($INIFile, "Resolution", "ResolutionYDay", "600")
$PoleDay = IniRead($INIFile, "Pole", "PoleDay", "1")
$LureDay = IniRead($INIFile, "Lure", "LureDay", "2")

GUICtrlCreateLabel("Fishes", 260, 365)
$CatchAmountDayChange = GUICtrlCreateInput("", 260, 380, 40, 20)
GUICtrlSetLimit($CatchAmountDayChange, 3)

GUICtrlCreateLabel("Latency", 260, 405)
$LatencyDayChange = GUICtrlCreateInput("", 260, 420, 40, 20)
GUICtrlSetLimit($LatencyDayChange, 4)

GUICtrlCreateLabel("Resolution", 260, 445)
$ResolutionXDayChange = GUICtrlCreateInput("", 260, 460, 40, 20)
GUICtrlSetLimit($ResolutionXDayChange, 4)

GUICtrlCreateLabel("X", 302, 463)
$ResolutionYDayChange = GUICtrlCreateInput("", 310, 460, 40, 20)
GUICtrlSetLimit($ResolutionYDayChange, 4)

$PoleDayChange = GUICtrlCreateInput("", 380, 385, 13, 16)
GUICtrlSetLimit($PoleDayChange, 1)
GUICtrlCreateLabel("Pole", 395, 385)

$LureDayChange = GUICtrlCreateInput("", 380, 410, 13, 16)
GUICtrlSetLimit($LureDayChange, 1)
GUICtrlCreateLabel("Lure", 395, 410)

; CHECKBOX
GUICtrlCreateCheckbox("Apply Lure?", 380, 430, 80, 20)
GUICtrlSetState(-1, 1)


GUISetState(@SW_SHOW)
; Set Control Data
GUICtrlSetData($CatchAmountDayChange, $CatchAmountDay)
GUICtrlSetData($LatencyDayChange, $LatencyDay)
GUICtrlSetData($ResolutionXDayChange, $ResolutionXDay)
GUICtrlSetData($ResolutionYDayChange, $ResolutionYDay)
GUICtrlSetData($PoleDayChange, $PoleDay)
GUICtrlSetData($LureDayChange, $LureDay)


; BUTTON
$ChangeData = GUICtrlCreateButton("Go Fish!", 380, 460, 80, 30)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Call("SetData")
            Exit

        Case $ChangeData
            Call("SetData")
            ConsoleWrite("gone fishing" & @CRLF)
       ;DAYLIGHT
    ;I don't see what these next lines are for because you read the values in setdata,
    ;so you are only putting back what is already there.
            #cs
            GUICtrlSetData($CatchAmountDayChange, $CatchAmountDay)
            GUICtrlSetData($LatencyDayChange, $LatencyDay)
            GUICtrlSetData($ResolutionXDayChange, $ResolutionXDay)
            GUICtrlSetData($ResolutionYDayChange, $ResolutionYDay)
            GUICtrlSetData($PoleDayChange, $PoleDay)
            GUICtrlSetData($LureDayChange, $LureDay)
            #ce
        EndSwitch
    WEnd
    
Func SetData()
;DAYLIGHT
ConsoleWrite("setting data" & @CRLF)
    $CatchAmountDay = GUICtrlRead($CatchAmountDayChange)
    If $CatchAmountDay = "" Then $CatchAmountDay = "100"
    
    $LatencyDay = GUICtrlRead($LatencyDayChange)
    If $LatencyDay = "" Then $LatencyDay = "100"

    $ResolutionXDay = GUICtrlRead($ResolutionXDayChange)
    If $ResolutionXDay = "" Then $ResolutionXDay = "800"

    $ResolutionYDay = GUICtrlRead($ResolutionYDayChange)
    If $ResolutionYDay = "" Then $ResolutionYDay = "600"

    $PoleDay = GUICtrlRead($PoleDayChange)
    If $PoleDay = "" Then $PoleDay = "1"
    
    $LureDay = GUICtrlRead($LureDayChange)
    If $LureDay = "" Then $LureDay = "2"
    
    IniWrite($INIFile, "CatchAmount", "CatchAmountDay", $CatchAmountDay)
    IniWrite($INIFile, "Latency", "LatencyDay", $LatencyDay)
    IniWrite($INIFile, "Resolution", "ResolutionXDay", $ResolutionXDay)
    IniWrite($INIFile, "Resolution", "ResolutionYDay", $ResolutionYDay)
    IniWrite($INIFile, "Pole", "PoleDay", $PoleDay)
    IniWrite($INIFile, "Lure", "LureDay", $LureDay)
    EndFunc ;==>SetData

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

The Hex values in the split string at the top of the script won't read like it was intended.

When you click on an option in the tree, the square to the right in the GUI will update it's color to correspond to value defined in the splitstring.

and write the value to an *.ini file.

I was thinking that the setonvent could maybe include the input values aswell? Or would that only create a never ending loop?

Link to comment
Share on other sites

The Hex values in the split string at the top of the script won't read like it was intended.

When you click on an option in the tree, the square to the right in the GUI will update it's color to correspond to value defined in the splitstring.

and write the value to an *.ini file.

I was thinking that the setonvent could maybe include the input values aswell? Or would that only create a never ending loop?

OK, I missed the bit where you have set in events in a loop, so instead I should have kept the on event option and removed the GuiGetMsg() part.

I've moved all the functions to be at the end of the script.

#include <GuiConstants.au3>
#include <Constants.au3>
#include <GuiTreeView.au3>

Opt("GUIOnEventMode", 1)

Global $INIFile = @ScriptDir & "\Settings.ini"
Global $ColorDay = StringSplit("Alterac Mountains (130),0xC49D72,0x48567D,0xA6361E|" & _
        "Arathi Highlands (130),0x97644F,0x393045,0x8B2920|" & _
        "Burning Steppes (330),0xB1925C,0x3A373E,0xAB3A1C|" & _
        "Deadwind Pass (330),0x4C4D47,0x273244,0x43211F", "|")

; GUI
$MyGUI = GUICreate("FishIt", 480, 500, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "EventDay", $MyGUI)
GUISetIcon(@SystemDir & "\mspaint.exe", 0)
$title = "FishIt"

; TAB
GUICtrlCreateTab(0, 0, 480, 500)
GUICtrlCreateTabItem("Daylight")
GUICtrlCreateLabel("Place (Skill) ", 40, 40)

; TREEVIEW DAYLIGHT
$PlacesDay = GUICtrlCreateTreeView(20, 60, 220, 420, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)

$EasternKingdoms = GUICtrlCreateTreeViewItem("Eastern Kingdoms", $PlacesDay)
$AlteracMountains = SetItemsA("Alterac Mountains (130)", $EasternKingdoms)
$ArathiHighlands = SetItemsA("Arathi Highlands (130)", $EasternKingdoms)
$ArathiHighlands = SetItemsA("Arathi Highlands (130)", $EasternKingdoms)
$BurningSteppes = SetItemsA("Burning Steppes (330)", $EasternKingdoms)
$DummyDay = GUICtrlCreateDummy()
For $ListDay = $PlacesDay To $DummyDay
    GUICtrlSetOnEvent($ListDay, "EventDay")
Next

$BobberColorDay = GUICtrlCreateLabel("", 420, 60, 40, 40, -1, $WS_EX_CLIENTEDGE)


;IS IN CONFLICT TO WRITE TO INI WITH FOLLOWING FUNCTION (I think)

$CatchAmountDay = IniRead($INIFile, "CatchAmount", "CatchAmountDay", "100")
$LatencyDay = IniRead($INIFile, "Latency", "LatencyDay", "100")
$ResolutionXDay = IniRead($INIFile, "Resolution", "ResolutionXDay", "800")
$ResolutionYDay = IniRead($INIFile, "Resolution", "ResolutionYDay", "600")
$PoleDay = IniRead($INIFile, "Pole", "PoleDay", "1")
$LureDay = IniRead($INIFile, "Lure", "LureDay", "2")

GUICtrlCreateLabel("Fishes", 260, 365)
$CatchAmountDayChange = GUICtrlCreateInput("", 260, 380, 40, 20)
GUICtrlSetLimit($CatchAmountDayChange, 3)

GUICtrlCreateLabel("Latency", 260, 405)
$LatencyDayChange = GUICtrlCreateInput("", 260, 420, 40, 20)
GUICtrlSetLimit($LatencyDayChange, 4)

GUICtrlCreateLabel("Resolution", 260, 445)
$ResolutionXDayChange = GUICtrlCreateInput("", 260, 460, 40, 20)
GUICtrlSetLimit($ResolutionXDayChange, 4)

GUICtrlCreateLabel("X", 302, 463)
$ResolutionYDayChange = GUICtrlCreateInput("", 310, 460, 40, 20)
GUICtrlSetLimit($ResolutionYDayChange, 4)

$PoleDayChange = GUICtrlCreateInput("", 380, 385, 13, 16)
GUICtrlSetLimit($PoleDayChange, 1)
GUICtrlCreateLabel("Pole", 395, 385)

$LureDayChange = GUICtrlCreateInput("", 380, 410, 13, 16)
GUICtrlSetLimit($LureDayChange, 1)
GUICtrlCreateLabel("Lure", 395, 410)

; CHECKBOX
GUICtrlCreateCheckbox("Apply Lure?", 380, 430, 80, 20)
GUICtrlSetState(-1, 1)


GUISetState(@SW_SHOW)
; Set Control Data
GUICtrlSetData($CatchAmountDayChange, $CatchAmountDay)
GUICtrlSetData($LatencyDayChange, $LatencyDay)
GUICtrlSetData($ResolutionXDayChange, $ResolutionXDay)
GUICtrlSetData($ResolutionYDayChange, $ResolutionYDay)
GUICtrlSetData($PoleDayChange, $PoleDay)
GUICtrlSetData($LureDayChange, $LureDay)


; BUTTON
$ChangeData = GUICtrlCreateButton("Go Fish!", 380, 460, 80, 30)
GUICtrlSetOnEvent($ChangeData, "Setdata")

While 1

    Sleep(50)

WEnd



Func SetData()
;DAYLIGHT
    ConsoleWrite("setting data" & @CRLF)
    $CatchAmountDay = GUICtrlRead($CatchAmountDayChange)
    If $CatchAmountDay = "" Then $CatchAmountDay = "100"

    $LatencyDay = GUICtrlRead($LatencyDayChange)
    If $LatencyDay = "" Then $LatencyDay = "100"

    $ResolutionXDay = GUICtrlRead($ResolutionXDayChange)
    If $ResolutionXDay = "" Then $ResolutionXDay = "800"

    $ResolutionYDay = GUICtrlRead($ResolutionYDayChange)
    If $ResolutionYDay = "" Then $ResolutionYDay = "600"

    $PoleDay = GUICtrlRead($PoleDayChange)
    If $PoleDay = "" Then $PoleDay = "1"

    $LureDay = GUICtrlRead($LureDayChange)
    If $LureDay = "" Then $LureDay = "2"

    IniWrite($INIFile, "CatchAmount", "CatchAmountDay", $CatchAmountDay)
    IniWrite($INIFile, "Latency", "LatencyDay", $LatencyDay)
    IniWrite($INIFile, "Resolution", "ResolutionXDay", $ResolutionXDay)
    IniWrite($INIFile, "Resolution", "ResolutionYDay", $ResolutionYDay)
    IniWrite($INIFile, "Pole", "PoleDay", $PoleDay)
    IniWrite($INIFile, "Lure", "LureDay", $LureDay)
EndFunc  ;==>SetData

Func SetItemsA($sA, $iA)
    Local $tvi = GUICtrlCreateTreeViewItem($sA, $iA)
    GUICtrlCreateTreeViewItem("Bobber", $tvi)
    GUICtrlCreateTreeViewItem("Blue Feather", $tvi)
    GUICtrlCreateTreeViewItem("Red Feather", $tvi)
    Return $tvi
EndFunc  ;==>SetItemsA



Func EventDay()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            Switch GUICtrlRead(@GUI_CtrlId, 1)
                Case "Bobber"
                    GUICtrlSetBkColor($BobberColorDay, FindColorDay(@GUI_CtrlId, 1))
                Case "Blue Feather"
                    GUICtrlSetBkColor($BobberColorDay, FindColorDay(@GUI_CtrlId, 2))
                Case "Red Feather"
                    GUICtrlSetBkColor($BobberColorDay, FindColorDay(@GUI_CtrlId, 3))
                Case Else
                    GUICtrlSetBkColor($BobberColorDay, 0xFFFF00)
            EndSwitch
    EndSwitch
EndFunc  ;==>EventDay

Func FindColorDay($cID, $LGD)
    For $ListDay = 1 To $ColorDay[0]
        If StringInStr($ColorDay[$ListDay], GUICtrlRead(_GUICtrlTreeView_GetParentParam($PlacesDay, $cID), 1)) Then
            Local $SSC = StringSplit($ColorDay[$ListDay], ",")
            IniWrite($INIFile, "ColorChoice", "ColorBobberDay", $SSC[$LGD + 1])
            Return $SSC[$LGD + 1]
        EndIf
    Next
EndFunc  ;==>FindColorDay
Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thannk you :)

that made it g o again

How can I implement the checkbox "Apply Lure?"to Write either 1 for $GUI_Checked and 0 for $GUI_unchecked to the ini file.

Ive only gotten it to write either 4 or 0 very random.

and is it possible to make the "Go Fish! button start another script (FishItDay.au3 resp. FishItMoon.au3) and then close the GUI when pressed

Is it best to use the GUIdelete() ?

Will the function be able to write to the ini file properly to the ini file without any use of any sleep() functions?

Edited by PrinsBertil
Link to comment
Share on other sites

Thannk you :)

that made it g o again

How can I implement the checkbox "Apply Lure?"to Write either 1 for $GUI_Checked and 0 for $GUI_unchecked to the ini file.

Ive only gotten it to write either 4 or 0 very random.

First thing is you need to know the ID for the checkbox, so do this

$chkApply = GUICtrlCreateCheckbox("Apply Lure?", 380, 430, 80, 20)

use GuiCtrlRead like this

If BitAnd(GUICtrlRead($chkApply),$GUI_CHECKED) = $GUI_CHECKED Then
 $chkState = 1;it is checked
else
 $chkState = 0
endif
;then write the state to the ini file

and is it possible to make the "Go Fish! button start another script (FishItDay.au3 resp. FishItMoon.au3) and then close the GUI when pressed

Is it best to use the GUIdelete() ?

You can run another script like this

;choose which one you want
$AutoItexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir");installDir for production
;$AutoItexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "betaInstallDir");installDir for Beta

Run('"' & $AutoItexePath & '\AutoIt3.exe "' & ' "' & @ScriptDir & '\FishitMoon.au3"')

Just have "Exit" after the run and the script will be exited assuming that is what you want.

Will the function be able to write to the ini file properly to the ini file without any use of any sleep() functions?

What Sleep functions? Or if you mean should you add some, then no. The only Sleep is in the while/wend idle loop which is needed to stop over use of CPU time.

EDIT: Added missing quotation mark pointed out by PrinsBertil.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Ahh thank you =)

You can run another script like this

;choose which one you want
$AutoItexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir");installDir for production
;$AutoItexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "betaInstallDir");installDir for Beta

Run('"' & $AutoItexePath & '\AutoIt3.exe "' & ' "' & @ScriptDir & '\FishitMoon.au3')
I use the production release.

the string does how ever not work for me, I get an error when I try run the file

error string "Line 0 U(File "C:\M\Fishit\"C:\Fishit\Fishitmoon.au3"):

Error: Error opening the file.

Edit: Solved it.

Did not see it clearly but there it was =P (had to write it out as you normaly make shortcuts)

and then compare it. one small quotation can mess things up and when there is alot you have to focus on where they are XD

Run('' & $AutoItexePath &'\AutoIt3.exe ' & ' "' & @ScriptDir & '\FishitConf.au3"')
Edited by PrinsBertil
Link to comment
Share on other sites

Ahh thank you =)

I use the production release.

the string does how ever not work for me, I get an error when I try run the file

error string "Line 0 U(File "C:\M\Fishit\"C:\Fishit\Fishitmoon.au3"):

Error: Error opening the file.

Edit: Solved it.

Did not see it clearly but there it was =P (had to write it out as you normaly make shortcuts)

and then compare it. one small quotation can mess things up and when there is alot you have to focus on where they are XD

Run('' & $AutoItexePath &'\AutoIt3.exe ' & ' "' & @ScriptDir & '\FishitConf.au3"')
I'm glad you found that, sorry I missed it out. I'll correct my post.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...