Announcement

Collapse
No announcement yet.

Partitioned Hard Drive Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Partitioned Hard Drive Question

    Hi All,
    I hope one of you fine experts can help me with this problem.

    My program allows the user to run a seperate .exe program. The .exe program, during installation, allows the user to select what folder to install into. (eg...C:\ or D:\)

    After the installation is finished, I need to create a folder in one of the folders that the installation program created.

    When I use %WinDir%\Program Files\Installed Folder\Put My Folder, It will only create this folder in C:\ but the user installed the program in D:\..

    How can I get it to create in C:\ or D:\ depending on where the user installed the acutal program?

    Thanks for the help!

    Tom


  • #2
    Re: Partitioned Hard Drive Question

    Is the folder path always the same? If it is, you could check for the existence of a file that you know would be in that folder. If it's not on the C: then check D , E, etc.

    If the install writes the location to the registry, or to an uninstall file, you may be able to pull it from there.

    %FileInfo% = File.GetInformation (Existence, "C:\Program Files\Installed Folder\KnownFile.xxx")

    Comment


    • #3
      Re: Partitioned Hard Drive Question

      Maybe I'm missing something here but don't you have the folder in a variable already seeing that the user selected it?

      So for example when the user selected the folder it's path was stored in a variable right? Let's say, %SelectedFolder%. Why not just re-use that variable? i.e. %SelectedFolder%/My New Folder

      If you're saying that the folder was selected in the second app and you need to create a folder when you get back to the first app after installation then simply store the contents of %SelectedFolder% in a registry key or temp text file (a small cookie, i.e. c:\temp_path.txt) using the second app at install time and then retrieve it and destroy it using the first app after install.

      Either way it's easily do-able...

      Corey Milner
      Creative Director, Indigo Rose Software

      Comment


      • #4
        Re: Partitioned Hard Drive Question

        Cor,

        He's running an external EXE to do the install. The external program is where the folder is selected. The question is how to pass that back to AMS. Which we don't know unless we can get more info on the install package.

        Comment


        • #5
          Re: Partitioned Hard Drive Question

          Yeah like I say write it to a registry key or text file cookie via the second app, the installer. I assume he has some control over both apps, if not then he will certainly have to do a file search to determine the folder. (From app1)

          Corey Milner
          Creative Director, Indigo Rose Software

          Comment


          • #6
            Re: Partitioned Hard Drive Question

            I have kind of a fondness for crude methods, so here goes.
            Note: I don't have much experience with .bat files, and I am unsure of the limitations, but heres an idea I got when I read the previous replies...

            1. Run the separate exe file, and do your setup, or whatever this other exe does, and as soon as it starts copying files, cancel it. This way, you will only get a few of the first files it copies. Go to the folder where you installed to, and pick one of the files that are there. Pick one that will obviously be unique to that program.
            2. Create a bat file & run your setup program from there
            This is where I don't know if it will work....(the WHILE part)
            3. *WHILE your separate exe is doing it's whole copy files, install procedure* from the .bat file, have the bat file next check for the existence of the file you selected in step 1 *on all of the fixed drives*(might have to check drive letters one at a time?)
            4. When it finds it, have it store the drive letter & the pathname in a variable, and *write it to an ini file*, which could have been previously placed in a common place eg.%ProgramFiles% (maybe when you click the button that starts your other program. If this variable is only needed one time, have autoplay delete it for you when you're done with it.)

            You could then have autoplay get this value(your drive & pathname) from the ini file, and you would have the variable
            to use for your next step.

            This kind of incorprates the "having to search" idea, but would do it behind your back, while the separate exe is doing it's thing.

            I'm not sure if autoplay actually moves on to the next action if you don't select "wait for program to finish running before coninuing" when running the file execute action. If it does, come to think of it, you could forget everything I just put, and have it do it all in autoplay.

            The parts in *between stars* are parts which I am assuming there is the possibility to do....
            If this actually seems like a do-able approach, please let me know. That's how I would have tried it, so I wouldn't mind if someone tells me why it WOULDN'T work too. Practise makes perfect.
            Rob

            Comment


            • #7
              Re: Partitioned Hard Drive Question

              As mentioned by Corey, the easiest way would be to just have the setup write out the application folder to the Registry or an ini file during installation and then read that value in with AMS actions afterward.

              If you don't have control over the setup process (if it is a third-party installation routine), the best bet would be to use a "File.Search" action to look for a specific file that was installed. Once you get that value, make sure you store it in the Registry or whatever for next time.

              Comment


              • #8
                Re: Partitioned Hard Drive Question

                Thanks for the help you guys,
                Actually while reading all of your replys it gave me an idea that seems to be working as we speak.

                Since I cannot change the process of the external .exe install program, I know that when the installation is completed that a file called setup101.exe will now be in a folder with the path:
                C:\Program Files\"The installed Folder"\

                After the installation is complete, I need to copy some sample programs to a folder called Samples which I will create. So it will be:
                C:\Program Files\"The Installed Folder\Samples\"the sample programs"

                Here is what I am doing and it is probally the hard way;
                %SetupFolderC% = File.GetInformation (Existence, "C:\Program Files\"The Installed Folder\Setup101.exe")
                If there, create the Sample folder then copy the files to it.

                If not,
                %SetupFolderD% = File.GetInformation (Existence, "D:\Program Files\"The Installed Folder\Setup101.exe")
                If there, create the Sample folder then copy the files to it.

                If not,
                %SetupFolderE% = File.GetInformation (Existence, "E:\Program Files\"The Installed Folder\Setup101.exe")
                If there, create the Sample folder then copy the files to it.

                I am only going up to H for the drive names.
                I realize that the drive can be any letter the choose, but the majority of our customers are using C:\ and D:\

                See, the long hard way!

                Any input?

                Tom

                Comment


                • #9
                  Re: Partitioned Hard Drive Question

                  You could use a loop to check all drives to be sure.

                  %DriveLetters% = "C;;D;;E;;F;;G;;H;;I;;J;;K;;L;;M;;N;;O;;P;;Q;;R;;S ;;T;;U;;V;;W;;X;;Y;;Z"
                  %CTR% = "0"
                  WHILE (%CTR% <=23 )
                  %Drive% = String.GetDelimitedString ("%DriveLetters%", ";;", %Ctr%)
                  %FileInfo% = File.GetInformation (Existence, "%Drive%:\Program Files\Install Folder\setup101.exe")
                  IF (%FileInfo%=TRUE)
                  %InstalledDrive% = "%Drive%"
                  %Ctr% = "24"
                  END IF
                  %Ctr% = Evaluate (%Ctr% + 1)
                  END WHILE
                  //there should be a check here to be sure that %FileInfo% is equal to true
                  //otherwise, if setup101.exe is not found, it will try to put it on the Z drive

                  Folder.Create ("%InstalledDrive%:\Program Files\Install Folder\Samples")
                  File.Copy ("%SrcDir%\Samples\*.*", "%InstalledDrive%\Program Files\Install Folder\Samples\")

                  ---Cut and Paste----

                  <IR_ACTIONS_LIST>
                  <Action name="Set Value">
                  <Type>6</Type>
                  <Function>0</Function>
                  <DTIndentLevel>0</DTIndentLevel>
                  <Enabled>1</Enabled>
                  <ErrorHandling>
                  <UserNotificationMode>2</UserNotificationMode>
                  <CustomErrorMessage/>
                  <OnErrorAction>0</OnErrorAction>
                  <JumpToLabel/>
                  </ErrorHandling>
                  <Variable>%DriveLetters%</Variable>
                  <Value>C;;D;;E;;F;;G;;H;;I;;J;;K;;L;;M;;N;;O;;P;;Q ;;R;;S;;T;;U;;V;;W;;X;;Y;;Z</Value>
                  <Evaluate>0</Evaluate>
                  </Action>
                  <Action name="Set Value">
                  <Type>6</Type>
                  <Function>0</Function>
                  <DTIndentLevel>0</DTIndentLevel>
                  <Enabled>1</Enabled>
                  <ErrorHandling>
                  <UserNotificationMode>2</UserNotificationMode>
                  <CustomErrorMessage/>
                  <OnErrorAction>0</OnErrorAction>
                  <JumpToLabel/>
                  </ErrorHandling>
                  <Variable>%CTR%</Variable>
                  <Value>0</Value>
                  <Evaluate>0</Evaluate>
                  </Action>
                  <Action name="WHILE">
                  <Type>204</Type>
                  <Function>1</Function>
                  <DTIndentLevel>0</DTIndentLevel>
                  <Enabled>1</Enabled>
                  <ErrorHandling>
                  <UserNotificationMode>2</UserNotificationMode>
                  <CustomErrorMessage/>
                  <OnErrorAction>0</OnErrorAction>
                  <JumpToLabel/>
                  </ErrorHandling>
                  <Condition>%CTR% &amp;lt;=23
                  </Condition>
                  </Action>
                  <Action name="Get Delimited String">
                  <Type>64</Type>
                  <Function>0</Function>
                  <DTIndentLevel>1</DTIndentLevel>
                  <Enabled>1</Enabled>
                  <ErrorHandling>
                  <UserNotificationMode>2</UserNotificationMode>
                  <CustomErrorMessage/>
                  <OnErrorAction>0</OnErrorAction>
                  <JumpToLabel/>
                  </ErrorHandling>
                  <Variable>%Drive%</Variable>
                  <Source>%DriveLetters%</Source>
                  <Delimiter>;;</Delimiter>
                  <ItemIndex>%Ctr%</ItemIndex>
                  </Action>
                  <Action name="Get Information">
                  <Type>14</Type>
                  <Function>0</Function>
                  <DTIndentLevel>1</DTIndentLevel>
                  <Enabled>1</Enabled>
                  <ErrorHandling>
                  <UserNotificationMode>2</UserNotificationMode>
                  <CustomErrorMessage/>
                  <OnErrorAction>0</OnErrorAction>
                  <JumpToLabel/>
                  </ErrorHandling>
                  <FileInformationToCollect>3</FileInformationToCollect>
                  <Variable>%FileInfo%</Variable>
                  <FileName>%Drive%:\Program Files\Install Folder\setup101.exe</FileName>
                  </Action>
                  <Action name="IF">
                  <Type>200</Type>
                  <Function>1</Function>
                  <DTIndentLevel>1</DTIndentLevel>
                  <Enabled>1</Enabled>
                  <ErrorHandling>
                  <UserNotificationMode>2</UserNotificationMode>
                  <CustomErrorMessage/>
                  <OnErrorAction>0</OnErrorAction>
                  <JumpToLabel/>
                  </ErrorHandling>
                  <Condition>%FileInfo%=TRUE</Condition>
                  </Action>
                  <Action name="Set Value">
                  <Type>6</Type>
                  <Function>0</Function>
                  <DTIndentLevel>2</DTIndentLevel>
                  <Enabled>1</Enabled>
                  <ErrorHandling>
                  <UserNotificationMode>2</UserNotificationMode>
                  <CustomErrorMessage/>
                  <OnErrorAction>0</OnErrorAction>
                  <JumpToLabel/>
                  </ErrorHandling>
                  <Variable>%InstalledDrive%</Variable>
                  <Value>%Drive%</Value>
                  <Evaluate>0</Evaluate>
                  </Action>
                  <Action name="Set Value">
                  <Type>6</Type>
                  <Function>0</Function>
                  <DTIndentLevel>2</DTIndentLevel>
                  <Enabled>1</Enabled>
                  <ErrorHandling>
                  <UserNotificationMode>2</UserNotificationMode>
                  <CustomErrorMessage/>
                  <OnErrorAction>0</OnErrorAction>
                  <JumpToLabel/>
                  </ErrorHandling>
                  <Variable>%Ctr%</Variable>
                  <Value>24</Value>
                  <Evaluate>0</Evaluate>
                  </Action>
                  <Action name="END IF">
                  <Type>201</Type>
                  <Function>1</Function>
                  <DTIndentLevel>1</DTIndentLevel>
                  <Enabled>1</Enabled>
                  <ErrorHandling>
                  <UserNotificationMode>2</UserNotificationMode>
                  <CustomErrorMessage/>
                  <OnErrorAction>0</OnErrorAction>
                  <JumpToLabel/>
                  </ErrorHandling>
                  </Action>
                  <Action name="Set Value">
                  <Type>6</Type>
                  <Function>0</Function>
                  <DTIndentLevel>1</DTIndentLevel>
                  <Enabled>1</Enabled>
                  <ErrorHandling>
                  <UserNotificationMode>2</UserNotificationMode>
                  <CustomErrorMessage/>
                  <OnErrorAction>0</OnErrorAction>
                  <JumpToLabel/>
                  </ErrorHandling>
                  <Variable>%Ctr%</Variable>
                  <Value>%Ctr% + 1</Value>
                  <Evaluate>1</Evaluate>
                  </Action>
                  <Action name="END WHILE">
                  <Type>205</Type>
                  <Function>1</Function>
                  <DTIndentLevel>0</DTIndentLevel>
                  <Enabled>1</Enabled>
                  <ErrorHandling>
                  <UserNotificationMode>2</UserNotificationMode>
                  <CustomErrorMessage/>
                  <OnErrorAction>0</OnErrorAction>
                  <JumpToLabel/>
                  </ErrorHandling>
                  </Action>
                  <Action name="Create">
                  <Type>28</Type>
                  <Function>0</Function>
                  <DTIndentLevel>0</DTIndentLevel>
                  <Enabled>1</Enabled>
                  <ErrorHandling>
                  <UserNotificationMode>2</UserNotificationMode>
                  <CustomErrorMessage/>
                  <OnErrorAction>0</OnErrorAction>
                  <JumpToLabel/>
                  </ErrorHandling>
                  <DirectoryName>%InstalledDrive%:\Program Files\Install Folder\Samples</DirectoryName>
                  </Action>
                  <Action name="Copy">
                  <Type>25</Type>
                  <Function>0</Function>
                  <DTIndentLevel>0</DTIndentLevel>
                  <Enabled>1</Enabled>
                  <ErrorHandling>
                  <UserNotificationMode>2</UserNotificationMode>
                  <CustomErrorMessage/>
                  <OnErrorAction>0</OnErrorAction>
                  <JumpToLabel/>
                  </ErrorHandling>
                  <Source>%SrcDir%\Samples\*.*</Source>
                  <Destination>%InstalledDrive%\Program Files\Install Folder\Samples\</Destination>
                  <RecurseSubdirectories>0</RecurseSubdirectories>
                  <OverwriteExistingFiles>0</OverwriteExistingFiles>
                  <ContinueAfterFail>0</ContinueAfterFail>
                  <CopyHiddenSystem>0</CopyHiddenSystem>
                  <DialogTitle>Copying Files</DialogTitle>
                  </Action>
                  </IR_ACTIONS_LIST>

                  ---End Cut and Paste----

                  Comment


                  • #10
                    Re: Partitioned Hard Drive Question + Icon Issue

                    AH HA!
                    I knew you guys would know an eaiser way!
                    Thank you very much I will try this in my program and let ya know how it went!

                    Anybody have a problem with using an icon from a file.(my own) where the icon will not change back to the windows drive icon in My Computer folder after the CD is removed from their computer?
                    This is happening and will only change back after rebooting the computer.

                    Thanks again for the help!
                    Tom

                    Comment


                    • #11
                      Re: Partitioned Hard Drive Question + Icon Issue

                      Watch out though...some users (not many, but possibly not none) might not have the Program Files folder in the root of the partition, and some might not have it named "Program Files" either.

                      I've had systems set up both non-standard ways in the past, for various reasons. (Now I just don't bother.)

                      You might want to use the %ProgramFiles% variable instead...that will contain the path where the user's actual Program Files folder is, regardless of where it is or what it is called.

                      The only thing %ProgramFiles% won't catch is if the user installed the program to a folder that just happens to be called Program Files, e.g. "D:\Program Files" which they use for the programs they install on that partition, i.e. in addition to the normal "C:\Program Files" that is the actual default application install directory.

                      Since this case isn't very likely, you could perform whatever automated tests (searches) you want, and then if all else fails, ask the user where they installed the program (with a Select Folder action), and maybe give them the option to search the whole system. That way you have an all-else-fails option to fall back on.
                      --[[ Indigo Rose Software Developer ]]

                      Comment

                      Working...
                      X
                      😀
                      🥰
                      🤢
                      😎
                      😡
                      👍
                      👎