No announcement yet.

file search and directory variable

  • Filter
  • Time
  • Show
Clear All
new posts

  • file search and directory variable

    Hi there...having a little trouble here....
    Trying to get SUF to find a file during a setup (right off the bat), which it does. But I then want to take that information, and use the directory the file was found in as the default installation directory. I've tried messing around with the strings and such, but I either simply get a number as the default directory, or the variable itself.
    It also seems to have some problems copying or moving files after they have been installed..
    Any tips?

  • #2
    Re: file search and directory variable

    OK, so your first action would be the "Search For File" action which returns a semi-colon delimited list of paths where that file was found. You will probably need to do perform some string actions to determine which is a valid result and check for whether it was indeed found or not. You could use actions such as "Count Delimited Strings" and comparing the string to the default value. Once you determine which string is the valid one you would get it's index and then use the "Get Delimited String" action to place that single path and store it in a variable. You can then use the "Parse Path" action in order to store the path (without the file name) in the variable %AppDir%. You would then be able to place the variable %AppDir% as the default install folder on your screen.

    The best thing to do is use Show Message Box actions during your action scripts so you can see the contents of each of the variables as they are being worked with in order to validate what is happening.

    As far as the copying or moving files problem, we'll need more detail as to what you are currently doing and what the result is.


    • #3
      Re: file search and directory variable

      Well I fixed the moving/copying issues, and got the search to work properly after adding the Parse String command..
      But in the instance where many occurences of the same file are found you mention using the Get Delimited String and Count Delimited string...I just experimented with that but it still ends up wanting to install to a big list of the same files.


      • #4
        Re: file search and directory variable

        If the situation exists where there are more than one location where the file has been found, you will need some way to determine which is the "correct" location. What type of file are you searching for? How do you wish to handle a situation where multiple instances of that file is found? It's really up to you how you would like to handle that situation. Can you test each file, such as getting a version number, CRC value etc.? Or you could use a List Box screen to allow the user to decide what is the correct location given the file you searched for.

        This may be too late already as you may have the product out there in the field, but often the best thing to do is write the installation path to the Registry instead of searching for a file so you can reference it in the future.

        So describe in further detail what you would like to happen for multiple instances of the file, and we'll try to point you in the right direction. Also include the action sequence you are currently using.


        • #5
          Re: file search and directory variable

          In my particular instance, I am "packaging" a mod for a game. Often people will copy aspects of the games' directory so that if they change anything, they can easily revert back to the factory installation. So in this case when I do a search and turn up multiple instances, they are essentially the exact same files. So a crc value or version number wouldn't work here. And I'm not sure reading a registry value would, either. But possibly. It sounds as though a list box is what i might have to use.
          I wanted to bypass the default location of the game altogether, as many people don't use it, and that's where the search comes in.
          Ideally, I suppose, I'd just like the installer to figure out which is the correct instance [img]/ubbthreads/images/icons/laugh.gif[/img] ... would a Read from Registry command work here?


          • #6
            Re: file search and directory variable

            ok, action sequence...
            first, before getting to the welcome screen, i have the installer search for a specific file (we'll call it go.exe).
            Then it parses the path of that file to get the directory. This directory is then determined to be the base installation folder.
            I have in place there, a message box for if the file is not found at all.
            that's all i've got for that one...the next screen is the select install type (there is 1 optional package)
            After an install type is chosen, the installer determines if is being implemented on windows xp/nt, and if so, makes some changes (deletes a directory)
            After that it's to the Ready to Install screen (no actions)
            and then to the Setup Finished screen (here it copies some files from a temporary directory to the installation path and deletes the remaining ones)

            Another question...
            How would I get all instances of the same file (and therefore directories) to be listed as options in the check box screen?


            • #7
              Re: file search and directory variable

              Ideally, I suppose, I'd just like the installer to figure out which is the correct instance ... would a Read from Registry command work here?
              I'd be surprised if the game didn't write its installation path in the Registry somewhere, for patching purposes. Reading from the Registry is definitely the way to go, IMO. Do a search through the Registry for the name of the game -- what game is it, btw? [img]/ubbthreads/images/icons/smile.gif[/img]

              When I used Setup Factory to make an installer for my Tribes client-side mod packs, I got the path from the Registry, and it worked like a charm.
              --[[ Indigo Rose Software Developer ]]


              • #8
                Re: file search and directory variable

                The game is Battlezone...and yeah, there are definately some references in the registry for it's installation folder. I initially tried to do a registry search and use the results in a variable that would be this mod's installation path, but instead of a directory i got something like "Default/Activision/Battlezone" as the path.
                I know i just did something wrong or left something out, but i haven't figured out what.
                How did you work that reg search in your mods?


                • #9
                  Re: file search and directory variable

                  Ah, Battlezone rocked. That was one of the first games I ever bought for the PC. (I jumped ship from the Amiga a little later than most. [img]/ubbthreads/images/icons/smile.gif[/img])

                  I actually reinstalled it last weekend hoping to go back and finish off the game, but it didn't like something in my combination of VIA mobo/Windows XP/Geforce4400/nVidia drivers. All the text was messed up, and none of the fixes or tweaks I could find would change that.

                  I might try making some room on my 98 partition to see if it behaves any better, maybe XP is the culprit.

                  But to answer your question: I just searched through the Registry to find where Dynamix put their key, looked in there for the path to the game, and then used an action in the setup to read that key directly.

                  "Default/Activision/Battlezone" seems a bit unusual. Do they have another key in there called "Default" or something where they stored the path? Are there any other paths in the Registry associated with Activision?

                  Do you have the game installed in the default install folder? If so, maybe try installing it to a non-standard path and see if that Reg value changes.

                  (All my games go in F:\Games. [img]/ubbthreads/images/icons/wink.gif[/img])
                  --[[ Indigo Rose Software Developer ]]


                  • #10
                    Re: file search and directory variable

                    Well I think I got it going...the registry thing that is...Software\Microsoft\Windows\App Path\bzone_exe\Path or something like that is the one I chose...the activision one itself would have been trickier for what I wanted this mod installer to do.

                    As for you Battlezone sounds like your render.cfg file may need some fixing.
                    Activision's support forum has an example of how it should look. Just copy the text and make a new render.cfg file and put it in the Battlezone folder.
                    Yeah, it IS really buggy under XP...particularily for multiplayer games. There is something of an anti-lag patch out there, but i've never had it work that well. My solution to that problem was just installing it on a win98 partition. [img]/ubbthreads/images/icons/wink.gif[/img] Worked for me.
                    Thanks for all your help.


                    • #11
                      Re: file search and directory variable

                      Another question...I have a restart screen in my setup but it's not showing up when I run it...i pretty much left it as is and didn't change any variable or anything...any ideas?


                      • #12
                        Re: file search and directory variable

                        By default the "Reboot System" screen has the screen condition:

                        (%NeedsReboot% = TRUE) AND (%SysLanguage% = 9)

                        The variable %NeedsReboot% is set if a file is in use that must be replaced upon reboot. Therefore if you always wish to display that screen, just remove the "(%NeedsReboot% = TRUE) AND" portion and it should do what you want.

                        Hope that helps.


                        • #13
                          Re: file search and directory variable

                          thanks! got it working now


                          • #14
                            Re: file search and directory variable

                            Thanks for the render.cfg tip, but I already tried that and it didn't work. [img]/ubbthreads/images/icons/smile.gif[/img] (I also tried a bunch of other suggestions I found in the FAQ and in discussions on usenet to no avail.)
                            --[[ Indigo Rose Software Developer ]]