redfive19 Posted April 22, 2008 Share Posted April 22, 2008 Hi guys, So what I'm trying to do is enumerate all of the user's that have logged onto a pc. I'm doing this by listing all of the files in the documents and settings folder: $useridarray = _FileListToArray('D:\Documents and Settings\', '*', 2) In my GUI, I'm populating that information (minus a few profiles I don't want to include) in a Combo-dropdown box like so: $userid_input = GUICtrlCreateCombo("", 92, 135, 185, 21, $CBS_DROPDOWNLIST) For $z = 1 to $useridarray[0] If $useridarray[$z] <> 'Administrator' And $useridarray[$z] <> 'All Users' And And $useridarray[$z] <> 'Default User' And $useridarray[$z] <> 'LocalService' And $useridarray[$z] <> 'My Documents' And $useridarray[$z] <> 'NetworkService' And $useridarray[$z] <> 'Temp' Then GUICtrlSetData(-1, $useridarray[$z], @UserName) EndIf Next I want them to be able to input a userID that's not prepopluated so I thought to add an element to the FileList array like such: $useridarray = _FileListToArray('D:\Documents and Settings\', '*', 2) _ArrayAdd ($useridarray, '<ENTER USERID>') But _ArrayAdd doesn't update the element count ($useridarray[0]) so it's not working. My 2nd problem is is that when they select <ENTER USERID>, I want all of the other fields on the form to blank out. I am sure this is an OnEvent thing but to be honest, I never really understood OnEvent mode so if someone can point me in the correct direction, I'd really appreciate it. Thanks!!! - redfive Link to comment Share on other sites More sharing options...
martin Posted April 22, 2008 Share Posted April 22, 2008 Hi guys, So what I'm trying to do is enumerate all of the user's that have logged onto a pc. I'm doing this by listing all of the files in the documents and settings folder: $useridarray = _FileListToArray('D:\Documents and Settings\', '*', 2) In my GUI, I'm populating that information (minus a few profiles I don't want to include) in a Combo-dropdown box like so: $userid_input = GUICtrlCreateCombo("", 92, 135, 185, 21, $CBS_DROPDOWNLIST) For $z = 1 to $useridarray[0] If $useridarray[$z] <> 'Administrator' And $useridarray[$z] <> 'All Users' And And $useridarray[$z] <> 'Default User' And $useridarray[$z] <> 'LocalService' And $useridarray[$z] <> 'My Documents' And $useridarray[$z] <> 'NetworkService' And $useridarray[$z] <> 'Temp' Then GUICtrlSetData(-1, $useridarray[$z], @UserName) EndIf Next I want them to be able to input a userID that's not prepopluated so I thought to add an element to the FileList array like such: $useridarray = _FileListToArray('D:\Documents and Settings\', '*', 2) _ArrayAdd ($useridarray, '<ENTER USERID>') But _ArrayAdd doesn't update the element count ($useridarray[0]) so it's not working. My 2nd problem is is that when they select <ENTER USERID>, I want all of the other fields on the form to blank out. I am sure this is an OnEvent thing but to be honest, I never really understood OnEvent mode so if someone can point me in the correct direction, I'd really appreciate it. Thanks!!! - redfive _ArrayAdd doesn't increment the zero element so you need to do that yourself if the function succeeds. If _ArrayAdd ($useridarray, '<ENTER USERID>') <> -1 then $useridarray[0] = UBound($useridarray) - 1 endif or $result = _ArrayAdd ($useridarray, '<ENTER USERID>') if $result <> -1 then $useridarray[0] = $result I don't know what the other fields are so I can't say much about that, but if you want something to be hidden then you can hide controls with GuiCtrlSetState($id,$GUI_HIDE) 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...
redfive19 Posted April 22, 2008 Author Share Posted April 22, 2008 Thanks Martin, the first solution you posted works perfectly! I'm still trying to figure out how to blank the form if <ENTER USER ID> is chosen but you've certainly helped me with the biggest hurdle!! Link to comment Share on other sites More sharing options...
martin Posted April 22, 2008 Share Posted April 22, 2008 Thanks Martin, the first solution you posted works perfectly! I'm still trying to figure out how to blank the form if <ENTER USER ID> is chosen but you've certainly helped me with the biggest hurdle!!That's good.I don't know what you mean by blank the form though. Do you mean remove or hide all the controls? 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...
redfive19 Posted April 22, 2008 Author Share Posted April 22, 2008 What I mean is blank out the values that are already in there. Link to comment Share on other sites More sharing options...
martin Posted April 22, 2008 Share Posted April 22, 2008 (edited) What I mean is blank out the values that are already in there.I'm not very good at this game. "in there" doesn't mean much to me. In what? what values in where? Do you mean all the other names in the combobox list? Or are you talking about some part of your code I don't know about? I need a few more nouns, and verbs and adjectives. Maybe a diagram or a nice video on YouTube. Or bring your PC round to my house and show me. But no, I expect the mains lead won't be long enough. Edited April 22, 2008 by martin 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...
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