Jump to content

Getting Process Id?


Guest tingester
 Share

Recommended Posts

Guest tingester

Hi all,

I'm trying to do an automated install of a different number of windows programs (office, etc). For this task I tried doing

; launch setup
Run(@ComSpec & ' /c ' & '\\server\share\setup.exe', '')
; Give the setup installer time to spawn
Sleep(10000)
; Wait for the installer to finish
ProcessWaitClose('??')

Well the problems comes with question marks .... I can wait on msiexec (standard windows installer) but this process is always there (running by default). Now if I could somehow specify that I was waiting for the process with the highest PID, Im pretty sure things would work (as the new installer will have spawned later). Is this possible ?? Has anyone else used AutoIt for the same purpose, and which way did they go ??

Thanks for any help or comments

Mads Ravn

PS: I also tried waiting on the installer window

WinWaitClose
but that didn't work out either :D Edited by tingester
Link to comment
Share on other sites

Guest tingester

Well here goes nothing

While (!implemented("GetPID") {
Sleep(600000) 
bool status = Beg("Jon");
   if(!status) {
      status = WhineTo("Jon");
      // I think you can gather the rest :D
   }
   else {
      cout << "Woohoo" << endl;
   }
}

If that doesn't work I'll have a look at it tomorrow. Just spotted the fact that msiexec isn't running - I must be tired and it's quite possible that I made a stupid mistake :iamstupid:

Thanks for the suggestions and/or comments all the same

Mads Ravn

Edited by tingester
Link to comment
Share on other sites

  • Administrators

Oooh, he even begged in C++.  That should count for something.

Yeah but the stream operators and non-Jon-style uses of { count against. :D

They will get implemented soon enough - I may ask for some changes though to make it portable to AutoItX.

Link to comment
Share on other sites

Yeah but the stream operators and non-Jon-style uses of { count against.  :D

They will get implemented soon enough - I may ask for some changes though to make it portable to AutoItX.

What sort of changes, Jon? Think it would be better to re-write all (or nearly so) the Process stuff from scratch? I kind of hacked my way in to get PID working, it could probably be a lot better if that was designed in instead of added later...
Link to comment
Share on other sites

  • Administrators

I've not looked at the code properly yet but I'm _guessing_ that you've used the type of variant passed to the PID functions to determine if it is a numeric PID or a process name and then proceeded accordingly.

For the AutoItX stuff I can't have variant datatypes so it will need to be a string type with some method of deciding if the string should be used as a process name or converted to a numerical PID. I guess it could simply be tested and if it only contains numeric chars treat it as a PID?

Please excuse me if this is not the case :D

Link to comment
Share on other sites

Yes and no. Yes, I'm using Variants, but if I remember right, the functions themselves don't even look at the variant, they just pass it right along to Util_DoesProcessExist. It uses isInt(), though.

I do know I had to mess with some stuff for the waiting code, specifically, waiting for a PID to close required modification.

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...