issue: detect if a projector is playing from a locked drive (such as a CD) or if it was copied to the harddrive
download sample

this is a simple way of checking if a projector was copied to soemones harddrive. it will fail, if someone went to the trouble to copy it to another CD. it basically uses the FileIO Xtra to check if the projector is still on a locked drive or not. in many cases this might be enough.

 

this script is basically a modification of the writeToFile script from technote 3192 and checks if the file was saved successfully. if the statusmessage is "OK" you can take the action you want if it is played from the HD.

here's the script, my changes in red.

on writeToFile
  global myfile -- i added this to prevent variable not defined messages
  if objectP(myFile) then set myFile = 0 --Delete the instance if it already exists
  set theFile = the text of field "myfield" -- Put some text into a variable
  set myFile = new(xtra "fileio") -- Create an instance of FileIO
  if the moviePath = "" then
  alert "No moviePath! Save your movie and try again."
  -- Make sure moviePath is NOT empty
  else
    createFile( myfile, the moviepath&"textfile.txt" ) -- Create the file
    openFile( myFile, the moviepath&"textfile.txt",0) -- Open the file with R/W access
    setfinderinfo(myFile, "TEXT ttxt") -- Make readable by SimpleText (Mac only)
    writeString( myFile, theFile) -- Write text to the file
      if error(myFile,status(myFile)) = "OK" then go 5 -- file is on writable disk
     else
      go 10 --
file is on locked drive/CD
    end if

  end if
  closeFile (myFile) -- Close the file
  set myFile = 0 -- Dispose of the instance
end

click here to download a Director 7 sample file

  

 

1