Jump to content

Can't use Process wait, but need to wait.


pjw73nh
 Share

Recommended Posts

NooB again.

My ultimate goal is to have a link on my Intranet, where a user can click (my users are not very computer literate) and start this MSI without having to choose whether to OPEN or RUN (in XP) or OPEN or SAVE in (Win9x or 2K) the file. I think there are browser settings for this, but this is for a deployment to a large mixed environment. I have to have no user intervention until the end, when they click OK in the message box.

See my code below. The run command starts an instance of IE pointing to an MSI. (I didn't write the MSI file, someone else did). Then I send the responses. The problem is that the msgbox comes right up before the install has finished. I tried to use ProcessWait, but the name of the process is always iexplore.exe, and the user may have other instances of it open.

Maybe there is abetter way of accomplishing this? (With or without a script). Any suggestions welcome.

Thanks

Paul

run("C:\Program Files\Internet Explorer\iexplore.exe _ https://ehnfs.ehr.org/Citrix/ICAWEB/en/ica32pkg/ica32pkg.msi")
    WinWaitActive("File Download - Security Warning")
    Send("!r")
    WinWaitActive("Internet Explorer - Security Warning")
    Send("!r")
    msgbox(0,"Win XP Success", " You have successfully upgraded your Citrix Client ")
Link to comment
Share on other sites

The problem is that the msgbox comes right up before the install has finished. I tried to use ProcessWait, but the name of the process is always iexplore.exe, and the user may have other instances of it open.

Sorry, I didn't follow what you really want to have happen instead...

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Sorry, I didn't follow what you really want to have happen instead...

Dale

Hi Dale,

What happens is the opening of the MSI file and the subsequent install of the program, take anywhere from 35 seconds to 3 minutes, depending on the power and configuration of the computer, and their network connection. Most of this time is AFTER I send the last (!r). When I run this script, as soon as the last (!r) is sent, (which starts the acutal MSI installing (which takes time)) it processes the MsgBox line. So even though the program is still installing, the MsgBox appears that says "Successful finish).

I am looking for a way to not have the box come up until the install finishes. I suppose I could use a SLEEP (60000) command, but the fast computers would be finished with the install well before the box comes up.

If you know of any other way to accomplish this task (installing an MSI from from a link with no user intervention) I would certainly entertain it.

I hope this is clearer.

Thanks.

Paul...

Link to comment
Share on other sites

  • Moderators

Something like this maybe?

$Timer = TimerInit()
Do
    Sleep(100)
    If TimerDiff($Timer) / 1000 / 60 >= 5 Then; 5 = minutes
        MsgBox(0, "Error", "The Operation Has Timed Out" & @CRLF "Please Check Your Connection And Try Again")
        Exit
    EndIf
Until FileExists("Whatever destination and file")

MsgBox(0, "Success", "Successful Download", 5)

If the file already exists before the download, you could replace it maybe with FileGetSize()

Edit: Had a space with TimerInit()

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Ron's suggestion could work, but I'd also suggest that you should be able to do this by looking at processes.

Even though your install is being started from IEXPLORE.EXE, I think you will find that there are at least one, if not two other processes started on your system that you can watch the existance of. I ran the Process Explorer from Sysinternals and saw under IEXPLORE both a process with the name of the install program and an MSIEXEC process. I expect tat you should be able to watch for these with a ProcessWaitClose.

You could also download the file locally and then run it with a RunWait command which would not return control back to you until it was complete (presumably -- although sometimes a new process is created).

Hope this helps,

Dale

Hi Dale,

What happens is the opening of the MSI file and the subsequent install of the program, take anywhere from 35 seconds to 3 minutes, depending on the power and configuration of the computer, and their network connection. Most of this time is AFTER I send the last (!r). When I run this script, as soon as the last (!r) is sent, (which starts the acutal MSI installing (which takes time)) it processes the MsgBox line. So even though the program is still installing, the MsgBox appears that says "Successful finish).

I am looking for a way to not have the box come up until the install finishes. I suppose I could use a SLEEP (60000) command, but the fast computers would be finished with the install well before the box comes up.

If you know of any other way to accomplish this task (installing an MSI from from a link with no user intervention) I would certainly entertain it.

I hope this is clearer.

Thanks.

Paul...

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Ron's suggestion could work, but I'd also suggest that you should be able to do this by looking at processes.

Even though your install is being started from IEXPLORE.EXE, I think you will find that there are at least one, if not two other processes started on your system that you can watch the existance of. I ran the Process Explorer from Sysinternals and saw under IEXPLORE both a process with the name of the install program and an MSIEXEC process. I expect tat you should be able to watch for these with a ProcessWaitClose.

You could also download the file locally and then run it with a RunWait command which would not return control back to you until it was complete (presumably -- although sometimes a new process is created).

Hope this helps,

Dale

Dale,

Thanks again. I would like to use the processwait command,. On your advice, I used Process Explorer and found that it spawned the following.

msiexec.exe

-----msiexec.exe

-----msiexec .exe

and one other one with one sub process.

iexplore.exe

-----msiexec.exe

If I use the processwait command, will it wait until ALL the procecces are finished? If not, how can I determine which one to use in the statement?

Thanks for all the help. I really appreciate it.

Paul.../NH

Link to comment
Share on other sites

Well, child processes can go away and the parent can stay, but not the reverse.

I suggest you use Processes Explorer to see which porcess(es) you might use to flag the completion of your install and then key off of that with ProcessWait...

Dale

Note: what MHz suggests is better if you can run the file locally or can map a network share or folder to the file location on your network instead of relying on the browser to open it.

Dale,

Thanks again. I would like to use the processwait command,. On your advice, I used Process Explorer and found that it spawned the following.

msiexec.exe

-----msiexec.exe

-----msiexec .exe

and one other one with one sub process.

iexplore.exe

-----msiexec.exe

If I use the processwait command, will it wait until ALL the procecces are finished? If not, how can I determine which one to use in the statement?

Thanks for all the help. I really appreciate it.

Paul.../NH

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Maybe there is abetter way of accomplishing this? (With or without a script). Any suggestions welcome.

Surely some form of window is shown while the installation takes place? --

Run('iexplore https://ehnfs.ehr.org/Citrix/ICAWEB/en/ica32pkg/ica32pkg.msi')
WinWaitActive('File Download - Security Warning')
Send('!r')
WinWaitActive('Internet Explorer - Security Warning')
Send'"!r')

WinWait('Title of installation window')
WinWaitClose('Title of installation window')

MsgBox(0x40, 'WinXP Success', 'You have successfully upgraded your Citrix client.')
Link to comment
Share on other sites

Surely some form of window is shown while the installation takes place? --

Run('iexplore https://ehnfs.ehr.org/Citrix/ICAWEB/en/ica32pkg/ica32pkg.msi')
WinWaitActive('File Download - Security Warning')
Send('!r')
WinWaitActive('Internet Explorer - Security Warning')
Send'"!r')

WinWait('Title of installation window')
WinWaitClose('Title of installation window')

MsgBox(0x40, 'WinXP Success', 'You have successfully upgraded your Citrix client.')

Ok I like Alex's WinWait idea the best. There IS a window that is diplayed during the enitre installation, and it ends up with a "finish" button. This should work, but I have a dumb question. The window has no title bar. How do I determine its name.

MHZ mentions the PID. This also may be a dumb question. Is the PID the same, every time the same executable or process runs? That is to say, if I run my install 3 times, will PIDs be the same all three times?

Thanks again for all your help.

Paul...

Link to comment
Share on other sites

...Is the PID the same, every time...

Nope.... but you just need to know what it is for each "run" of the script:

$pid = run('\\some-server\some-folder\ica32pkg.msi')

will give you the pid of the process that the run command started.

I'm not sure that such code will help you unless you can get away from using IE.

Put the msi file on a server somewhere.... if you can.

As for a window with no title, you could use:

WinWait("","finish")

but that is not as good as WinGetHandle - see the help file.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

There IS a window that is diplayed during the enitre installation, and it ends up with a "finish" button. This should work, but I have a dumb question. The window has no title bar. How do I determine its name.

I would suggest referring to the window by its class name and window text. You can determine the window's class name (which will very likely be identical across different runs) using AutoIt Window Info and then do this:

Opt('WinTitleMatchMode', 4); at the top of your script

WinWaitClose('ClassName=TheClass', 'Finish'); replace TheClass
; 'Finish' might be '&Finish' or '&Finish >>' -- refer to AutoIt Window Info
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...