3 Replies Latest reply on Aug 26, 2006 9:06 PM by Lukewig

    running a project from hard drive

    mohsena
      Hello all
      I am making a multimedia cd ,I want to copy the projector file from cd to a place on the hard drive of the user ,and I want playing this projector from the hard drive ,but with the content on cd ,would you please help me in this case
      Sincerely yours Mohsena
        • 1. running a project from hard drive
          Lukewig Level 1
          Hi,

          An easy way to find your CD is using BuddyAPI Xtra to loop through all the attached drives looking for a specific file that identifies the CD as your CD -- something like this:

          on FindMyCD
          -- assumes you have a file called "cd.ini" in the root
          -- level of your CD (it could be called anything)
          foundDisks = baDiskList()
          repeat with aDisk in foundDisks
          if baFileExists(aDisk&"cd.ini") then return aDisk
          end repeat
          return ""
          end

          So, when your movie starts up and needs to load some content from the CD, then you can do stuff like this

          on StartMovie
          global CDPath
          CDPath = FindMyCD()
          if CDPath = EMPTY then
          alert "Please insert the CD and start again"
          else
          go to movie (CDPath & "NextMovie.dxr")
          end if
          end

          -- or load casts of specific assets from the CD (by setting their filenames etc)

          If you don't want to pay for Buddy, then you can do it without any xtras like this:


          on FindMyCD
          -- assumes you have a file called "cd.ini" in the root
          -- level of your CD (it could be called anything)
          if the last char of the moviePath = ":" then
          -- on a Mac, so simply use the CD name
          aDisk = "CD Volume Name:" -- whatever name you give the CD plus a colon
          if FileExists(aDisk & "cd.ini") then return aDisk

          else
          -- on Windows (lock up your valuables)
          -- loop through possible drive letters, skipping "a" (which is probably a floppy disk?)
          repeat with aLetter = 98 to 122
          aDisk = numToChar(aLetter& ":/")
          if FileExists(aDisk & "cd.ini") then return aDisk
          end repeat
          end if

          end


          (To get the lingo-only "fileExists" function - include this scriipt in your movie: http://www.lingoworkshop.com/code/classes/scripts/filelib.ls

          -- Luke
          • 2. Re: running a project from hard drive
            mohsena Level 1
            Hello and thank you Lukewig very much for the detailed response to my question ,I read the folderExist function ,but I don’t get it completely ,would you please tell me what is the inDirectory and ext parameters in this syntax: on listFiles (inDirectory, ext) , what is stringP(ext) exactly ,and what is maxInteger (what does it do ,and where it is defined) in the following function and where is the directory that we want to find the files in it ?

            on listFiles (inDirectory, ext)
            -- returns a list of files (full path) in specified directory
            -- can supply an option extension to filter the results. If you
            -- want just the file names, use listFileNames below
            fileList = [ ]
            the itemDelimiter = "."
            if stringP(ext) then
            repeat with i = 1 to the maxInteger
            n = getNthFileNameInFolder(inDirectory , i)
            if n = EMPTY then exit repeat
            if ext contains n.item[n.item.count] then
            fileList.append(inDirectory & n)
            end if
            end repeat
            else
            repeat with i = 1 to the maxInteger
            n = getNthFileNameInFolder(inDirectory , i)
            if n = EMPTY then exit repeat
            fileList.append(inDirectory & n)
            end repeat
            end if
            return fileList
            end




            • 3. Re: running a project from hard drive
              Lukewig Level 1
              Hi,

              inDirectory is the directory you want to find files in.
              ext is the extension you want. this is optional. If you don't provide it, all files are listed.
              stringP(ext) tests whether the parameter 'ext' is a string (not void). This is a built in Lingo function
              maxInteger is the biggest integer that Lingo can handle. this is a built in Lingo constant

              Example use of this function

              -- to find all the 'cst' files in the same Directory as the current movie

              inDirectory = the moviePath
              ext = "cst"
              put listFiles(inDirectory, ext)

              Hope this makes it clearer.

              Luke