polizzi82 Posted March 9, 2013 Share Posted March 9, 2013 I would never claim to be great at AutoIt but will Google and tinker until I get my script working.Today after 5 hours of frusteration I finally created an account on this awesome board for help...I need to launch a vbs file with a modifier (not sure if that's the right terminology).From the run command when I put CopyMembership.vbs "username1" "username2" it runs the vbs which references the 2 provided usernames.The only way I can incorporate running this script is popping open a Run Window and 'send'ing the complied text and running.It's tacky and I'd like to Run/Shell Execute it.Here's the code that works but is ugly:FileCopy ("\\Shcsd.sharp.com\sharp\soc\groups\ISD Common\.TemporaryItems\CopyMembership.vbs", "C:\Temp\") Sleep (2000) Local $CopiedFrom = InputBox ( "Membership Copy", "Please enter the username of the user you are copying FROM", "", "") Local $CopyTo = InputBox ( "Membership Copy", "Please enter the username of the user you are copying TO", "", "") $OKorCancel = MsgBox ( 1, "Please verify", $CopyTo &" will get " & $CopiedFrom & "'s groups" ) Switch $OKorCancel Case 2 FileDelete ("C:\Temp\CopyMembership.vbs") MsgBox (16, "HALT!", "Cancelled by user") Exit Case 1 Send ( "#r" ) WinWait ("Run") Sleep (300) Send ("C:\Temp\CopyMembership.vbs " &'"' &$CopiedFrom & '" ' &'"' &$CopyTo &'"') Send ("{TAB}{ENTER}") Exit EndSwitch ExitI would love to have something like:FileCopy ("\\Shcsd.sharp.com\sharp\soc\groups\ISD Common\.TemporaryItems\CopyMembership.vbs", "C:\Temp\") Sleep (2000) Local $CopiedFrom = InputBox ( "Membership Copy", "Please enter the username of the user you are copying FROM", "", "") Local $CopyTo = InputBox ( "Membership Copy", "Please enter the username of the user you are copying TO", "", "") $OKorCancel = MsgBox ( 1, "Please verify", $CopyTo &" will get " & $CopiedFrom & "'s groups" ) Switch $OKorCancel Case 2 FileDelete ("C:\Temp\CopyMembership.vbs") MsgBox (16, "HALT!", "Cancelled by user") Exit Case 1 ShellExecute ("C:\Temp\CopyMembership.vbs " &'"' &$CopiedFrom & '" ' &'"' &$CopyTo &'"') Exit EndSwitch ExitI even tried compiling the path into a variable with no launching luck (the notepad is just for troubleshooting and verification of the path being legit)FileCopy ("\\Shcsd.sharp.com\sharp\soc\groups\ISD Common\.TemporaryItems\CopyMembership.vbs", "C:\Temp\") Local $CopiedFrom = "polzo" Local $CopyTo = "polza" Local $Path = "C:\Temp\CopyMembership.vbs " &'"' &$CopiedFrom & '" ' &'"' &$CopyTo &'"' WinActivate ("Untitled - Notepad") Send ($Path) Sleep (2000) Send ("{SHIFTDOWN}{HOME}{SHIFTUP}") Sleep (200) Send ("{DEL}") ShellExecute ($Path) ;or something like that, I've tried dozens of combinations ExitThis may be a case where I don't know the terminology or maybe a limitation?Thanks a gazillion in advance for any help in advance and I apoligize if my code is yucky,Mike Link to comment Share on other sites More sharing options...
BrewManNH Posted March 9, 2013 Share Posted March 9, 2013 What's in the vbs file that can't be done in AutoIt? Because from what I've seen, almost anything that can be done with VBScript can be done with AutoIt. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
polizzi82 Posted March 9, 2013 Author Share Posted March 9, 2013 (edited) http://www.windowsitpro.com/article/active-directory-service-interfaces-adsi/copy-group-memberships-from-one-ad-user-to-another-96434That's where I got the CopyMembership.vbs from...It copies the memberships from one User to another.I eventually need it for COmputer group transfers so I've been learning how to manipulate AD from AutoIt here: Edited March 9, 2013 by polizzi82 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