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
Get CD ROM Drive letter
Convert between bases-Integer to String
Draw a line with lingo
Go to Different Movie
Format Image
JTMR Digital Painter
Generic Slider w/Text
Drop Shadow Follow Mouse or Sprite-Alphamania
Install Shield Pro
Internet Explorer 4 - Mac
 

 

 

Behavior Open File with associated extension.

Added on 10/2/2000

 

Compatibilities:
behavior D7 D8 PC

Required Xtras:
Buddy API

This item has not yet been rated

Author: MediaMacros (website)

Use on a button to open a file with its associated application. User must have the application installed. Select the full pathname. If relative path is checked then the path will be in relationship to the current director movie file, as if you were adding it to the moviePath command.

property fileToOpen, relative, dialog

on getPropertyDescriptionList me
  set p_list = [#fileToOpen: [#format : #string, #comment : "File to open-Including path and extension:", #default:""], #relative : [#format : #boolean, #comment : "Relative path to projector?", #default : true], #dialog : [#format : #boolean, #comment : "Give dialog if program not found?", #default : true]]
  return p_list
end

on mouseUp me
    if relative = true then
    myFile = the moviePath & fileToOpen
  else
    myFile = fileToOpen
  end if
  myFile = baShortFileName(myFile)  
  if baFileExists(myFile) = 1 then
    howMany = fileToOpen.char.count
    extension = fileToOpen.char[(howMany - 2)..howMany]
    prog = baFindApp( extension)
    if prog = "" then
      findIt = baMsgBox("No program was found that is associated with this type of file.  Would you lik to browse for it yourself?", "Find the program yourself?", "YesNo", "Question", 1)
      if findIt = "Yes" then
        prog = baGetFilename( "Open", "c:", "*.exe;*.com;*.bat", "Program Files|*.exe;*.com;*.bat", 0, "Find associated program.", false, -1, 0 )
        baRunProgram( baShortFilename( prog ) && myFile , "maximised", true)
      else    
        exit
      end if
    else        
      baOpenFile(myFile , "maximised")        
    end if
  else
    alert "File" && fileToOpen && "doesn"t exist."
  end if
end


on getBehaviorDescription me
  describe = "Use on a button to open a file with its associated application.  User must have the application installed." & return & "Select the full pathname.  If relative path is checked then the path will be in relationship to the current director movie file, as if you were adding it to the moviePath command."
  return describe
end

 


Contact

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

Send e-mail