Sign in to follow this  
Followers 0
Batch

What Am I Doing Wrong, Somebody Shoot Me Please!

6 posts in this topic

I inspired Larry's "Never let it hang" motto, and unfortunately, I'm letting it hang :whistle:

I need to install an app for a bunch of people, the apps seems to support no kind of silent install routine, so I'm scripting it with AutoIt. It always hangs on line 16, the sleep statement, like it can't find the window. I thought I could send controls to hidden windows? As soon as I take the SetWinState hidden out of my function, the installs flies through very quickly. I want it to hit the buttons and everything off screen if this is possible, so can some of you gurus give me some quick guidance? TIA!

Opt( "TrayIconDebug", 1 )

Run( "\\corp-pcapps\apps$\chainstoreguide2004\setup.exe", "", @SW_HIDE )

click( "Setup - National Association of Chain Drug Stores", "Welcome", "TButton2" )
click( "Setup - National Association of Chain Drug Stores", "I &do not accept the agreement", "TRadioButton2" )
click( "Setup - National Association of Chain Drug Stores", "I &do not accept the agreement", "TButton2" )
click( "Setup - National Association of Chain Drug Stores", "C:\Program Files\MVReader\CDS-0001\", "TButton2" )
click( "Setup - National Association of Chain Drug Stores", "SelectProgramGroup", "TButton2" )
click( "Setup - National Association of Chain Drug Stores", "Destination directory:", "TButton2" )
click( "Setup - National Association of Chain Drug Stores", "Finished", "TNewCheckListBox1" )
click( "Setup - National Association of Chain Drug Stores", "Finished", "TButton2" )

Func click( $title, $text, $button)
While Not WinExists( $title, $text )
Sleep( "10" )
Wend
WinSetState( $title, $text, @SW_HIDE )
ControlSend( $title, $text, $button, "{SPACE}" )
EndFunc

Share this post


Link to post
Share on other sites



:whistle: Larry, dude, you are SO my Hero. It works like a champ now! Thank you very much, I'll be creating a lot of installs this way now, consider the fact it's awfully hard for a user to botch up an install that they can't see happening. You are the man! B)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

That's mostly how I handle installs too....and have a nice splash screen up while it's installing....

While Not WinExists( $title, $text )
Sleep( "10" )
Wend

I just have a problem with that part of the code. The window will most likely flash briefly before it's hidden. Just use

WinWait($title, $text)

Jon,

Is there way to create an AutoIT built-in command that will hide a window as well as all of it's child windows that may appear?

Edited by MattNis

[quote]I was busy waiting all night for the Columbus Day Bunny to come down my chimney and light fireworks in my pumpkin.There's so much wrong with that.Oh, I'm sorry, i forgot you were Jewish.[/quote]

Share this post


Link to post
Share on other sites

MattNis, thanks for the tip, the window does briefly appear, howbeit really quickly. I didn't think WinWait would work since I was hiding the window, that's why I opted for WinExist instead. Have you tried it that way? I probably will later on today. I'll post an update when I get a chance to test it out.

Jon, you're the man, I love AutoIt, thanks very much for making it free, I am modeling my job around it these days, hehe (PC Support guy in Winston-Salem, NC)

I had to install this Drug store program for a bunch of people yesterday, so I just created that script, plus a RunAsSet statement, zipped it and emailed to my users and had them run it, worked flawless, and they never saw a thing, besides the brief flicker at the beginning at MattNis pointed out.

Share this post


Link to post
Share on other sites

OK, I couldn't wait till later. I went ahead and tried it and it does the same thing. I set Opt("WinWaitDelay") to 1 and used a WinWait instead of my little loop, it appears to do the same as if I did a Sleep( "1" ) in my loop, so you still get a hint of a flicker, but It's not enough to be bothered with, anybody know of a workaround for the initial window?

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  
Followers 0