lgwapnitsky Posted June 24, 2010 Posted June 24, 2010 (edited) I have a fairly complicated script that does user provisioning for my Windows network (I've been working on other issues in other parts of the forum). What I'd like to do is have an option at the very end of the script that asks if I want to create a new user and, if yes, clears all variables. I will admit, my script has gotten rather large and probably a bit disorganized with the amount of fields, etc. that I've created, but I was hoping there was a relatively simple solution. I'm more than happy to post my script if anyone wants to see what is going on inside of it.Regards,LarryUpdate: Found a good solution to my problem here. There's a _restart function that was written that does the job simply and perfectly. Edited June 24, 2010 by lgwapnitsky
PsaltyDS Posted June 24, 2010 Posted June 24, 2010 Why do the variables need to be "cleared"? Aren't their values correctly initialized when you do each user? If not, correct your script so they are. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
lgwapnitsky Posted June 24, 2010 Author Posted June 24, 2010 Why do the variables need to be "cleared"? Aren't their values correctly initialized when you do each user? If not, correct your script so they are.Because each user might be in a different office with different address/phone info, different security groups, etc. anyway, I found an solution that I've posted in my initial question above.Thanks
Moderators Melba23 Posted June 24, 2010 Moderators Posted June 24, 2010 lgwapnitsky.I was hoping there was a relatively simple solutionAlas I fear not. My best suggestion is to tidy up your "disorganized" code so that you have a nice grouping of initial variable declarations to copy to a function and so be able to reset them with a single call.Sorry not to be more optimistic, but you will probably benefit from the tidying in any case! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
PsaltyDS Posted June 24, 2010 Posted June 24, 2010 Because each user might be in a different office with different address/phone info, different security groups, etc. anyway, I found an solution that I've posted in my initial question above.I think Valuator would rather you clean up your script too. That trick just temporarily extends the life cycle of a script that badly needs a rewrite. Sounds like you did the whole thing in one string of spaghetti code. For example, if a GUI collects the required information, then makes a call to function(s) to do the work, the local variables in the functions are recreated fresh every time the function is called and they disappear when the function returns. There's no point in "clearing" them.A single reset function could prep the GUI for input of the next user's info, but what if you have to do several similar users? Must you clear the department every time for example, when you might be setting up ten users in the same department and location, and appreciate not having to re-enter that over and over again? Other fields of course could reset every time, like last name. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
lgwapnitsky Posted June 25, 2010 Author Posted June 25, 2010 (edited) I do have a lot of global variables because items are constantly being changed throughout and accessed multiple times. I agree that it is spaghetti code, but it does work for what i need right now. I can try to optimize going forward, but right now i don't have the time to do do anything but make it functional. As for needing to clear the department, it's more of a multi-location office situation with different addresses, phone numbers, default groups, different OUs, etc. The script itself creates the user, populates all necessary fields in AD, creates the mailbox, then sets up home and profile directories on our DFS servers. btw - if you'd like to see my "spaghetti" code, let me know. I can post it, but it's almost 700 lines. Edited June 25, 2010 by lgwapnitsky
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