AzKay Posted August 4, 2006 Share Posted August 4, 2006 expandcollapse popup#include <GUIConstants.au3> #include <Process.au3> Opt("GUIOnEventMode", 1) ### Koda GUI section start ### $Form1 = GUICreate("Account Stuff By Azkay", 547, 180, 187, 116, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS)) $Group1 = GUICtrlCreateGroup("Create Account", 0, 0, 177, 177) $Input1 = GUICtrlCreateInput("", 8, 40, 161, 21) $Input2 = GUICtrlCreateInput("", 8, 88, 161, 21) $Button1 = GUICtrlCreateButton("Add Account", 8, 144, 161, 25, 0) GUICtrlSetOnEvent(-1, "AButton1Click") GUICtrlCreateLabel("Username:", 8, 24, 55, 17) GUICtrlCreateLabel("Password:", 8, 72, 53, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Delete Account", 184, 0, 177, 177) $Input3 = GUICtrlCreateInput("", 192, 40, 161, 21) $Button2 = GUICtrlCreateButton("Delete Account", 192, 144, 161, 25, 0) GUICtrlSetOnEvent(-1, "AButton2Click") GUICtrlCreateLabel("Username:", 192, 24, 55, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Add Privilege", 368, 0, 177, 177) $Input4 = GUICtrlCreateInput("", 376, 40, 161, 21) $Radio1 = GUICtrlCreateRadio("Admin", 376, 64, 105, 25) $Radio2 = GUICtrlCreateRadio("User", 376, 88, 89, 25) $Radio3 = GUICtrlCreateRadio("Guest", 376, 112, 73, 25) $Button3 = GUICtrlCreateButton("Add Privilege", 376, 144, 161, 25, 0) GUICtrlSetOnEvent(-1, "AButton3Click") GUICtrlCreateLabel("Username:", 376, 24, 55, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") ### Koda GUI section end ### Dim $Username Dim $Password While 1 Sleep(100) WEnd Func AButton1Click() $Username = GUICtrlRead($Input1) $Password = GUICtrlRead($Input2) If $Input2 = "" Then _RunDos("net user " & $Username & " /ADD") Else _RunDos("net user " & $Username & " " & $Password & " /ADD") EndIf EndFunc Func AButton2Click() $Username = GUICtrlRead($Input3) _RunDos("net user " & $Username & " /DELETE") EndFunc Func AButton3Click() $RadioAdmin = GUICtrlRead($Radio1) $RadioUser = GUICtrlRead($Radio2) $RadioGuest = GUICtrlRead($Radio3) If $RadioAdmin Then $Username = GUICtrlRead($Input4) _RunDos("net localgroup Administrators " & $Username & " /ADD") ElseIf $RadioUser Then $Username = GUICtrlRead($Input4) _RunDos("net localgroup Users " & $Username & " /ADD") ElseIf $RadioGuest Then $Username = GUICtrlRead($Input4) _RunDos("net localgroup Guests " & $Username & " /ADD") EndIf EndFunc Func _Quit() Exit EndFunc Yeah, the last part doesnt work, when I try change the accounts to admin/guest/user, It just changes to admin, none of the others... Anyone know why? # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Skruge Posted August 4, 2006 Share Posted August 4, 2006 (edited) Look at the state table. There's a link in the GUICtrlRead helpfile entry. Your $RadioAdmin/User/Guest variables will always be nonzero. Use BitAnd to get what you need. @edit: Argh, it's late... use BitAnd, not BitOr. Straight from the helpfile: For Checkbox, Radio control several states can be returned as $GUI_FOCUS and $GUI_CHECKED,. So use i.e. BitAnd(GUICtrlRead($Item),$GUI_CHECKED) to test if the control is checked. Edited August 4, 2006 by Skruge [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
zeroZshadow Posted August 4, 2006 Share Posted August 4, 2006 If $Input2 = "" Then should be If $password = "" Then next: Username = GUICtrlRead($Input3) there is no input3, should be Username = GUICtrlRead($Input2) next: $RadioAdmin = GUICtrlgetstate($Radio1) $RadioUser = GUICtrlgetstate($Radio2) $RadioGuest = GUICtrlgetstate($Radio3) instead of $RadioAdmin = GUICtrlRead($Radio1) $RadioUser = GUICtrlRead($Radio2) $RadioGuest = GUICtrlRead($Radio3) since GUICtrlRead always return something bigger then 0 on radio's i hope this helps ya *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip... Link to comment Share on other sites More sharing options...
AzKay Posted August 4, 2006 Author Share Posted August 4, 2006 Hmm, I tryed: BitAND() I tryed GUICtrlGetState() They didnt work~ BitOR(GUICtrlGetState($Radio3), $GUI_CHECKED) BitOR(GUICtrlRead($Radio3), $GUI_CHECKED) And: There is an input3 # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
zeroZshadow Posted August 4, 2006 Share Posted August 4, 2006 u tryed BOTH :| try this read the state to a variable then make it check if the var is $GUI_CHECKED or $GUI_UNCHECKED easy right ?? i think u need a bit operator to check this tho. *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip... Link to comment Share on other sites More sharing options...
AzKay Posted August 4, 2006 Author Share Posted August 4, 2006 (edited) u tryed BOTH :|try this read the state to a variable then make it check if the var is $GUI_CHECKEDor $GUI_UNCHECKEDeasy right ??i think u need a bit operator to check this tho.I didnt try both at the same time, I tryed one, it didnt work, I tryed the other. didnt work.EDIT::I dont understand your post. Im confused. Edited August 4, 2006 by AzKay # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Skruge Posted August 4, 2006 Share Posted August 4, 2006 This works: If BitAND(GUICtrlRead($Radio1),$GUI_CHECKED) Then $Username = GUICtrlRead($Input4) _RunDos("net localgroup Administrators " & $Username & " /ADD") ElseIf BitAND(GUICtrlRead($Radio2),$GUI_CHECKED)Then $Username = GUICtrlRead($Input4) _RunDos("net localgroup Users " & $Username & " /ADD") ElseIf BitAND(GUICtrlRead($Radio3),$GUI_CHECKED)Then $Username = GUICtrlRead($Input4) _RunDos("net localgroup Guests " & $Username & " /ADD") EndIf [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
AzKay Posted August 4, 2006 Author Share Posted August 4, 2006 Doesnt work for me. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Skruge Posted August 4, 2006 Share Posted August 4, 2006 Doesnt work for me.Try this and tell me what the message box says:expandcollapse popup#include <GUIConstants.au3> #include <Process.au3> Opt("GUIOnEventMode", 1) ### Koda GUI section start ### $Form1 = GUICreate("Account Stuff By Azkay", 547, 180, 187, 116, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS)) $Group1 = GUICtrlCreateGroup("Create Account", 0, 0, 177, 177) $Input1 = GUICtrlCreateInput("", 8, 40, 161, 21) $Input2 = GUICtrlCreateInput("", 8, 88, 161, 21) $Button1 = GUICtrlCreateButton("Add Account", 8, 144, 161, 25, 0) GUICtrlSetOnEvent(-1, "AButton1Click") GUICtrlCreateLabel("Username:", 8, 24, 55, 17) GUICtrlCreateLabel("Password:", 8, 72, 53, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Delete Account", 184, 0, 177, 177) $Input3 = GUICtrlCreateInput("", 192, 40, 161, 21) $Button2 = GUICtrlCreateButton("Delete Account", 192, 144, 161, 25, 0) GUICtrlSetOnEvent(-1, "AButton2Click") GUICtrlCreateLabel("Username:", 192, 24, 55, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Add Privilege", 368, 0, 177, 177) $Input4 = GUICtrlCreateInput("", 376, 40, 161, 21) $Radio1 = GUICtrlCreateRadio("Admin", 376, 64, 105, 25) $Radio2 = GUICtrlCreateRadio("User", 376, 88, 89, 25) $Radio3 = GUICtrlCreateRadio("Guest", 376, 112, 73, 25) $Button3 = GUICtrlCreateButton("Add Privilege", 376, 144, 161, 25, 0) GUICtrlSetOnEvent(-1, "AButton3Click") GUICtrlCreateLabel("Username:", 376, 24, 55, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") ### Koda GUI section end ### Dim $Username Dim $Password While 1 Sleep(100) WEnd Func AButton1Click() $Username = GUICtrlRead($Input1) $Password = GUICtrlRead($Input2) If $Input2 = "" Then _RunDOS("net user " & $Username & " /ADD") Else _RunDOS("net user " & $Username & " " & $Password & " /ADD") EndIf EndFunc ;==>AButton1Click Func AButton2Click() $Username = GUICtrlRead($Input3) _RunDOS("net user " & $Username & " /DELETE") EndFunc ;==>AButton2Click Func AButton3Click() If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) Then $Username = GUICtrlRead($Input4) MsgBox(0, "Results", "Admin Checked") ;~ _RunDos("net localgroup Administrators " & $Username & " /ADD") ElseIf BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) Then $Username = GUICtrlRead($Input4) MsgBox(0, "Results", "User Checked") ;~ _RunDos("net localgroup Users " & $Username & " /ADD") ElseIf BitAND(GUICtrlRead($Radio3), $GUI_CHECKED) Then $Username = GUICtrlRead($Input4) MsgBox(0, "Results", "Guest Checked") ;~ _RunDos("net localgroup Guests " & $Username & " /ADD") Else MsgBox(0, "Results", "Nothing was Checked") EndIf EndFunc ;==>AButton3Click Func _Quit() Exit EndFunc ;==>_Quit It works for me with the production release as well as the latest beta. If you're still having issues, you may want to reinstall AutoIt. [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
AzKay Posted August 4, 2006 Author Share Posted August 4, 2006 (edited) Yes, it says which one is checked, but it doesnt actually do it, it doesnt give the account the priviledge's EDIT:: Turns out, it was something else wrong, with the dos thing "This account is already part of this localgroup" Though its not !~ EDIT:: Nevermind, solved. Edited August 4, 2006 by AzKay # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
zeroZshadow Posted August 4, 2006 Share Posted August 4, 2006 i'll give a nice run trough that command of urs, back in a flash *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip... Link to comment Share on other sites More sharing options...
AzKay Posted August 4, 2006 Author Share Posted August 4, 2006 ^^, I found the problem, when you change the account to admin, you cant change it to guest or user, because it already has those permissions # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
zeroZshadow Posted August 4, 2006 Share Posted August 4, 2006 lol, well good u solved it *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip... 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