MrCreatoR Posted November 23, 2008 Share Posted November 23, 2008 (edited) HiI am trying to build a TreeView structure base on data from speific file, here is a structure of that file:Dir1 # 0 SubFolder # 0 SubSubFolder # 0 OtherSubFolder # 0 Some not needed line 0 Dir2 # 0 SubFolder1 # 0 SubFolder2 # 0Here i need to extract the lines where # char is found.Here is what i have so far:expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> $sUA_Config_File = @ScriptDir & "\UA.dat" $hGUI = GUICreate("TreeView Strucure Test", 505, 400, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_APPWINDOW)) $Folder_TreeView = GUICtrlCreateTreeView(15, 75, 200, 255, -1, $WS_EX_CLIENTEDGE) _Set_Folder_Struture() GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ;This is the engine that supose to collet and build the whole TreeView structure from file. Func _Set_Folder_Struture() Local $aRead_Ua_File = StringSplit(StringStripCR(FileRead($sUA_Config_File)), @LF) Local $sFolder_Name, $iParent_TV_ID = $Folder_TreeView, $iLast_TV_Item_ID = $Folder_TreeView For $i = 1 To $aRead_Ua_File[0] If Not StringRegExp($aRead_Ua_File[$i], ".*\t#.*") Then ContinueLoop $sFolder_Name = StringRegExpReplace(StringStripWS($aRead_Ua_File[$i], 3), "(.*)\t#.*", "\1") StringRegExpReplace($aRead_Ua_File[$i], "\A\t+", "") If @extended > 0 Then $iParent_TV_ID = $iLast_TV_Item_ID Else $iParent_TV_ID = $Folder_TreeView EndIf $iLast_TV_Item_ID = GUICtrlCreateTreeViewItem($sFolder_Name, $iParent_TV_ID) GUICtrlSetImage(-1, "Shell32.dll", -5, 3) GUICtrlSetImage(-1, "Shell32.dll", -4, 4) Next EndFuncThe script + ua.dat file you can download together from here (0.92 kb).At the end i need to get TV structure like this:Thanks. Edited November 23, 2008 by MrCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
ReFran Posted November 23, 2008 Share Posted November 23, 2008 Perhaps you can use this:http://www.autoitscript.com/forum/index.ph...amp;hl=Reinhardbr, Reinhard Link to comment Share on other sites More sharing options...
martin Posted November 23, 2008 Share Posted November 23, 2008 (edited) Here is a mjod to your scdript whicdh seemjs to work.l The tabs appeared as spaces for me so I allowed for tabs to exsist annd changed them for 4 spaces. When you have a subfolder following a subsubfolder the name of the relevant subfolder needs to be known so I used an array for that. expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> $sUA_Config_File = @ScriptDir & "\ua.dat" $hGUI = GUICreate("TreeView Strucure Test", 505, 400, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_APPWINDOW)) $Folder_TreeView = GUICtrlCreateTreeView(15, 75, 200, 255, -1, $WS_EX_CLIENTEDGE) _Set_Folder_Struture() GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ;This is the engine that supose to collet and build the whole TreeView structure from file. Func _Set_Folder_Struture() Local $alltext = FileRead($sUA_Config_File) Local $leadspace, $depth[20];assume max depth of 20 levels $alltext = StringReplace($alltext, Chr(9), " ") Local $aRead_Ua_File = StringSplit(StringStripCR($alltext), @LF) Local $sFolder_Name, $iParent_TV_ID = $Folder_TreeView, $iLast_TV_Item_ID = $Folder_TreeView For $i = 1 To $aRead_Ua_File[0] If Not StringRegExp($aRead_Ua_File[$i], ".*#.*") Then ContinueLoop $sFolder_Name = StringStripWS(StringRegExpReplace($aRead_Ua_File[$i], "(.*)#.*", "\1"), 3) $stripped = StringStripWS($aRead_Ua_File[$i], 1) $leadspace = StringLen($aRead_Ua_File[$i]) - StringLen($stripped) If $leadspace > 1 Then $iParent_TV_ID = $depth[Int($leadspace / 4) - 1] ConsoleWrite("parent = " & $depth[Int($leadspace / 4) - 1] & ", folder name = " & $sFolder_Name & @CRLF) Else $iParent_TV_ID = $Folder_TreeView EndIf $iLast_TV_Item_ID = GUICtrlCreateTreeViewItem($sFolder_Name, $iParent_TV_ID) $depth[Int($leadspace / 4)] = $iLast_TV_Item_ID GUICtrlSetImage(-1, "Shell32.dll", -5, 3) GUICtrlSetImage(-1, "Shell32.dll", -4, 4) Next EndFunc ;==>_Set_Folder_Struture EDIT: replaced "\t" with Chr(9) Edited November 24, 2008 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 More sharing options...
MrCreatoR Posted November 23, 2008 Author Share Posted November 23, 2008 Perhaps you can use this: http://www.autoitscript.com/forum/index.ph...amp;hl=Reinhard br, ReinhardThanks i will try it. Here is a mjod to your scdript whicdh seemjs to work.l The tabs appeared as spaces for me so I allowed for tabs to exsist annd changed them for 4 spaces. When you have a subfolder following a subsubfolder the name of the relevant subfolder needs to be known so I used an array for that. Is it works for you? i get error: Array variable subscript badly formatted.: $iParent_TV_ID = $depth[int($leadspace / 4) - 1] $iParent_TV_ID = $depth[^ ERROR P.S I can't change the file structure, it's must remain as is. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
MrCreatoR Posted November 23, 2008 Author Share Posted November 23, 2008 @ReFran Thanks a lot, your example helped me to build the algorithm for my task: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> $sUA_Config_File = @ScriptDir & "\UA.dat" $hGUI = GUICreate("TreeView Structure Test", 505, 400, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_APPWINDOW)) $Folder_TreeView = GUICtrlCreateTreeView(15, 75, 200, 255, -1, $WS_EX_CLIENTEDGE) _Set_Folder_Structure() GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ;This is the engine that supose to collet and build the whole TreeView structure from file. Func _Set_Folder_Structure() Local $aRead_Ua_File = StringSplit(StringStripCR(FileRead($sUA_Config_File)), @LF) Local $sFolder_Name, $hTV_Item[$aRead_Ua_File[0]+1], $iLevel = 0 For $i = 1 To $aRead_Ua_File[0] If Not StringRegExp($aRead_Ua_File[$i], ".*\t#.*") Then ContinueLoop $sFolder_Name = StringRegExpReplace(StringStripWS($aRead_Ua_File[$i], 3), "(.*)\t#.*", "\1") $iLevel = StringLen(StringRegExpReplace($aRead_Ua_File[$i], "\A(\t+).*", "\1"))+1 If $iLevel < 1 Or StringLeft($aRead_Ua_File[$i], 1) <> " " Then $iLevel = 1 If $iLevel = 1 Then $hTV_Item[$iLevel] = _GUICtrlTreeView_Add($Folder_TreeView, 0, $sFolder_Name) Else $hTV_Item[$iLevel] = _GUICtrlTreeView_AddChild($Folder_TreeView, $hTV_Item[$iLevel-1], $sFolder_Name) EndIf _GUICtrlTreeView_SetIcon($Folder_TreeView, $hTV_Item[$iLevel], "Shell32.dll", -4, 3) _GUICtrlTreeView_SetIcon($Folder_TreeView, $hTV_Item[$iLevel], "Shell32.dll", -5, 4) Next EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
martin Posted November 23, 2008 Share Posted November 23, 2008 (edited) Thanks i will try it.Is it works for you? i get error:P.SI can't change the file structure, it's must remain as is.Well it works for me using the file you posted. Maybe it's because copying the text from your post gives spaces where there should be tabs. Edited November 23, 2008 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 More sharing options...
MrCreatoR Posted November 23, 2008 Author Share Posted November 23, 2008 One more question (sorry for this small offtop ):How to get the index of specific item base on Item handle? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
MrCreatoR Posted November 23, 2008 Author Share Posted November 23, 2008 Well it works for me using the file you posted. Maybe it's because copying the text from your post gives spaces where there should be tabs.Yes, but i also uploaded the file seperatly for that reason Never mind, thanks for the help in any case, your help is always appreciated . Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
ReFran Posted November 23, 2008 Share Posted November 23, 2008 ..... Thanks a lot, your example helped me to build the algorithm for my task: .... Fine that it helped you. I use it also a little bit different, but wanted to have a good start up for different tasks. So I set up that example. Don't forget to use in your final version: _GUICtrlTreeView_BeginUpdate($hTree) ... _GUICtrlTreeView_EndUpdate($hTree) That speeds it up. Best regards, Reinhard Franke Link to comment Share on other sites More sharing options...
martin Posted November 24, 2008 Share Posted November 24, 2008 (edited) Yes, but i also uploaded the file seperatly for that reason Never mind, thanks for the help in any case, your help is always appreciated .I tried with the test file and I needed to change "\t" to Chr(9) - silly mistake. So I corrected my poost but a bit late now . Edited November 24, 2008 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 More sharing options...
MrCreatoR Posted November 24, 2008 Author Share Posted November 24, 2008 @martinMaybe you have an idea of how to solve the second issue? How to get the index of specific item base on Item handle?Because on some point i will need to write this TreeView structure to similar file. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
martin Posted November 24, 2008 Share Posted November 24, 2008 @martinMaybe you have an idea of how to solve the second issue? Because on some point i will need to write this TreeView structure to similar file.If you want to write the treeview to a file then I suppose you just need to loop through all the items, and for each item loop through the subitems etc. using getfirstchild, GetNextChild, GetNextSibling. As you go you need to increment the depth so for each item found you can write the correct number of tabs to prefix the item text. Probably needs a recursive function.(My typing has improved now I've thrown away the keyboard I spilt tea into yesterday!) 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 More sharing options...
ReFran Posted November 24, 2008 Share Posted November 24, 2008 .. If you want to write the treeview to a file then I suppose you just need to loop through all the items, and for ...Mmmh,the example I stated includes read from and write to file.br, Reinhard Link to comment Share on other sites More sharing options...
martin Posted November 24, 2008 Share Posted November 24, 2008 (edited) Mmmh, the example I stated includes read from and write to file. br, ReinhardSorry Reinhard, I should will look at your example.[exits stage left.] [Act II - later that same day] OK, I've had a look. Seems to be just what MrCreatoR needs except that the leading spaces need to be leading tabs. Edited November 24, 2008 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 More sharing options...
MrCreatoR Posted November 24, 2008 Author Share Posted November 24, 2008 Thanks guys, but i need to write specific items (marked later), not the all tree. So the main question is: How to get item index by it's handle? (the handles collected to array when the items been marked, so i just need to check the array and write the levels base on the items indexes). Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
ReFran Posted November 24, 2008 Share Posted November 24, 2008 Thanks guys, but i need to write specific items (marked later), not the all tree. So the main question is: How to get item index by it's handle? (the handles collected to array when the items been marked, so i just need to check the array and write the levels base on the items indexes).Not so much time right now!You can use the loop in my example, then get via UDF if it is selected and then use _GUICtrlTreeView_Index($hWnd, $hItem)to get the index.HTH, Reinhard Link to comment Share on other sites More sharing options...
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