1 | #Include <GuiMenu.au3> |
---|
2 | #include <GuiListView.au3> |
---|
3 | #include <GuiTab.au3> |
---|
4 | #include <GuiTreeView.au3> |
---|
5 | #include <GUIConstantsEx.au3> |
---|
6 | #Include <GuiButton.au3> |
---|
7 | #Include <GuiToolBar.au3> |
---|
8 | #include <WindowsConstants.au3> |
---|
9 | |
---|
10 | |
---|
11 | ;$Titel_name_of_window_explorer = "Arbeitsplatz" ; german language operating system |
---|
12 | $Titel_name_of_window_explorer = "My Computer" ; english language operating system |
---|
13 | |
---|
14 | ;$Name_of_menue_item_file_in_explorer_window = "&Datei" ; german language operating system |
---|
15 | $Name_of_menue_item_file_in_explorer_window = "&File" ; english language operating system |
---|
16 | |
---|
17 | ;$Titel_name_of_window_folder_options = "Ordneroptionen" ; german language operating system |
---|
18 | $Titel_name_of_window_folder_options = "Folder Options" ; english language operating system |
---|
19 | |
---|
20 | ;$Name_of_tab_View_in_folder_options = "Ansicht" ; german language operating system |
---|
21 | $Name_of_tab_View_in_folder_options = "View" ; english language operating system |
---|
22 | |
---|
23 | ;$Name_of_item_Remember_each_folders_view_settings = "Ansichtoptionen für jeden Ordner speichern" ; german language operating system |
---|
24 | $Name_of_item_Remember_each_folders_view_settings = "Remember each folder's view settings" ; english language operating system |
---|
25 | |
---|
26 | ; This value is used for the WinWait functions |
---|
27 | $Global_wait_time = 4 |
---|
28 | |
---|
29 | |
---|
30 | |
---|
31 | ; ######################## |
---|
32 | ; # Start folder options # |
---|
33 | ; ######################## |
---|
34 | ;run ("rundll32 shell32.dll, Options_RunDLL 0") |
---|
35 | Run("explorer.exe /root, ,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}") |
---|
36 | |
---|
37 | ;Run("explorer.exe") |
---|
38 | WinWait ($Titel_name_of_window_explorer, "", $Global_wait_time ) |
---|
39 | If @error Then |
---|
40 | MsgBox(0, "Error", "Explorer Window did not appear") |
---|
41 | Exit |
---|
42 | EndIf |
---|
43 | |
---|
44 | |
---|
45 | ;$handle_of_SysTabControl = ControlGetHandle($Titel_name_of_window_explorer, "", "[CLASS:ToolbarWindow32; INSTANCE:3]") |
---|
46 | $handle_of_SysTabControl = _GUICtrlToolbar_FindToolbar($Titel_name_of_window_explorer, $Name_of_menue_item_file_in_explorer_window) |
---|
47 | If @error Then |
---|
48 | MsgBox(0, "Error", "Could not find toolbar") |
---|
49 | Exit |
---|
50 | EndIf |
---|
51 | |
---|
52 | ; Choose menu item Tools |
---|
53 | _GUICtrlToolbar_ClickIndex($handle_of_SysTabControl, 4, "left", True) |
---|
54 | ;chose Options then |
---|
55 | send("o") |
---|
56 | |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | ; ######################################## |
---|
61 | ; # Wait for folderoptions for X seconds # |
---|
62 | ; ######################################## |
---|
63 | WinWait ($Titel_name_of_window_folder_options, "", $Global_wait_time ) |
---|
64 | |
---|
65 | If @error Then |
---|
66 | MsgBox(0, "Error", "folder options did not appear within " & $Global_wait_time & " seconds") |
---|
67 | Exit |
---|
68 | Else |
---|
69 | WinActivate($Titel_name_of_window_folder_options) |
---|
70 | EndIf |
---|
71 | |
---|
72 | |
---|
73 | ; ####################################### |
---|
74 | ; # Get handle of window folder options # |
---|
75 | ; ####################################### |
---|
76 | $handle_of_window_folder_options = WinGetHandle($Titel_name_of_window_folder_options) |
---|
77 | |
---|
78 | If @error Then |
---|
79 | MsgBox(0, "Error", "Could not get handle of window " & $Titel_name_of_window_folder_options) |
---|
80 | Exit |
---|
81 | Else |
---|
82 | MsgBox(0,"Handle", "Handle of window " & $Titel_name_of_window_folder_options & ": " & $handle_of_window_folder_options) |
---|
83 | EndIf |
---|
84 | |
---|
85 | |
---|
86 | |
---|
87 | |
---|
88 | |
---|
89 | ; ################################# |
---|
90 | ; # Get handle of SysTabControl32 # |
---|
91 | ; ################################# |
---|
92 | $handle_of_SysTabControl = ControlGetHandle($Titel_name_of_window_folder_options, "", "[CLASS:SysTabControl32; INSTANCE:1]") |
---|
93 | If @error Then |
---|
94 | MsgBox(0, "Error", "Could not get handle of SysTabControl32") |
---|
95 | Exit |
---|
96 | Else |
---|
97 | MsgBox(0,"Handle", "Handle of SysTabControl32: " & $handle_of_SysTabControl) |
---|
98 | $number_of_tabs = _GUICtrlTab_GetItemCount($handle_of_SysTabControl) |
---|
99 | MsgBox(0,"Tabs", "Number of tabs: " & $number_of_tabs) |
---|
100 | EndIf |
---|
101 | |
---|
102 | |
---|
103 | |
---|
104 | ; ############################## |
---|
105 | ; # Check if tab "View" exists # |
---|
106 | ; ############################## |
---|
107 | |
---|
108 | $Zero_based_index_of_tab_View = _GUICtrlTab_FindTab($handle_of_SysTabControl, $Name_of_tab_View_in_folder_options, True, 0) |
---|
109 | |
---|
110 | If @error Then |
---|
111 | MsgBox(0, "Error", "Could not find tab " & $Name_of_tab_View_in_folder_options) |
---|
112 | Exit |
---|
113 | Else |
---|
114 | MsgBox(0, "Index", "Zero based index of tab View: " & $Zero_based_index_of_tab_View) |
---|
115 | EndIf |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | ; ################################################# |
---|
120 | ; # Click the tab "View" identified by it's index # |
---|
121 | ; ################################################# |
---|
122 | |
---|
123 | _GUICtrlTab_ClickTab($handle_of_SysTabControl, $Zero_based_index_of_tab_View, "left", True, 1) |
---|
124 | If @error Then |
---|
125 | MsgBox(0, "Error", "Could not click the tab " & $Name_of_tab_View_in_folder_options) |
---|
126 | Exit |
---|
127 | EndIf |
---|
128 | |
---|
129 | |
---|
130 | ; ############################### |
---|
131 | ; # Get Handle of SysTreeView32 # |
---|
132 | ; ############################### |
---|
133 | $handle_of_treeview = ControlGetHandle($Titel_name_of_window_folder_options, "", "[CLASS:SysTreeView32; INSTANCE:1]") |
---|
134 | If @error Then |
---|
135 | MsgBox(0, "Error", "Could not get handle of SysTreeView32") |
---|
136 | Exit |
---|
137 | Else |
---|
138 | MsgBox(0,"Handle", "Handle of SysTreeView32: " & $handle_of_treeview) |
---|
139 | EndIf |
---|
140 | |
---|
141 | |
---|
142 | ; ####################################################### |
---|
143 | ; # Handle des ersten Items der SysTreeView32 ermitteln # |
---|
144 | ; ####################################################### |
---|
145 | $handle_of_first_item = _GUICtrlTreeView_GetFirstItem($handle_of_treeview) |
---|
146 | If @error Then |
---|
147 | MsgBox(4096, "Error", "Konnte Handle des ersten Items der SysTreeView32 nicht ermitteln") |
---|
148 | Else |
---|
149 | MsgBox(4096,"Handle", "Handle des ersten Items der SysTreeView32: " & $handle_of_first_item) |
---|
150 | MsgBox(4096,"Handle", "Text des ersten Items der SysTreeView32: " & _GUICtrlTreeView_GetText($handle_of_treeview, $handle_of_first_item)) |
---|
151 | EndIf |
---|
152 | |
---|
153 | |
---|
154 | ; ######################################################### |
---|
155 | ; # Handle des nächsten Items der SysTreeView32 ermitteln # |
---|
156 | ; ######################################################### |
---|
157 | $handle_of_next_item = _GUICtrlTreeView_GetNext($handle_of_treeview, $handle_of_first_item) |
---|
158 | If @error Then |
---|
159 | MsgBox(4096, "Error", "Konnte Handle des nächsten Items der SysTreeView32 nicht ermitteln") |
---|
160 | Else |
---|
161 | MsgBox(4096,"Handle", "Handle des nächsten Items: " & $handle_of_next_item) |
---|
162 | MsgBox(4096,"Handle", "Text des nächsten Items: " & _GUICtrlTreeView_GetText($handle_of_treeview, $handle_of_next_item)) |
---|
163 | EndIf |
---|
164 | |
---|
165 | |
---|
166 | $first_item = _GUICtrlTreeView_GetFirstItem($handle_of_treeview) |
---|
167 | |
---|
168 | $text = _GUICtrlTreeView_GetText($handle_of_treeview, $first_item) |
---|
169 | $file = FileOpen("c:\test.txt", 1) |
---|
170 | FileWriteLine ( $file, $text ) |
---|
171 | |
---|
172 | $next_item = _GUICtrlTreeView_GetNext($handle_of_treeview, $first_item) |
---|
173 | $text = _GUICtrlTreeView_GetText($handle_of_treeview, $next_item) |
---|
174 | FileWriteLine ( $file, $text ) |
---|
175 | |
---|
176 | FileClose($file) |
---|
177 | |
---|
178 | |
---|
179 | |
---|
180 | ; ############################################################ |
---|
181 | ; # Get handle of item "Remember each folder's view settings # |
---|
182 | ; ############################################################ |
---|
183 | $handle_of_item_Remember_each_folders_view_settings = _GUICtrlTreeView_FindItem($handle_of_treeview, $Name_of_item_Remember_each_folders_view_settings) |
---|
184 | If $handle_of_item_Remember_each_folders_view_settings = 0 Then |
---|
185 | MsgBox(0, "Error", "Could not find item """ & $Name_of_item_Remember_each_folders_view_settings & """") |
---|
186 | Exit |
---|
187 | Else |
---|
188 | MsgBox(0,"Handle", "Handle of tem """ & $Name_of_item_Remember_each_folders_view_settings & """: " & $handle_of_item_Remember_each_folders_view_settings) |
---|
189 | MsgBox(0,"Text", "Text of item """ & $Name_of_item_Remember_each_folders_view_settings & """: " & _GUICtrlTreeView_GetText($handle_of_treeview, $handle_of_item_Remember_each_folders_view_settings)) |
---|
190 | EndIf |
---|
191 | |
---|
192 | |
---|
193 | ; ####################################### |
---|
194 | ; # Test if checkbox of item is checked # |
---|
195 | ; ####################################### |
---|
196 | MsgBox(0,"Test checkbox of item", "Item """ & $Name_of_item_Remember_each_folders_view_settings & """ ? " & _GUICtrlTreeView_GetChecked($handle_of_treeview, $handle_of_item_Remember_each_folders_view_settings)) |
---|
197 | |
---|
198 | |
---|
199 | ; ################################# |
---|
200 | ; # Get Handle of Button "Cancel" # |
---|
201 | ; ################################# |
---|
202 | $Handle_of_Button_Cancel = ControlGetHandle ($Titel_name_of_window_folder_options, "", "[CLASS:Button; INSTANCE:6]") |
---|
203 | |
---|
204 | If @error Then |
---|
205 | MsgBox(0, "Error", "Could not get handle of Button ""Cancel""") |
---|
206 | Exit |
---|
207 | Else |
---|
208 | MsgBox(0,"Handle", "Handle of Button ""Cancel"": " & $Handle_of_Button_Cancel) |
---|
209 | EndIf |
---|
210 | |
---|
211 | ; ######################### |
---|
212 | ; # Click "Cancel" Button # |
---|
213 | ; ######################### |
---|
214 | |
---|
215 | _GUICtrlButton_Click($Handle_of_Button_Cancel) |
---|