chiners_68 Posted January 26, 2007 Share Posted January 26, 2007 right, ive poached the example treeview 2 & modified to semi get going what i need. What i need to do now is open the local policies & enter user right assignment. then select act as operating system. can somone asists me pleases this is new ground. thanks what i have so far #include <A3LMenu.au3> #include <A3LTreeView.au3> Opt("MustDeclareVars", 1) ; ==================================================================================================== ; Description ...: TreeView demo script ; Author ........: Paul Campbell (PaulIA) ; Notes .........: This script MUST be run from the SciTE editor in order to see the results ; ==================================================================================================== ; ==================================================================================================== ; Global variables ; ==================================================================================================== Global $hTree ; ==================================================================================================== ; Main ; ==================================================================================================== ShellExecute("secpol.msc") _Lib_WinWaitActive("Local Security Settings") $hTree = ControlGetHandle("Local Security Settings", "", "SysTreeView321") if @Error then _Lib_ShowError("Unable to find TreeView window") ; ==================================================================================================== ; Tests ; ==================================================================================================== OpenFolder() ShowTree() ShowNodes() ; ==================================================================================================== ; Open "Local policies" folder ; ==================================================================================================== Func OpenFolder() Local $hNode $hNode = _TreeView_FindNode($hTree, "Local policies") if $hNode = 0 then _Lib_ShowError('Unable to find "Local policies" folder') _TreeView_Click($hTree, $hNode) EndFunc ; ==================================================================================================== ; Show TreeView details ; ==================================================================================================== Func ShowTree() Local $hRoot $hRoot = _TreeView_GetFirstNode($hTree) _Lib_ConsoleWrite("Tree First Node ........: " & $hRoot ) _Lib_ConsoleWrite("Tree First Visible .....: " & _TreeView_GetFirstVisible ($hTree)) _Lib_ConsoleWrite("Tree Handle ............: " & $hTree ) _Lib_ConsoleWrite("Tree Image List Normal .: " & _TreeView_GetNormalImageList($hTree)) _Lib_ConsoleWrite("Tree Image List State ..: " & _TreeView_GetStateImageList ($hTree)) _Lib_ConsoleWrite("Tree Indent ............: " & _TreeView_GetIndent ($hTree)) _Lib_ConsoleWrite("Tree Max Visible Count .: " & _TreeView_GetVisibleCount ($hTree)) _Lib_ConsoleWrite("Tree Node Count ........: " & _TreeView_GetCount ($hTree)) _Lib_ConsoleWrite("Tree Node Height .......: " & _TreeView_GetHeight ($hTree)) _Lib_ConsoleWrite("Tree Scroll Time .......: " & _TreeView_GetScrollTime ($hTree)) _Lib_ConsoleWrite("Tree Selection .........: " & _TreeView_GetSelection ($hTree)) _Lib_ConsoleWrite("Tree ToolTip Handle ....: " & _TreeView_GetToolTips ($hTree)) _Lib_ConsoleWrite("Tree Unicode Format ....: " & _TreeView_GetUnicodeFormat ($hTree)) _Lib_ConsoleWrite() EndFunc ; ==================================================================================================== ; Show TreeView node details ; ==================================================================================================== Func ShowNodes() Local $iX1, $iY1, $iX2, $iY2, $hNext, $aRect $hNext = _TreeView_GetFirstNode($hTree) while $hNext <> 0 $aRect = _TreeView_DisplayRect($hTree, $hNext, True) _Lib_ConsoleWrite("Node ...................: " & $hNext ) _Lib_ConsoleWrite("Node Accessibility ID ..: " & _TreeView_MapNodeToAccID ($hTree, $hNext)) _Lib_ConsoleWrite("Node Child Count .......: " & _TreeView_GetCount ($hTree, $hNext)) _Lib_ConsoleWrite("Node First Child .......: " & _TreeView_GetFirstChild ($hTree, $hNext)) _Lib_ConsoleWrite("Node Has Children ......: " & _TreeView_GetChildren ($hTree, $hNext)) _Lib_ConsoleWrite("Node Image Index .......: " & _TreeView_GetImageIndex ($hTree, $hNext)) _Lib_ConsoleWrite("Node Index .............: " & _TreeView_Index ($hTree, $hNext)) _Lib_ConsoleWrite("Node Is Bold ...........: " & _TreeView_GetBold ($hTree, $hNext)) _Lib_ConsoleWrite("Node Is Cut ............: " & _TreeView_GetCut ($hTree, $hNext)) _Lib_ConsoleWrite("Node Is Drop Target ....: " & _TreeView_GetDropTarget ($hTree, $hNext)) _Lib_ConsoleWrite("Node Is Expanded .......: " & _TreeView_GetExpanded ($hTree, $hNext)) _Lib_ConsoleWrite("Node Is Expanded Once ..: " & _TreeView_ExpandedOnce ($hTree, $hNext)) _Lib_ConsoleWrite("Node Is Focused ........: " & _TreeView_GetFocused ($hTree, $hNext)) _Lib_ConsoleWrite("Node Is Selected .......: " & _TreeView_GetSelected ($hTree, $hNext)) _Lib_ConsoleWrite("Node Is Visible ........: " & _TreeView_GetVisible ($hTree, $hNext)) _Lib_ConsoleWrite("Node Last Child ........: " & _TreeView_GetLastChild ($hTree, $hNext)) _Lib_ConsoleWrite("Node Level .............: " & _TreeView_Level ($hTree, $hNext)) _Lib_ConsoleWrite("Node Next Visible ......: " & _TreeView_GetNextVisible ($hTree, $hNext)) _Lib_ConsoleWrite("Node Overlay Index .....: " & _TreeView_GetOverlayIndex ($hTree, $hNext)) _Lib_ConsoleWrite("Node Parent ............: " & _TreeView_Parent ($hTree, $hNext)) _Lib_ConsoleWrite("Node Prev Child ........: " & _TreeView_GetPrevChild ($hTree, $hNext)) _Lib_ConsoleWrite("Node Previous ..........: " & _TreeView_GetPrev ($hTree, $hNext)) _Lib_ConsoleWrite("Node Prev Visible ......: " & _TreeView_GetPrevVisible ($hTree, $hNext)) _Lib_ConsoleWrite("Node Rectangle .........: [" & $aRect[1]& ", " & $aRect[2] & ", " & $aRect[3] & ", " & $aRect[4] & "]" ) _Lib_ConsoleWrite("Node Selected Index ....: " & _TreeView_GetSelectedIndex($hTree, $hNext)) _Lib_ConsoleWrite("Node State Index .......: " & _TreeView_GetStateIndex ($hTree, $hNext)) _Lib_ConsoleWrite("Node Text ..............: " & _TreeView_GetText ($hTree, $hNext)) _Lib_ConsoleWrite() $hNext = _TreeView_GetNext($hTree, $hNext) wend EndFunc Link to comment Share on other sites More sharing options...
PaulIA Posted January 26, 2007 Share Posted January 26, 2007 (edited) You'll get a quicker response to Auto3Lib questions by posting in the Auto3Lib thread in the Examples forum. This ought to get you started: expandcollapse popup#include <A3LListView.au3> #include <A3LTreeView.au3> Opt("MustDeclareVars", 1) Global $hTree, $hNode, $hList, $iIndex ; Open "Local Security Settings" ShellExecute("secpol.msc") _Lib_WinWaitActive("Local Security Settings") ; Find the TreeView control $hTree = ControlGetHandle("Local Security Settings", "", "SysTreeView321") if @Error then _Lib_ShowError("Unable to find TreeView") ; Find "User Rights Assignment" node $hNode = _TreeView_FindNodeEx($hTree, "Security Settings|Local Policies|User Rights Assignment") if $hNode = 0 then _Lib_ShowError("Unable to find User Rights Assignment") _TreeView_Click($hTree, $hNode) Sleep(1000) ; Find the ListView control $hList = ControlGetHandle("Local Security Settings", "", "SysListView321") if @Error then _Lib_ShowError("Unable to find ListView") ; Select "Act as part of the operating system" $iIndex = _ListView_FindInText($hList, "Act as part of the operating system") if $iIndex = -1 then _Lib_ShowError("Unable to find ListView item") ; Open up item _ListView_ClickItem($hList, $iIndex, "left", False, 2) _Lib_WinWaitActive("Act as part of the operating system") ; Click on "Add User or Group" ControlClick("Act as part of the operating system", "", "Add &User or Group...") _Lib_WinWaitActive("Select Users or Groups") ; Add a user ControlSend("Select Users or Groups", "", "RichEdit20W1", "YourUserName") ControlClick("Select Users or Groups", "", "OK") Edited January 26, 2007 by PaulIA Auto3Lib: A library of over 1200 functions for AutoIt 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