Jump to content

Input info form .txt file


KenzoIT
 Share

Recommended Posts

Hi all,

How to input info from D:\mysql-server.txt or D:\mail-server.txt when I click MySQL-Server or Mail-Server.

Pls, help me solve the problems. Thanks !

Hi,

because i don't know how your input files are looking like, you have to code this part by yourself or post an example of them:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <TreeViewConstants.au3>
#include <StaticConstants.au3>
#include <GuiListView.au3>
#include <GuiTreeView.au3> ; added because of function _GUICtrlTreeView_GetSelected

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $treeview, $contactlist, $isp, $listview
    Local  $svr1, $svr2,$svr3
    Local $cancelbutton
    Local $data1, $data2,$data3, $data4, $data5
    Local $msg,  $item[10]
    
    
    GUICreate("Design by Kenzo", 900, 450)

    $treeview = GUICtrlCreateTreeView(10, 10, 170, 400, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
    
   
    $contactlist = GUICtrlCreateTreeViewItem("Contact List", $treeview)
    GUICtrlSetColor(-1, 0x0000C0)
    
    $svr1 = GUICtrlCreateTreeViewItem("MySQL-Server", $contactlist)
    $svr2 = GUICtrlCreateTreeViewItem("Mail-Server", $contactlist)
    $svr3 = GUICtrlCreateTreeViewItem("AD", $contactlist)
    
    
    
     $isp = GUICtrlCreateTreeViewItem("Database", $treeview)
    GUICtrlSetColor(-1, 0x0000C0)

    $data1 = GUICtrlCreateTreeViewItem("Data1", $isp)
    $data2 = GUICtrlCreateTreeViewItem("Data2", $isp)
    $data3 = GUICtrlCreateTreeViewItem("Data3", $isp)
    $data4 = GUICtrlCreateTreeViewItem("Data4", $isp)
    $data5 = GUICtrlCreateTreeViewItem("Data5", $isp)
    
     
    $cancelbutton = GUICtrlCreateButton("Cancel", 50, 420, 70, 20)

    GUICtrlSetState($contactlist, BitOR($GUI_EXPAND, $GUI_DEFBUTTON))    ; Expand the "General"-item and paint in bold
    GUICtrlSetState($isp, BitOR($GUI_EXPAND, $GUI_DEFBUTTON))    ; Expand the "Display"-item and paint in bold

    GUISetState()
    
    $listview = GUICtrlCreateListView("", 200, 10, 680, 400)
    ;_GUICtrlListView_SetExtendedListViewStyle($listview, BitOR($LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES))
    _GUICtrlListView_AddColumn($listview, "Fullname", 170)
    _GUICtrlListView_AddColumn($listview, "Role", 70)
    _GUICtrlListView_AddColumn($listview, "Major", 100)
    _GUICtrlListView_AddColumn($listview, "Cellphone", 150)
    _GUICtrlListView_AddColumn($listview, "Ext", 70)
    _GUICtrlListView_AddColumn($listview, "Email", 170)
    
    
    
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case Else
                If _GUICtrlTreeView_GetSelected ( $treeview, $svr1) Then
                    MsgBox (0,"","MySQL Selected")
                    ; open text file D:\mysql-server.txt and fill the listview
                ElseIf _GUICtrlTreeView_GetSelected ( $treeview, $svr2) Then
                    MsgBox (0,"","Mail Selected")
                    ; open text file D:\mail-server.txt and fill the listview
                EndIf
                sleep (1000)            
        EndSelect
    WEnd

    Exit
EndFunc

;-))

Stefan

Edited by 99ojo
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...