Iznogoud Posted June 21, 2006 Author Share Posted June 21, 2006 I got a problem with the code, or at least i can't find the problem.If i put more then one policy settings under each other i got a weird problem.It is executing the first perfectly, but the second wich he has to apply is the same as the first.Example code:expandcollapse popupWinActivate("Group Policy Object Editor") Sleep(2000) $g_socdll = @ScriptDir & "\AutoItTreeViewExtension.dll" Local $aTextItems[6] = ['Computer Configuration', 'Windows Settings', 'Security Settings', 'Local Policies', 'User Rights Assignment', "Allow log on locally"] For $iCount = 0 To UBound($aTextItems) - 1 _GroupPolicyEnable($aTextItems[$iCount]) Sleep(100) Next WinWaitActive("Allow log on locally") ControlClick("Allow log on locally", "", "Button1") ControlClick("Allow log on locally", "", "Button2") WinWaitActive("Add User or Group") ControlClick("Add User or Group", "", "Button1") WinWaitActive("Select Users, Computers, or Groups") ControlClick("Select Users, Computers, or Groups", "", "RichEdit20W1") Send("Account Operators; Administrators; Backup Operators; Print Operators; Server Operators; Domain Users") ControlClick("Select Users, Computers, or Groups", "", "Button3") Sleep(5000) ControlClick("Select Users, Computers, or Groups", "", "Button5") WinWaitActive("Add User or Group") ControlClick("Add User or Group", "", "Button2") WinWaitActive("Allow log on locally") ControlClick("Allow log on locally", "", "Button4") Sleep(2000) Local $aTextItems[6] = ['Computer Configuration', 'Windows Settings', 'Security Settings', 'Local Policies', 'Security Options', "Devices: Restrict CD-ROM access to locally logged-on user only"] For $iCount = 0 To UBound($aTextItems) - 1 _GroupPolicyEnable($aTextItems[$iCount]) Sleep(100) Next WinWaitActive("Devices: Restrict CD-ROM access to locally logged-on user only") ControlClick("Devices: Restrict CD-ROM access to locally logged-on user only", "", "Button1") ControlClick("Devices: Restrict CD-ROM access to locally logged-on user only", "", "Button2") ControlClick("Devices: Restrict CD-ROM access to locally logged-on user only", "", "Button4")As you can see i have tried to put a sleep in between, maybe that was the problem, but no.Only thing what i can think of is that each time the Local $aTextItems[6] is called it got the value of the one before. So maybe i must put a Local $aTextItems[0]= " ", But i don't think that is a solution.What am i not seeying? Link to comment Share on other sites More sharing options...
Iznogoud Posted June 21, 2006 Author Share Posted June 21, 2006 (edited) I think i have found the solution. After each policy set you have to go back to the root of the tree and then it does work.Now only find a way to do this -edit-Maybe not a nice way, but if you put a Send("{HOME}") after the policy is set it does the trick.I have tried to combine it with a topic from me before with TreeView DLL Testing Script of Todd Weast, but that is one wich i can not get it to work together.-edit-Pffff HOME is not enough, it's not moron proof I have done ControlClick("Group Policy Object Editor", "", "SysTreeView321") and then HOME, for now it seems to work. Edited June 21, 2006 by Iznogoud Link to comment Share on other sites More sharing options...
Zedna Posted July 30, 2006 Share Posted July 30, 2006 (edited) I think i have found the solution. After each policy set you have to go back to the root of the tree and then it does work. Now only find a way to do this -edit- Maybe not a nice way, but if you put a Send("{HOME}") after the policy is set it does the trick. I have tried to combine it with a topic from me before with TreeView DLL Testing Script of Todd Weast, but that is one wich i can not get it to work together. -edit- Pffff HOME is not enough, it's not moron proof I have done ControlClick("Group Policy Object Editor", "", "SysTreeView321") and then HOME, for now it seems to work. Instead of: ControlClick("Group Policy Object Editor", "", "SysTreeView321")oÝ÷ ٩ݶ§ãÊj{¬y«¢+Ù ½¹Ñɽ±½ÕÌ ÅÕ½ÐíɽÕÀA½±¥ä=©Ð¥Ñ½ÈÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐíMåÍQÉY¥ÜÌÈÄÅÕ½Ðì¤oÝ÷ ٩ݶ§ã¢·bç-&®¶sd6öçG&öÅ6VæBgV÷C´w&÷WöÆ7ö&¦V7BVFF÷"gV÷C²ÂgV÷C²gV÷C²ÂgV÷Cµ75G&VUfWs3#gV÷C²ÂgV÷C·´öÖWÒgV÷C²oÝ÷ ØêÛzÛ^¯²jëh×6$tree = ControlGetHandle("Group Policy Object Editor", "", "SysTreeView321") $node_root = TreeViewGetRoot($tree) SelectTreeViewItem($tree, $node_root) Edited July 30, 2006 by Zedna 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