Jump to content
Sign in to follow this  
MUIT

Issues sending characters to command line.

Recommended Posts

MUIT

Hi All,

I've been wrestling with this for a few days now and would appreciate a bit of direction.

I'm trying to automate Adobe's AUSST, which syncs a local server with Adobe's updates, much like Microsoft's WSUS.

In their infinite wisdom, their AUSST tool is menu driven from the command line. No parameters exist... other than to specify the root directory. You have to type in a "2" and hit Enter, wait for the sync (could be quite long depending on the amount/size of updates available, no updates available still takes over a minute), then enter "4", hit ENTER to close.

So, here's what I've got currently (I've tried myriad other things)

AutoItSetOption("WinTitleMatchMode", 3)

;due to issues i had with necessary quotes in the launch parameter
local $parm = " --root=""C:\inetpub\www2root\AdobeUpdate\oobee"""

;execution does work, so I'm good to this point
ShellExecute('C:\inetpub\wwwroot\AdobeUpdate\AdobeUpdateServerSetupTool2.0.exe', $parm )

;make sure it is ready for input
sleep(4500)

;test for active
if WinWaitActive("C:\inetpub\wwwroot\AdobeUpdate\AdobeUpdateServerSetupTool2.0.exe") Then

   ;send commands
   Send("2", 1) 
   Send("{ENTER}",1)

   ;let me know an attempt was made
   msgbox (0, "sent", "sent")

EndIf

I plan on doing a very long sleep in place of the msgbox, and then doing the "4" and {ENTER} to quit.

I tried ControlCommand things, and ran into some issues with ControlID (seems it changes for every launch).

if it helps, this is on a Windows2k8 r2 x64 server.

Thanks!

Share this post


Link to post
Share on other sites
kylomas

MUIT,

"Winwaitactive" waits on a "window". You seem to be waiting on a process. You might try using the "window" title or use the "processexists" function.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
LarryDalooza

Try getting the handle of the window and ControlSend to that handle. I believe that is how I used to do it.

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites
MUIT

So, now after more fiddling, I've got:

AutoItSetOption("WinTitleMatchMode", 3)

local $parm = " --root=""C:\inetpub\www2root\AdobeUpdate\oobee"""

ShellExecute('C:\inetpub\wwwroot\AdobeUpdate\AdobeUpdateServerSetupTool2.0.exe', $parm )

sleep(4500)


if WinWaitActive("C:\inetpub\wwwroot\AdobeUpdate\AdobeUpdateServerSetupTool2.0.exe") Then
WinActivate("C:\inetpub\wwwroot\AdobeUpdate\AdobeUpdateServerSetupTool2.0.exe")
Send("2", 1)

ControlSend("C:\inetpub\wwwroot\AdobeUpdate\AdobeUpdateServerSetupTool2.0.exe","","[CLASS:ConsoleWindowClass]","{ENTER}",1)

; Send("{ENTER}",1)
msgbox (0, "sent", "sent")

EndIf

The "2" shows up in the window, but it appears that no "enter" key is entered.

Per LarryDalooza, I managed to get the handle, and use it as a variable to do a control send, and ran into this same issue.

Kylomas, There is a window activated by this process, it's a console/CMD window. It must be able to reference it, since I can now get the "2" to appear.

MUIT

Share this post


Link to post
Share on other sites
BrewManNH

ControlSend is only unreliable for command prompts as that works differently to normal windows (seems to check physical states rather than accepting the keystroke messages).


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 Gude
How 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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×