loglorry Posted November 12, 2007 Share Posted November 12, 2007 Dear Board Sorry for the newbie question I'm new to autoit. I want to automate turning on a particular taskbar toolbar:- Run ("rundll32.exe shell32.dll,Options_RunDLL 1", "", @SW_HIDE) WinWaitActive ( "Taskbar and Start Menu Properties") WinActivate ( "Taskbar and Start Menu Properties") Send("^{TAB 3}") This script is pretty close to what I want to do. It displays a list of checkboxes and I want to search for a particular one "by name" and set it (not toggle it) (see picture attached). Unfortunately the control is not a simple list of checkboxes. I used AutiIt Window Info tool and discovered the controls are all in a type ofSysTreeView32 see below: >>>> Control <<<< Class: SysTreeView32 Instance: 1 ClassnameNN: SysTreeView321 ID: 1137 Text: DeskBandList Position: 21, 62 Size: 354, 260 ControlClick Coords: 232, 148 Style: 0x50010000 ExStyle: 0x00000204 Is there a way to control these checkboxes ? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 12, 2007 Moderators Share Posted November 12, 2007 You could see if ControlCommand() has what you want... and if it works. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
loglorry Posted November 12, 2007 Author Share Posted November 12, 2007 You could see if ControlCommand() has what you want... and if it works.No ControlCommand seems to only work with listbox, editbox, checkbox etc. etc. but not this treeview type control Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 12, 2007 Moderators Share Posted November 12, 2007 No ControlCommand seems to only work with listbox, editbox, checkbox etc. etc. but not this treeview type controlDid you try it?Also, there are other Control functions, including a treeview one. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Zedna Posted November 12, 2007 Share Posted November 12, 2007 (edited) Download latest beta and look into helpfile at User Defined Function Reference/GUITreeView ManagementThere are lots of usefull functions like:_GUICtrlTreeView_FindItem _GUICtrlTreeView_GetText _GUICtrlTreeView_SelectItem _GUICtrlTreeView_SetChecked ...You may also look at ControlTreeView()EDIT: ControlCommand really doesn't work wit TreeView Edited November 12, 2007 by Zedna Resources UDF  ResourcesEx UDF  AutoIt Forum Search Link to comment Share on other sites More sharing options...
loglorry Posted November 12, 2007 Author Share Posted November 12, 2007 Download latest beta and look into helpfile at User Defined Function Reference/GUITreeView Management There are lots of usefull functions like: _GUICtrlTreeView_FindItem _GUICtrlTreeView_GetText _GUICtrlTreeView_SelectItem _GUICtrlTreeView_SetChecked ... You may also look at ControlTreeView() EDIT: ControlCommand really doesn't work wit TreeView Thanks from my understanding of the documentation this should work :- Run ("rundll32.exe shell32.dll,Options_RunDLL 1", "", @SW_HIDE) WinWaitActive ( "Taskbar and Start Menu Properties") WinActivate ( "Taskbar and Start Menu Properties") Send("^{TAB 3}") ControlTreeView( "Taskbar and Start Menu Properties", "", "[ID:1137]", "Check", "Links") Alas it does not :-( The control seems to be ID:1137 so that should have worked. Link to comment Share on other sites More sharing options...
Zedna Posted November 14, 2007 Share Posted November 14, 2007 Thanks from my understanding of the documentation this should work :-Alas it does not :-(The control seems to be ID:1137 so that should have worked.If you have problems with ControlTreeView then try alternative way with _GUICtrlTreeView_SetChecked() Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
mbkowns Posted November 15, 2007 Share Posted November 15, 2007 I thought _GUICtrlTreeView was for trees you create not in other windows created trees. Is this true? Link to comment Share on other sites More sharing options...
Zedna Posted November 15, 2007 Share Posted November 15, 2007 I thought _GUICtrlTreeView was for trees you create not in other windows created trees. Is this true?No it's also for external treeviews. Look into its sources to see what' going on inside. Resources UDF  ResourcesEx UDF  AutoIt Forum Search Link to comment Share on other sites More sharing options...
mbkowns Posted November 15, 2007 Share Posted November 15, 2007 (edited) Okay cool I guess I could of wrote that more clear but you got exactly what I ment. Anyway how do I get TreeNode Handles? I have Winspector Spy but it doesn't reveal this it only shows the ID of the Systreeview. Edited November 15, 2007 by mbkowns Link to comment Share on other sites More sharing options...
mbkowns Posted November 15, 2007 Share Posted November 15, 2007 Also for _GUICtrlTreeView_SetChecked What do I #include<xxxxx.au3> ? I am looking through them and not finding that one. I have the latest beta installed. Link to comment Share on other sites More sharing options...
mbkowns Posted November 16, 2007 Share Posted November 16, 2007 bump Link to comment Share on other sites More sharing options...
Twisten Posted May 15, 2008 Share Posted May 15, 2008 (edited) ;you should #Include <GuiTreeView.au3> ;replace "Window Title" and ID with the appropriate values $hSTV = ControlGetHandle("Window Title", "", ID) ;to find the search text in the item string (partial text search vs. exact match) set to true $fInStr = True ;get the handles for two items, replace the search text with the appropriate text for your items $hFirst = _GUICtrlTreeView_FindItem($hSTV, "search text1", $fInStr) $hSecond = _GUICtrlTreeView_FindItem($hSTV, "search text2", $fInStr) ;if false unchecks the items, if true checks the items $fCheck = False ;change the items checked/unchecked status _GUICtrlTreeView_SetChecked($hSTV, $hFirst, $fCheck) _GUICtrlTreeView_SetChecked($hSTV, $hSecond, $fCheck) Now if someone would tell me why @#$$@! @$#%#% @!#(*)@$&! $@) /me colapses $currsel = ControlTreeView("Window title", "Window Text", ID, "IsChecked", "#1") works and returns the proper value, yet ControlTreeView("Window title", "Window Text", ID, "Check", "#1") does nothing more than select the item ?! I might know why/if i had to learn the answer to mbkowns's question on my second day of using autoit Edited May 15, 2008 by Twisten Link to comment Share on other sites More sharing options...
Twisten Posted May 16, 2008 Share Posted May 16, 2008 oh, never mind about my answer - it looks like its working but the parent window dosen't remember the changes looks like its back to the drawing board. why oh why couldn't ControlTreeView's "Check" command just work Link to comment Share on other sites More sharing options...
Twisten Posted May 16, 2008 Share Posted May 16, 2008 (edited) so after reading through the ginormous amount of posts conserning this very problem in several variation the conclution is that the autoit functions do exactly as they're suppose to but not as they are expected to! some cause the gui to refresh and display the unchecked / checked checkbox and all change its state to unchecked. (UDF and ControlTreeView). the expected result (especialy expected when using controltreeview) isn't accomplished the parent window dosen't seem to get the proper message that there was a state change and takes no notice of the checkbox. the solution i compromised on until someone with enough know how will write a short 'how to' for this, is to use controltreeview to select the checkbox that send a keyboard stroke (space) to the tree control, this produces the expected result since the parent window takes notice of the keyboard event. as an aside, i've also tried using control click with the tree item handle, which reports success but dosen't produce the end result. not sure if its because the tree items have handles but no IDs or some other reason, maybe that 'someone' mentioned before will also be able to explain this anyhow i hope this helps. Edited May 16, 2008 by Twisten 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