7 Replies Latest reply on Jun 13, 2006 2:42 PM by Newsgroup_User

    Launch exe in folder above

    Xposure Interactive
      I have an exe which serves as a menu to launch other exe's from sub folders. eg. menu.exe will use api to launch (the moviePath & "\folder1\prog1.exe"). From prog1.exe I need to launch the menu.exe which is in the folder above. I cannot use an absolute root as the program can be installed to different locations.
      Any help would be greatly appreciated.
      Kind regards,
      Duncan
        • 1. Re: Launch exe in folder above
          Level 7
          you can get any folder within a path by telling the function how many levels
          back you want to go. If you request a level farther back than the root, it
          will return the root. The function uses two parameters. The first tells
          the function how far back you want to go and the second tells the function
          to use either the path to the .exe (projector in projector mode or the
          director application in authoring mode) or the path to the .dir

          theFolderIneed = FindFolderAbove (1, #exe)

          will return the folder just above your .exe

          theFolderIneed = FindFolderAbove (1, #dir)

          will return the folder just above your .dir

          on FindFolderAbove whichLevel, whichType
          case (the machineType) of
          256: -- PC
          delim = "\"
          otherwise: -- Mac
          delim = ":"
          end case
          case whichType of
          #exe:
          startPath = the applicationPath
          #dir:
          startPath = the moviePath
          end case
          oldDelim = the itemDelimiter
          the itemDelimiter = delim
          pathLength = (the applicationPath).item.count
          folderPathAbove = startPath.item [1..(pathLength - whichLevel)] & delim
          the itemDelimiter = oldDelim

          return folderPathAbove

          end

          --
          Craig Wollman
          Word of Mouth Productions

          phone 212 928 9581
          fax 212 928 9582
          159-00 Riverside Drive West #5H-70
          NY, NY 10032
          www.wordofmouthpros.com


          "Xposure Interactive" <webforumsuser@macromedia.com> wrote in message
          news:e6jf82$epj$1@forums.macromedia.com...
          >I have an exe which serves as a menu to launch other exe's from sub
          >folders.
          > eg. menu.exe will use api to launch (the moviePath &
          > "\folder1\prog1.exe").
          > From prog1.exe I need to launch the menu.exe which is in the folder above.
          > I
          > cannot use an absolute root as the program can be installed to different
          > locations.
          > Any help would be greatly appreciated.
          > Kind regards,
          > Duncan
          >


          • 2. Re: Launch exe in folder above
            Level 7
            If this is just for Windows then try this:

            on findNewPath
            oldDelim = the itemDelimiter
            fullPath = the moviePath
            the itemDelimiter = "\"
            thisManyItems = the moviePath.item.count
            shortPath = the moviePath.item[1..thisManyItems - 2] & the
            itemDelimiter
            newPath = shortPath & "folder1\prog1.exe"
            the itemDelimiter = oldDelim
            return newPath
            end


            If you need it for both platforms:

            on findNewPath
            oldDelim = the itemDelimiter
            fullPath = the moviePath
            the itemDelimiter = the moviePath.char[the moviePath.char.count]
            thisManyItems = the moviePath.item.count
            shortPath = the moviePath.item[1..thisManyItems - 2] & the
            itemDelimiter
            newPath = shortPath & "folder name" & the itemDelimiter & "prog1
            filename"
            the itemDelimiter = oldDelim
            return newPath

            --
            Rob
            _______
            Rob Dillon
            Adobe Community Expert
            http://www.ddg-designs.com
            412-243-9119

            http://www.macromedia.com/software/trial/
            • 3. Re: Launch exe in folder above
              Level 7
              What about the following (Windows-only) one-liner:
              --
              open _movie.path & "..\menu.exe"
              • 4. Re: Launch exe in folder above
                Level 7
                I believe he asked for the path to an .exe one level ABOVE the current
                projector, not .dir

                --
                Craig Wollman
                Word of Mouth Productions

                phone 212 928 9581
                fax 212 928 9582
                159-00 Riverside Drive West #5H-70
                NY, NY 10032
                www.wordofmouthpros.com


                "Sean Wilson" <webforumsuser@macromedia.com> wrote in message
                news:e6kqjj$9pt$1@forums.macromedia.com...
                > What about the following (Windows-only) one-liner:
                > --
                > open _movie.path & "..\menu.exe"


                • 5. Re: Launch exe in folder above
                  Level 7
                  Hi Craig,

                  > I believe he asked for the path to an .exe one level ABOVE the current
                  > projector, not .dir

                  <quote>I have an exe which serves as a menu to launch other exe's from
                  sub folders.</quote>

                  Any projector also has a valid moviePath (or _movie.path), it's just
                  that when compiled into a projector _movie.path == _player.applicationPath
                  • 6. Re: Launch exe in folder above
                    Level 7
                    But that still doesn't give a path one level above the .exe

                    --
                    Craig Wollman
                    Word of Mouth Productions

                    phone 212 928 9581
                    fax 212 928 9582
                    159-00 Riverside Drive West #5H-70
                    NY, NY 10032
                    www.wordofmouthpros.com


                    "Sean Wilson" <webforumsuser@macromedia.com> wrote in message
                    news:e6ksr9$c8r$1@forums.macromedia.com...
                    > Hi Craig,
                    >
                    >> I believe he asked for the path to an .exe one level ABOVE the current
                    >> projector, not .dir
                    >
                    > <quote>I have an exe which serves as a menu to launch other exe's from sub
                    > folders.</quote>
                    >
                    > Any projector also has a valid moviePath (or _movie.path), it's just that
                    > when compiled into a projector _movie.path == _player.applicationPath


                    • 7. Re: Launch exe in folder above
                      Level 7
                      > But that still doesn't give a path one level above the .exe

                      As I understood it, the OP is opening an application in a directory
                      under the first application and asked how to build a path back to the
                      application in the folder above from the application launched by it. If
                      that is the case, the code I posted should work. Did you test it?