Jump to content

GUI that looks in an ini for a dynamic key, if finds it, it shows the sections the key is found in in drop-down. How can I do this? Thanks!


CrewXp
 Share

Recommended Posts

this worked

Global $macrolist[10], $macrolistdata[50]
#include <GUIConstants.au3>
#Include <Constants.au3>
#include <array.au3>
; need this for my testing..... ok???
Dim $Location = "C:\Temp\sections.ini"
Dim $Location2 = "C:\Temp\pagedetails.ini"

;===================================> GUI <=======================================

GUICreate("Macro v1.0", 400, 460)
$filemenu = GUICtrlCreateMenu("File")
$optionsmenu = GUICtrlCreateMenu("Options")
$helpmenu = GUICtrlCreateMenu("?")
$fileitem = GUICtrlCreateMenuItem("Exit", $filemenu)
$button = GUICtrlCreateButton("New", 335, 15, 60)

$btnsave = GUICtrlCreateButton("Save", 335, 145, 60)


$treeview = GUICtrlCreateTreeView(6, 6, 200, 250, BitOR($tvs_hasbuttons, $tvs_haslines, $tvs_linesatroot, $tvs_disabledragdrop, $tvs_showselalways), $ws_ex_clientedge)
$sections = IniReadSectionNames($Location)
If @error Then
    MsgBox(4096, "", "Error occured, probably no INI file.")
Else
    For $i = 1 To $sections[0]
        $keys = IniReadSection($Location, $sections[$i])
        $item = GUICtrlCreateTreeViewItem($sections[$i], $treeview)
        For $x = 1 To $keys[0][0]
            GUICtrlCreateTreeViewItem($keys[$x][0], $item)
        Next
    Next
EndIf

GUISetState()
;================================> End GUI <======================================


While 1
    $msg = GUIGetMsg()
    
    Select
    ;Case $msg = -3 Or $msg = -1 Or $msg = $cancelbutton
        Case $msg = $gui_event_close
            ExitLoop
        Case $msg = $button
            Call("Set_PageDetails")
            
    EndSelect
    
    Sleep(10)
    
WEnd


; ------------------------------- Functions --------------------------------

Func Set_PageDetails()
; read the selection
    $item1 = GUICtrlRead($treeview)
    $item2 = GUICtrlRead($item1, 1)
    
; read the ini portion rerquested
    $name = IniRead($Location2, $item2[0], "Name", "NotFound")
    $page = IniRead($Location2, $item2[0], "Page", "NotFound")
    $topic = IniRead($Location2, $item2[0], "Topic", "NotFound")
    $status = IniRead($Location2, $item2[0], "UserStatus", "NotFound")
    $editstatus = IniRead($Location2, $item2[0], "EditStatus", "NotFound")
    $duedate = IniRead($Location2, $item2[0], "Due", "NotFound")
    
; display the info just read
    GUICtrlCreateLabel("Assigned To: ", 10, 280, 100, 20, 0x1000)
    GUICtrlCreateInput($name, 10, 300, 100, 20)
    GUICtrlCreateLabel("Page #: ", 120, 280, 100, 20, 0x1000)
    GUICtrlCreateInput($page, 120, 300, 100, 20)
    GUICtrlCreateLabel("Topic: ", 10, 330, 100, 20, 0x1000)
    GUICtrlCreateInput($topic, 10, 350, 100, 20)
    GUICtrlCreateLabel("Status: ", 120, 330, 100, 20, 0x1000)
    GUICtrlCreateInput($status, 120, 350, 100, 20)
    GUICtrlCreateLabel("EditStatus: ", 10, 380, 100, 20, 0x1000)
    GUICtrlCreateInput($editstatus, 10, 400, 100, 20)
    GUICtrlCreateLabel("DUE: ", 120, 380, 100, 20, 0x1000)
    GUICtrlCreateInput($duedate, 120, 400, 100, 20)
EndFunc  ;==>Set_PageDetails

8)

edit

cleaned it up 8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

lol Valuater, you posted in the wrong topic. BUT IT WORKS! AWESOME. This was the MOST IMPORTANT tool I needed you did it!! omg, again thanks!

And last regarding the ladder I'm creating, I still need help with the program in the link above. The code Valuater posted was for my other topic, not this.

THANKS VALUATER!

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