Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Director To Go
Pulling in Those Graphics
E-mailExec 2.0
FileFlex
Buddy Zip/Unzip
Macromedia
Volume Controller SWA(Shockwave Audio)
encrypt/decrypt Image
Direct Media Video Slider
Install Shield Pro
 

 

 

Behavior Installer

Added on 10/2/2000

 

Compatibilities:
behavior D7 D8 PC

Required Xtras:
Buddy API

Rating:

Author: MediaMacros (website)

This is a rather complex behavior that will set up programs, check for QuickTime, copy files, etc. It will also check to see if it has run before so the user does not have to go through the process each time. Just put it on the frame script of the first frame of your movie and you are ready to go. Make sure you carefully follow the specifications of how to set up each field in the parameters and do not include unnecessary spaces. To allow for a re-install, run the cleanForReinstall() command.

property QTCheck, QTInstaller, installerList, xCopyList, copyList, defaultDirectory, defaultSub, shortcutData, onDesktop, projectName

on getPropertyDescriptionList me
  p_list = [:]
  addProp p_List, #QTCheck, [#format : #float, #comment : "Check for QT version X or greater (enter 0 to skip the check):" & return, #default : 3.0]
  addProp p_list, #QTInstaller, [#format : #string, #comment : "Relative path to the QT installer from the moviePath(Use ~for a path from the root of the CD):"& return, #default : "installersQT3qt3.exe"]
  addProp p_list, #installerList, [#format : #string, #comment : "List of other installers and the relative Path to them from the moviePath." & return & "Use this format-Name:path,name:path-With no spaces."& return, #default : "DirectX:installersdirectXdx6.exe,Acrobat:installersacrobatacroread.exe"]
  addProp p_list, #xCopyList, [#format : #string, #comment : "List of directories relative to the moviePath to copy" & return & "(Note that all sub directories will also be copied, if the directory is relative to the root of the CD then start the string with ~)The second part is the subDirector from the DefaultSub directory." & return &"Separate with commas:"& return, #default: "~fonts:items,installersmydemo:installers,sourceelements:source"]
  addProp p_list, #copyList, [#format : #string, #comment : "List of individual files to be copied.  Same instructions as above."& return, #default : "~start.exe:,moreStuff eadme.txt:moreStuff"]
  addProp p_list, #defaultDirectory, [#format : #string, #comment : "Default install directory root(Other for exact path):"& return, #default : "Program Files", #range : ["Program Files", "System", "System32", "Temp", "Desktop", "Common Files", "Other"]]
  addProp p_list, #defaultSub, [#format : #string, #comment : "SubDirectory (or exact path):"& return, #default : "MyProject"]
  addprop p_list, #shortcutData, [#format : #string, #comment : "Data for creating a shortcut. Enter shortcut group, shortcut name, program path relative to copy directory(or ~ and path for on the cd"& return, #default : "MyGroup,MyShortcut,Start.exe"]
  addProp p_list, #onDesktop, [#format : #boolean, #comment : "Make a shortcut on the desktop?"& return, #default : true]
  addprop p_list, #projectName, [#format : #string, #comment : "Project's Name"& return, #default : "MyProject"]
  return p_list
end

on exitFrame me
  if baReadRegString("Software" & projectName, "Total Program","Error","HKEY_LOCAL_MACHINE") <> "Done" then
    --check qt and install
    if QTCheck <> 0 then
      the itemDelimiter = "."
      if QtCheck > float(baVersion("qt3").item[1..2])  then
        if QTInstaller.char[1] = "~" then
          baRunProgram(the moviePath.char[1..2] & QTInstaller, "Normal", TRUE)
        else
          baRunProgram(the moviePath & QTInstaller, "Normal", TRUE)
        end if
      end if
    end if
    --setup default copy directory
    if defaultDirectory <> "Other" then
      copyTo = baSysFolder(defaultDirectory) & defaultSub  
    else
      copyTo = defaultSub
    end if
    if copyTo.char[copyTo.char.count] <> "" then
      copyTo = copyTo & ""
    end if
    if baFolderExists(copyTo) = 0 then
      baCreateFolder(copyTo)
    end if
    
    --install other files and write reg key for done
    the itemDelimiter = ","
    instProgs = []
    if installerList <>"" then
      repeat with x = 1 to installerList.item.count
        add instProgs, installerList.item[x]
      end repeat
      the itemDelimiter = ":"
      repeat with x = 1 to instProgs.count
        inst = baReadRegString( "Software" & projectName, instProgs[x].item[1], "MeEmpty", "HKEY_LOCAL_MACHINE" )
        if inst <> "Done" then
          ok = baRunProgram(instProgs[x].item[2], "Normal", TRUE)
          if ok > 31 then
            baWriteRegString("Software" & projectName, instProgs[x].item[1],"Done","HKEY_LOCAL_MACHINE")
          end if
        end if
      end repeat
    end if
    
    --copy xfiles
    the itemDelimiter = ","
    fullList = []
    if xCopyList <> "" then
      repeat with x = 1 to xCopyList.item.count
        add fullList, xCopyList.item[x]
      end repeat
      the itemDelimiter = ":"
      repeat with x = 1 to fullList.count
        baCopyXFiles( fullList[x].item[1] , copyTo & fullList[x].item[2] , "*.*" , "IfNewer" )
      end repeat
    end if
    
    --copy individual files
    the itemDelimiter = ","
    fullList = []
    if copyList <> "" then
      repeat with x = 1 to copyList.item.count
        add fullList, copyList.item[x]
      end repeat
      the itemDelimiter = ":"
      repeat with x = 1 to fullList.count
        baCopyFile( fullList[x].item[1] , copyTo & fullList[x].item[2] , "IfNewer" )
      end repeat
    end if
    
    --make shortcuts
    if shortCutData <> "" then
      the itemDelimiter = ","
      datalist = []
      repeat with x = 1 to shortCutData.item.count
        add datalist, shortcutData.item[x]
      end repeat
      if datalist.count <> 3 then
        alert("Incorrect number of parameters passed.  Unable to creat shortcut!!")
        exit
      else
        whatGroup = dataList[1]
        whatShortcut = datalist[2]
        whatPath = datalist[3]
        if whatPath.char[1] = "~" then
          --relative to the CD
          endPath = whatPath.char[2..(whatPath.char.count)]
          driveLetter = the moviePath.char[1]
          whatPath = driveLetter & ":" & endPath
        else
          whatPath = copyTo & whatPath
        end if
        baCreatePMGroup( whatGroup )    
        baCreatePMIcon( whatPath, whatShortCut , whatPath , 0 )  
        --write on desktop shortcut
        if onDesktop = true then
          baMakeShortcut( whatPath , baSysFolder("desktop") , whatShortcut )
        end if      
      end if
    end if
    
    --write closed key
    baWriteRegString("Software" & projectName, "Total Program","Done","HKEY_LOCAL_MACHINE")
  end if
end

on getBehaviorDescription me  
  describe = "This is a rather complex behavior that will set up programs, check for QuickTime, copy files, etc.  It will also check to see if it has run before so the user does not have to go through the process each time.  Just put it on the frame script of the first frame of your movie and you are ready to go.  Make sure you carefully follow the specifications of how to set up each field in the parameters and do not include unnecessary spaces." & return & "To allow for a re-install, run the cleanForReinstall() command."
  return describe
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail