JusGellin Posted September 27, 2008 Share Posted September 27, 2008 I found an example of a script that would access the local security settings msc to show how to do some of the treeview stuff. But when I do, it gives me the Microsoft error box stating it will shut down the msc. After I tell it not to send the info to MS, an error message box comes up and says "_WinAPI_ReadProcessMemory: Access Denied" then it closes the msc as well as Scite. What am I doing wrong because this should be possible to do. I have admin rights on this PC also. How can I make this work properly? Thanks expandcollapse popup#include <GuiListView.au3> #include <GuiTreeView.au3> Opt("MustDeclareVars", 1) Global $hTree, $hNode, $hList, $iIndex ; Open "Local Security Settings" ShellExecute("secpol.msc") WinWaitActive("Local Security Settings") ; Find the TreeView control $hTree = ControlGetHandle("Local Security Settings", "", "SysTreeView321") if @Error then MsgBox(16, "Error", "Unable to find TreeView") ; Find "User Rights Assignment" node $hNode = _GUICtrlTreeView_FindItemEx($hTree, "Security Settings|Local Policies|User Rights Assignment") if $hNode = 0 then MsgBox(16, "Error", "Unable to find User Rights Assignment") _GUICtrlTreeView_ClickItem($hTree, $hNode) Sleep(1000) ; Find the ListView control $hList = ControlGetHandle("Local Security Settings", "", "SysListView321") if @Error then MsgBox(16, "Error", "Unable to find ListView") ; Select "Act as part of the operating system" $iIndex = _GUICtrlListView_FindInText($hList, "Act as part of the operating system") if $iIndex = -1 then MsgBox(16, "Error", "Unable to find ListView item") ; Open up item _GUICtrlListView_ClickItem($hList, $iIndex, "left", False, 2) 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...") WinWaitActive("Select Users or Groups") ; Add a user ;ControlSend("Select Users or Groups", "", "RichEdit20W1", "YourUserName") ;ControlClick("Select Users or Groups", "", "OK") Link to comment Share on other sites More sharing options...
martin Posted September 27, 2008 Share Posted September 27, 2008 I found an example of a script that would access the local security settings msc to show how to do some of the treeview stuff. But when I do, it gives me the Microsoft error box stating it will shut down the msc. After I tell it not to send the info to MS, an error message box comes up and says "_WinAPI_ReadProcessMemory: Access Denied" then it closes the msc as well as Scite. What am I doing wrong because this should be possible to do. I have admin rights on this PC also. How can I make this work properly? Thanks expandcollapse popup#include <GuiListView.au3> #include <GuiTreeView.au3> Opt("MustDeclareVars", 1) Global $hTree, $hNode, $hList, $iIndex ; Open "Local Security Settings" ShellExecute("secpol.msc") WinWaitActive("Local Security Settings") ; Find the TreeView control $hTree = ControlGetHandle("Local Security Settings", "", "SysTreeView321") if @Error then MsgBox(16, "Error", "Unable to find TreeView") ; Find "User Rights Assignment" node $hNode = _GUICtrlTreeView_FindItemEx($hTree, "Security Settings|Local Policies|User Rights Assignment") if $hNode = 0 then MsgBox(16, "Error", "Unable to find User Rights Assignment") _GUICtrlTreeView_ClickItem($hTree, $hNode) Sleep(1000) ; Find the ListView control $hList = ControlGetHandle("Local Security Settings", "", "SysListView321") if @Error then MsgBox(16, "Error", "Unable to find ListView") ; Select "Act as part of the operating system" $iIndex = _GUICtrlListView_FindInText($hList, "Act as part of the operating system") if $iIndex = -1 then MsgBox(16, "Error", "Unable to find ListView item") ; Open up item _GUICtrlListView_ClickItem($hList, $iIndex, "left", False, 2) 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...") WinWaitActive("Select Users or Groups") ; Add a user ;ControlSend("Select Users or Groups", "", "RichEdit20W1", "YourUserName") ;ControlClick("Select Users or Groups", "", "OK")I think the GuiCtrl functions only apply to controls created in your own gui. 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...
JusGellin Posted September 28, 2008 Author Share Posted September 28, 2008 I think the GuiCtrl functions only apply to controls created in your own gui.Thanks Martin. The example was supposed to be able to access external applications. Is there a better way that can successfully do that? Link to comment Share on other sites More sharing options...
martin Posted September 28, 2008 Share Posted September 28, 2008 Thanks Martin. The example was supposed to be able to access external applications. Is there a better way that can successfully do that?I don't know how to do what you want I'm afraid. Maybe you could use MOuseClick to select the treeview, use Send to move down to the item you want. Home gets to the top, Down arrow to go down the list, Right arrow expands, LeftArrow collapses, then Tab to get to the list view then you can use ControlCommand. 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...
Zedna Posted September 29, 2008 Share Posted September 29, 2008 I think the GuiCtrl functions only apply to controls created in your own gui.You are not exactly right. All native GuiCtrl functions are supposed to work with your own GUI controls (from your current GUI).But all _GuiCtrl functions from standard include UDF are supposed to work also with external applications. Resources UDF ResourcesEx UDF AutoIt Forum Search 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