Hanging on while loop

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • pjhiggins
    Forum Member
    • Feb 2004
    • 73

    Hanging on while loop

    Once again I come to the well....

    I'm Installing an app, Acrobat Reader 5.1 in this case, using the Adobe blind copy configuration file for a semi-silent installation.

    The normal wait for return option on the File.Run command isn't helping me because Acrobat returns a finished status way too early.
    I'm trying to create a loop that will wait for the app to be installed before continuing.

    Here is what I'm trying.

    Acrobat_Installed = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\Adobe\\Acrobat Reader");

    <some stuff to extract the app archive to a temporary folder on C:>

    File.Run("C:\\acrotemp\\Setup.exe", "", "", SW_SHOWNORMAL, true);

    repeat Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\Adobe\\Acrobat Reader") until Acrobat_Installed;

    <some stuff to clean up the temporary folder>
    My app installs ok but my AMS menu hangs.

    Am I barking up the wrong tree with this loop or am I just a touch off on something?

    Thanks!

    -pjh
    Last edited by pjhiggins; 03-08-2004, 11:11 AM.
  • Stefan_M
    Indigo Rose Customer
    • Nov 2003
    • 315

    #2
    Try

    --preset the condition
    Acrobat_Installed=false;
    repeat
    --wait a little bit
    Application.Sleep(3);
    --check the registry key
    Acrobat_Installed = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\Adobe\\Acrobat Reader");

    until (Acrobat_Installed);

    problem:
    this loop will never stop if the Acrobat installation fails.
    "With a rubber duck, one's never alone."

    Douglas Adams, The Hitchhiker's Guide to the Galaxy

    Comment

    • CWRIGHT
      Indigo Rose Customer
      • Jun 2002
      • 42

      #3
      Hi pjh,

      No loop is needed - the installshield SMS command-line parameter will resolve this for you. It stops the setup.exe sending a return until the app is fully installed. Try:

      File.Run("C:\\acrotemp\\Setup.exe", "/SMS", "", SW_SHOWNORMAL, true);

      For info, this only works with installshield setup's which don't use Microsoft Installer technology (such as Reader 5.1). With MSI (Reader 6+) you can use /W (for wait).

      Hope that helps.

      CW

      Comment

      • Worm
        Indigo Rose Customer
        • Jul 2002
        • 3971

        #4
        Another thought would be to use Window.EnumerateTitles(true) in a loop and watch for when the Installer's Window Title is no longer present.

        Comment

        • pjhiggins
          Forum Member
          • Feb 2004
          • 73

          #5
          Thanks to both of you.

          I tried both suggestions and both work for me.

          For this project I'll go with the /SMS option due to some additional subtle timing issues but I will keep notes of the registry monitor for the future.
          Not every problem will be solved by a 3rd party installer command line switch :-)

          Thanks again!

          -pjh

          Comment

          • pjhiggins
            Forum Member
            • Feb 2004
            • 73

            #6
            Also a good idea Worm.

            In this particular case though I am using the InstallShield blind copy .ini file to eliminate all installation dialog windows with the possible exception of some error messages that would have been blocked by the blind copy silent install option and unanswerable by an .iss response file.

            Of the half a dozen apps I'm installing for this project, Acrobat and the InstallShield installer have kicked my butt nicely.
            So many options that you almost have to out smart it to make it act the way you want :-)

            -pjh

            Comment

            • Worm
              Indigo Rose Customer
              • Jul 2002
              • 3971

              #7
              You might try it anyway. Even though you don't see a window, it doesn't mean there isn't one there.

              Edit: never mind, I see you have your solution :oops

              Comment

              Working...
              X