DISQUS

DISQUS Hello!  The comments on this profile are unclaimed and thus are unverified.

Do they belong to you? Claim these comments.

George Davis's picture

Unregistered

Feeds

aliases

  • George Davis

George Davis

1 year ago

in Window GUI Automation from PowerShell on Huddled Masses
Thanks for writing this, Joel! I've used it to automate the installation of our product on my development laptop, which I have to do very frequently. I've had a batch file for a year that would un-install the product but didn't want to load our QA app just to automate the install. Now I've done it with your DLL and PowerShell in a very lightweight fashion! I wrote a PowerShell script to read an "instruction" file that looks like:

RUN,c:\temp\setup.exe
SLEEP,15
WINDOW,msiexec
KEYS,{ENTER}
SLEEP,2
KEYS,{UP}
KEYS,{ENTER}
SLEEP,2
KEYS,{ENTER}
SLEEP,2
KEYS,{ENTER}
SLEEP,2
KEYS,{ENTER}
SLEEP,2
KEYS,{TAB}
KEYS,{TAB}
KEYS,{TAB}
KEYS,mySqlPassword
KEYS,{TAB}
KEYS,{END}
KEYS,\SQL2005
KEYS,{ENTER}
SLEEP,2
KEYS,{ENTER}
SLEEP,2
KEYS,{ENTER}
SLEEP,2
KEYS,{ENTER}
SLEEP,2
KEYS,{ENTER}
SLEEP,2
KEYS,{ENTER}
SLEEP,2
WAITFORBUTTON,&Finish,10,{ENTER}

The WINDOW instruction is only specified at the beginning of the file so that when the script reads the KEYS command, it knows which window to which to send the keystrokes. On most of the screens, I just hit enter but you can probably see one where I enter a SQL password.

My script reads each line and executes the appropriate command using your DLL. I still have the RUN one to complete but everything else works. The WAITFORBUTTON instruction will cause my script to look for the Finish button and it not found, keep checking every 10 seconds and when found, hit Enter.

Again, when I get the RUN instruction implemented, I'll send you the PS1 file and a sample instruction file. My network admin guy drooled a lot when he saw what I had done and wants to automate all the boring installs/upgrades he has to do all the time.

Many thanks again!
George
Returning? Login