marfdaman Posted July 5, 2006 Posted July 5, 2006 OK, I'll fix it...hang on... Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
marfdaman Posted July 5, 2006 Posted July 5, 2006 Are you sure? The only "bug" I ran into is when you select a user's parent (eg. A or , it changes the username to A or B etc. and leaves the other fields the same. I don't, however, get any 0's returned when I click anywhere else in the treeview area Everything just stays the same. Fixed: expandcollapse popup#include <GUIConstants.au3> #Include <Constants.au3> #include <array.au3> Dim $Location = @DesktopDir & "\MSTSC.ini" ;===================================> GUI <======================================= GUICreate("Verbinding met extern bureaublad", 400, 508) GUICtrlCreatePic("mstsc.jpg",0,0, 400,70) GUISetBkColor (0xECE9D8) ;===================================> Buttons <=================================== $Connectbutton = GUICtrlCreateButton("Verbinding maken", 30, 460, 150) $Cancelbutton = GUICtrlCreateButton("Annuleren", 205, 460, 150) ;===================================> Create Treeview <=========================== $treeview = GUICtrlCreateTreeView(6, 76, 388, 200, BitOR($tvs_hasbuttons, $tvs_haslines, $tvs_linesatroot, $tvs_disabledragdrop, $tvs_showselalways), $ws_ex_clientedge) ;===================================> Labels <==================================== $IP=GUICtrlCreateLabel ("IP Adres :",50 ,320 ,85 ,20) $Gebruikersnaam=GUICtrlCreateLabel ("Gebruikersnaam :",50 ,360 ,85 ,20) $Wachtwoord=GUICtrlCreateLabel ("Wachtwoord :",50 ,400 ,85 ,20) ;===================================> Input Fields <============================== $IPValue=GuiCtrlCreateInput("",150, 318, 150, 20) $GebruikersnaamValue=GuiCtrlCreateInput("",150, 358, 150, 20) $WachtwoordValue=GuiCtrlCreateInput("",150, 398, 150, 20);, $ES_PASSWORD ;===================================> Read INI <================================== $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() $mouseinfo = GUIGetCursorInfo() Select Case $msg = $gui_event_close ExitLoop Case $msg = $Connectbutton ExitLoop;Some action will come here instead of exitloop Case $msg = $Cancelbutton ExitLoop Case $mouseinfo[4] = $treeview And $mouseinfo[2] = 1 $value = GUICtrlRead(GUICtrlRead($treeview), 1) If StringLen($value[0]) > 1 Then GUICtrlSetData($GebruikersnaamValue, $value[0]) $temp = IniRead($Location, StringLeft($value[0], 1), $value[0], "") $data = StringSplit($temp, "|") If IsArray($data) And $data[0] <> 1 Then GUICtrlSetData($IPValue, $data[1]) GUICtrlSetData($GebruikersnaamValue, $data[2]) GUICtrlSetData($WachtwoordValue, $data[3]) EndIf EndIf EndSelect Sleep(10) WEnd Edit: it did return 0 if you clicked anywhere, but only the 1st time. Alzo Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Iznogoud Posted July 5, 2006 Author Posted July 5, 2006 Yes thats what i meant, but if you select a item the 0 will be gone. I tried this with a IF statement but then it shows the 0 or it shows nothing . But if i run your code with this ini file: [A] Ad=IPadress|Username|Password [B] B=IPadress2|Username2|Password2 [C] C=IPadress3|Username3|Password3 [D] D=IPadress4|Username4|Password4 and i click on Ad and then i click on B, the inputfields keep showing the information from Ad
marfdaman Posted July 5, 2006 Posted July 5, 2006 (edited) You should change the keys in your ini file to at least two characters, because my script filters out the ones that have 1 char , eg. B-> BB etc Edit: change B=IPadress2|Username2|Password2 to BB=IPadress2|Username2|Password2 for example Edited July 5, 2006 by marfdaman Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Iznogoud Posted July 5, 2006 Author Posted July 5, 2006 You should change the keys in your ini file to at least two characters, because my script filters out the ones that have 1 char , eg. B-> BB etc Edit: change B=IPadress2|Username2|Password2 to BB=IPadress2|Username2|Password2 for exampleYou are right, Offcourse It was just for testing and in a real situation i would never get one character.Thx for your great help for so far. First i will try to understand the code so i don't have to ask these stupid questions.
Iznogoud Posted July 5, 2006 Author Posted July 5, 2006 Its getting clear to me, but some weird thing is still happening wich i had before GUICtrlRead($IPValue, 1) MsgBox(1024, "Test", $IPValue) ;RunWait(@ComSpec & " /c " & 'mstsc /v:' & $IPValue & ' /f /console', "", @SW_HIDE) If i put this on the ConnectButton and select a TreeViewItem and click on the button wich execute this part of the script i get the value "10" So i though i put the ,1 after it what you said before, but that didn't help either. Is this even possible to do? I ques so but . . . .
marfdaman Posted July 5, 2006 Posted July 5, 2006 Are you sure? This works fine for me: expandcollapse popup#include <GUIConstants.au3> #Include <Constants.au3> #include <array.au3> Dim $Location = @DesktopDir & "\MSTSC.ini" ;===================================> GUI <======================================= GUICreate("Verbinding met extern bureaublad", 400, 508) GUICtrlCreatePic("mstsc.jpg",0,0, 400,70) GUISetBkColor (0xECE9D8) ;===================================> Buttons <=================================== $Connectbutton = GUICtrlCreateButton("Verbinding maken", 30, 460, 150) $Cancelbutton = GUICtrlCreateButton("Annuleren", 205, 460, 150) ;===================================> Create Treeview <=========================== $treeview = GUICtrlCreateTreeView(6, 76, 388, 200, BitOR($tvs_hasbuttons, $tvs_haslines, $tvs_linesatroot, $tvs_disabledragdrop, $tvs_showselalways), $ws_ex_clientedge) ;===================================> Labels <==================================== $IP=GUICtrlCreateLabel ("IP Adres :",50 ,320 ,85 ,20) $Gebruikersnaam=GUICtrlCreateLabel ("Gebruikersnaam :",50 ,360 ,85 ,20) $Wachtwoord=GUICtrlCreateLabel ("Wachtwoord :",50 ,400 ,85 ,20) ;===================================> Input Fields <============================== $IPValue=GuiCtrlCreateInput("",150, 318, 150, 20) $GebruikersnaamValue=GuiCtrlCreateInput("",150, 358, 150, 20) $WachtwoordValue=GuiCtrlCreateInput("",150, 398, 150, 20);, $ES_PASSWORD ;===================================> Read INI <================================== $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() $mouseinfo = GUIGetCursorInfo() Select Case $msg = $gui_event_close ExitLoop Case $msg = $Connectbutton MsgBox(0, "IP-address:", GUICtrlRead($IPValue)) Case $msg = $Cancelbutton ExitLoop Case $mouseinfo[4] = $treeview And $mouseinfo[2] = 1 $value = GUICtrlRead(GUICtrlRead($treeview), 1) If StringLen($value[0]) > 1 Then GUICtrlSetData($GebruikersnaamValue, $value[0]) $temp = IniRead($Location, StringLeft($value[0], 1), $value[0], "") $data = StringSplit($temp, "|") If IsArray($data) And $data[0] <> 1 Then GUICtrlSetData($IPValue, $data[1]) GUICtrlSetData($GebruikersnaamValue, $data[2]) GUICtrlSetData($WachtwoordValue, $data[3]) EndIf EndIf EndSelect Sleep(10) WEnd with this ini: [A] Ad=IPadress|Username|Password [B] BB=IPadress2|Username2|Password2 [C] CC=IPadress3|Username3|Password3 [D] DD=IPadress4|Username4|Password4 Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Iznogoud Posted July 5, 2006 Author Posted July 5, 2006 If i copy that code and run it with that ini it does work. But thats almost the same as i had before. Maybe its to hot to do this kinda work Sorry for bottering you.... :">
marfdaman Posted July 5, 2006 Posted July 5, 2006 No need to apologize, but if you still need help at some point, feel free to post! Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now