Jump to content

Not an easy qns to solve but.. please help


yong2579

Recommended Posts

We have always been using

Start /wait application switches

to install products which will wait until the product is done installing before moving on to the next instruction in the batch file.

However, what if the application spawns another process out? The situation i'm experiencing is that the [start /wait] command will think that the process is done and move on to execute the next instruction.

This means now there will be 2 processes at the same time, one from the process in the next instruction, and the another one from the spawn process.

Is there any way to make the instruction such that the computer will wait until the process from the spawn is done before moving on to the next instruction?

Link to comment
Share on other sites


ya, i know sleep.exe, and i'm been avoiding it like a plague, cuz it's not accurate at all... i got very varying computer spec in the organization, some very slow, some very fast, if i use sleep, then i must set a different time for each comp'

like 1000 for fast computer

and 5000 for slow computer

something like that, i prefer accurate measurement... is there anyway to do so?

Link to comment
Share on other sites

If this is an Installshield installer you can use the following procedure to build a silent install. The key here is to use the /sms switch when installing the application.

o Extract the files from the original exe using winrar.

o Run the setup.exe /r to create the setup.iss file (by default it is created in the windir folder). You can also use setup.exe /r /f1"C:\setup.iss" to change the location of the iss file although this doesn't always work.

o Move the setup.iss file to the folder where you placed the extracted files

o To install the application use setup.exe /s /sms. The /sms option will wait for all child process to complete before returning.

Some other issues I have had are applications not installing once I burned them to CD. This was because it couldn't write the install log file. In these cases I used the /f2 option to redirect the log file to the C:\ drive. I can't remember the exact syntax but it was something like /f2"C:\appName.log".

If you are worried about space space you can build a self extracting executable using a program like 7zip.

Link to comment
Share on other sites

i do that -SMS thing for adobe photoshop 6.0 and it's works, but this one doesn't' cuz it's not a installshield installer. I bet you guys also never heard of it before

UniCenter Remote Agent

UniCenter Software Delivery

UniCenter Asset Management

they belong to CA (Computer Associates) company. I try asking them but they did not reply me. This program specially UniCenter Asset Management uses its own installer... :)

Link to comment
Share on other sites

i'm a total newbie at scripts... how do i insert this code into cmdlines.txt? What tools do I need?

First download AutoIt from link above.

Create text document with extension .au3 and insert script I gave you (replacing notepad.exe with correct process name)

Modify .bat file like that:

start /wait program1.exe

start /wait program2.exe -this creates additional process

start /wait autoit3.exe scriptname.au3

start /wait program3.exe

...................................

That is how it works: process program2.exe launches another process and ends.

Now AutoIt launches and checks if a process with name you specified exists. If exists - it pauses for a second and then checks again. And so on. When process is finished AutoIt exits and .bat file continues.

If you have multiple programs that behave like this - write a script where process name is variable and compile it to executable.

Link to comment
Share on other sites

Well I'd do as Kenny suggested in so far as:

start /wait autoit3.exe scriptname.au3

But the script I would do would look some thing like so:

Run("App_Name.exe /Switchs"); Orginal file execution
WinWaitActive ('Second_Process_Finish_Window Title'); Pause's script till this Window is Created, then exits.

My script executes the orginal file...along with any switch's it may have....then actively waits for the last window to be created....at that point the script is completed...then your "start /wait" would continue on as normal...tho in reality there maybe a second or two left that the program is still active....tho it should be just waiting for the finish window to exit.

So mine may jump the gun...but it shouldn't make a diff (normally) and you should be zipping through your install as quickly as possible.

Link to comment
Share on other sites

mazin -

Well after giving it more thought....kenedy is probably more correct than I am. :)

Since my method actually requires a window be created at some point...if no window is ever created then it just hangs. :D

So with that in mind and actually running with what kenedy has already outlined I'd suggest the following:

Func _App_Tick($at)
While ProcessExists ($at) = 1
 Sleep  (250)
WEnd
EndFunc

Run("App_Name.exe /Switchs"); Orginal file execution

_App_Tick(proc_1.exe)
_App_Tick(proc_2.exe)
_App_Tick(proc_3.exe)
...

All this does is create a fuction called _App_Tick but you can name it what ever...that just came to mind. :rolleyes: Which is used to save a tad bit on code...or a lot of code depending how many sub-proc's get spawned.

One should ideally just pass one active executable to the fuction...thus as one executable is exited...the newly created one should be passed to the fuction...so on and so forth.

So if you start "Setup_Photoshop.exe" you would then just pass that executable:

_App_Tick(Setup_Photoshop.exe)

Now lets say durning that time frame "Setup_Photoshop.exe" launch's a sub-proc "Setup_QuickTime.exe" but "Setup_Quicktime.exe" starts and finishs prior to "Setup_Photoshop.exe" being completed...in this case there would be no need to pass "Setup_QuickTime.exe" to the fuction, since "Setup_Photoshop.exe" would still keep the script sleeping.

Now lets say "Setup_Photoshop.exe" exits but in doing so "Setup_Remote_Agent.exe" is spawned...in this case we would pass "Setup_Remote_Agent.exe" to the fuction:

_App_Tick(Setup_Remote_Agent.exe)

We would continue to do this as long as one proc is killed off and a new one is spawned.

So we end up with some thing that looks roughly like so:

Func _App_Tick($at)
While ProcessExists ($at) = 1
 Sleep  (250)
WEnd
EndFunc

Run("Setup_Photoshop.exe /VERYSILENT"); Orginal file execution

_App_Tick(Setup_Photoshop.exe)
_App_Tick(Setup_Remote_Agent.exe)

Hehe any ways kenedy was right and I was wrong. :D

Link to comment
Share on other sites

actually guys i must really thanks you all, but i figure it out actually i use a single line of code

ProcessWaitClose($command[1]);

then i compile it into an exe file (ProcessWait.exe) which later on i call in the batch file to track the process name NCSETUP.EXE

start /wait ProcessWait.exe NCSETUP.EXE

that works perfectly for my case. Thanks a lot guys! You guys give me a bit of idea about scripting! hehz'

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
  • Recently Browsing   0 members

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