Ticket #822: Is tem in folder Options checked or not_EN.au3

File Is tem in folder Options checked or not_EN.au3, 8.0 KB (added by Nejat.Hakan@…, 16 years ago)

Is tem in folder Options checked or not

Line 
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")
35Run("explorer.exe /root, ,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
36
37;Run("explorer.exe")
38WinWait ($Titel_name_of_window_explorer, "", $Global_wait_time )
39If @error Then
40    MsgBox(0, "Error", "Explorer Window did not appear")
41        Exit
42EndIf
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)
47If @error Then
48    MsgBox(0, "Error", "Could not find toolbar")
49        Exit
50EndIf
51
52; Choose menu item Tools
53_GUICtrlToolbar_ClickIndex($handle_of_SysTabControl, 4, "left", True)
54;chose Options then
55send("o")
56
57
58
59
60; ########################################
61; # Wait for folderoptions for X seconds #
62; ########################################
63WinWait ($Titel_name_of_window_folder_options, "", $Global_wait_time )
64
65If @error Then
66    MsgBox(0, "Error", "folder options did not appear within " & $Global_wait_time & " seconds")
67        Exit
68Else
69        WinActivate($Titel_name_of_window_folder_options)
70EndIf
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
78If @error Then
79    MsgBox(0, "Error", "Could not get handle of window " & $Titel_name_of_window_folder_options)
80        Exit
81Else
82        MsgBox(0,"Handle", "Handle of window " & $Titel_name_of_window_folder_options & ": " & $handle_of_window_folder_options)
83EndIf
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]")
93If @error Then
94        MsgBox(0, "Error", "Could not get handle of SysTabControl32")
95        Exit
96Else
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)
100EndIf
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
110If @error Then
111        MsgBox(0, "Error", "Could not find tab " & $Name_of_tab_View_in_folder_options)
112        Exit
113Else
114        MsgBox(0, "Index", "Zero based index of tab View: " & $Zero_based_index_of_tab_View)
115EndIf
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)
124If @error Then
125        MsgBox(0, "Error", "Could not click the tab " & $Name_of_tab_View_in_folder_options)
126        Exit
127EndIf
128
129
130; ###############################
131; # Get Handle of SysTreeView32 #
132; ###############################
133$handle_of_treeview = ControlGetHandle($Titel_name_of_window_folder_options, "", "[CLASS:SysTreeView32; INSTANCE:1]")
134If @error Then
135        MsgBox(0, "Error", "Could not get handle of SysTreeView32")
136        Exit
137Else
138        MsgBox(0,"Handle", "Handle of SysTreeView32: " & $handle_of_treeview)
139EndIf
140
141
142; #######################################################
143; # Handle des ersten Items der SysTreeView32 ermitteln #
144; #######################################################
145$handle_of_first_item = _GUICtrlTreeView_GetFirstItem($handle_of_treeview)
146If @error Then
147        MsgBox(4096, "Error", "Konnte Handle des ersten Items der SysTreeView32 nicht ermitteln")
148Else
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))
151EndIf
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)
158If @error Then
159        MsgBox(4096, "Error", "Konnte Handle des nächsten Items der SysTreeView32 nicht ermitteln")
160Else
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))
163EndIf
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)
170FileWriteLine ( $file, $text )
171
172$next_item = _GUICtrlTreeView_GetNext($handle_of_treeview, $first_item)
173$text = _GUICtrlTreeView_GetText($handle_of_treeview, $next_item)
174FileWriteLine ( $file, $text )
175
176FileClose($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)
184If $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
187Else
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))
190EndIf
191       
192       
193; #######################################
194; # Test if checkbox of item is checked #
195; #######################################
196MsgBox(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
204If @error Then
205        MsgBox(0, "Error", "Could not get handle of Button ""Cancel""")
206        Exit
207Else
208        MsgBox(0,"Handle", "Handle of Button ""Cancel"": " & $Handle_of_Button_Cancel)
209EndIf
210
211; #########################
212; # Click "Cancel" Button #
213; #########################
214
215_GUICtrlButton_Click($Handle_of_Button_Cancel)