6 Replies Latest reply on Jun 11, 2006 6:10 PM by Newsgroup_User

    Opening external files in Director Projector... *URGENT*

    chalexmandrake
      Hi, this should be really basic, but I just can't work it out...

      I want to open external files (but kept in the same root directory as my projector file) from a mouse/button click in my projector.

      I don't know any Lingo, but I am assuming it should be pretty straight forward... I need to launch a .pdf, a .html file (I can do this with the goto URL behaviour actually), and a .exe.

      Is there not a preset behaviour for this somewhere?

      Your help is much appreciated.
        • 1. Re: Opening external files in Director Projector... *URGENT*
          Level 7
          No prebuilt behavior needed, it is a simple script.

          on mouseUp
          open the moviePath & "myFile.exe"
          end


          • 2. Re: Opening external files in Director Projector... *URGENT*
            chalexmandrake Level 1
            Thanks for that, it works great for the .exe that I need to launch, but it doesn't seem to work for the .pdf or the .swf that I need to launch. Any chance you could post me the scripts for launching those?

            Please excuse my ignorance of even the most elementary Lingo.

            Thanks again.
            • 3. Re: Opening external files in Director Projector...   *URGENT*
              Level 7
              Download yourself a copy of FileXtra4:
              < http://homepage.mac.com/klkersten/xtras/FileXtra4/index.html>
              and use fx_FileOpenDocument() and fx_FileRunApp() - they will both
              return an error code if they fail which you can refer to using
              fx_ErrorString()
              For example:
              on mouseUp me
              tPath = _movie.path & "file.pdf"
              fx = xtra("FileXtra4").new()
              OK = fx.fx_FileOpenDocument( tPath )
              if ( OK <> 1 ) then
              alert "Error opening document:" && tPath &RETURN& fx.fx_ErrorString()
              end if
              fx = VOID
              end
              • 4. Opening external files in Director Projector... *URGENT*
                chalexmandrake Level 1
                Hi again...

                ...Sorry about this, I am clearly absolutely hopeless... I can't get this FileXtra thing to work either.

                I am sure that this is something really stupidly simple, are you sure that this:

                "on mouseUp
                open the moviePath & "myFile.exe"
                end"

                ...is the right code for launching files other than .exe's?

                (Just to clarify...) My projector is very simple - is just a single page with a few buttons for the interface. If I attach that (above) code to the button associated with the .exe, it works fine and opens a seperate projector. However I have three other buttons, one of which has to launch an external .pdf, one of which has to launch and external .swf, and one of which has to launch an external .wmv. All of these files should open in their default programs, ie. acrobat, flash player, windows media player - as though they were being opened manually. All of the files are located in the same folder as my .exe projector file.

                However, if I use previous the code thus:

                on mouseUp
                open the moviePath & "myFile. pdf/ swf/ wmv"
                end

                Nothing happens at all.

                Are we sure that I am doing this right?

                Thanks again, and further apologies for my hopelessness.
                • 5. Re: Opening external files in Director Projector...   *URGENT*
                  Level 7
                  On Mon, 12 Jun 2006 00:33:34 GMT, chalexmandrake posted in
                  macromedia.director.basics:

                  The Web forum posted the following snippet of, I assume, HTML to the
                  newsgroups:

                  > on mouseUp
                  > open the moviePath & "myFile. pdf/ swf/ wmv"
                  > end

                  Read the help for 'open' to discover why that won't work.

                  Sean's suggestion for using an Xtra is the best solution for opening files
                  with their associated application.

                  > ...Sorry about this, I am clearly absolutely hopeless... I can't get this
                  > FileXtra thing to work either.

                  Why not? The docs that come with FileXtra are pretty straight forward.
                  Did you try his script? Did you search the forum for the many times this
                  problem has been solved?

                  Post the script you're trying and we will be in better shape to help you.


                  --
                  Mark A. Boyd
                  Keep-On-Learnin' :)
                  • 6. Re: Opening external files in Director Projector...     *URGENT*
                    Level 7
                    > Are we sure that I am doing this right?

                    What about the following - copy it into your cast as a behavior and
                    attach it to all your buttons, one at a time, choosing the file you want
                    to open when you click each button. You might need to remove previous
                    code attempts from your buttons. Be sure to include FileXtra4 with your
                    projector - (Menu:) Modify -> Movie -> Xtras..., click Add, locate the
                    xtra and add it to the list displayed; or simply place it in a folder
                    named 'Xtras' alongside your projector
                    --
                    property myFile

                    on getPropertyDescriptionList
                    fx4 = xtra("FileXtra4").new()
                    tRange = fx4.fx_FolderToList( _movie.path )
                    fx4 = VOID
                    return [#myFile: [#comment: "File to open:", #format: #string,
                    #default: tRange[1], #range: tRange]]
                    end

                    on mouseUp me
                    tDelimiter = the itemDelimiter
                    the itemDelimiter = "."
                    tType = the last item of myFile
                    the itemDelimiter = tDelimiter

                    fx4 = xtra("FileXtra4").new()
                    if tType = "exe" then
                    OK = fx4.fx_FileRunApp( _movie.path & myFile )
                    else
                    OK = fx4.fx_FileOpenDocument( _movie.path & myFile )
                    end if

                    if ( OK <> 1 ) then
                    alert "Error opening file:" && myFile &RETURN& fx4.fx_ErrorString()
                    end if

                    fx4 = VOID
                    end