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
ToolTips for Shockwave 3D
Sprite recorder v.2
replace escape characters
cXtraSendMail
binary search
Dragging and Magnifying a Sprite
Get Rect of Vertexlist
Display Full Screen
Hold for MPEG then go to marker X
Playthrough
 

 

 

Behavior Open File WIth Associated Application

Added on 6/6/2000

 

Compatibilities:
behavior D7 D8 Mac PC

Required Xtras:
Buddy API

This item has not yet been rated

Author: KumarK

code to open a file with an associated program using Buddy Api Xtra

-----code for opening a file with associated program(requires Buddy API Xtra) ----
---- written for Director 8 ---
---- Kumar.K kumark@icode.com ----

-- custom properties --
property folderlist,theFile,subfolders,fileslist,state,whereto

------ Get Behavior Description List ------
on getPropertyDescriptionList me
  fileslist=getfilelist(me)
  set description = [:]
  statelist=["Normal","Maximized","Minimized","Hidden"]
  addProp description, #theFile, [#format:#String, #comment: "Open Which File ?", #range:fileslist,#default:fileslist[1]]
  addProp description, #state, [#format:#String, #comment: "Open with which Window State? ", #range:statelist, #default:statelist[1]]
  if the currentspritenum = 0 then
    addProp description, #WhereTo, [#comment: "Where To Attach ?",#format:#String, #range:["On EnterFrame","On ExitFrame"],#default:"On EnterFrame"]
  else
    addProp description, #WhereTo, [#comment: "Where To Attach ?",#format:#String, #range:["On MouseUp","On MouseDown","On MouseEnter","On MouseLeave"],#default:"On MouseUp"]    
  end if    
  return description
end getPropertyDescriptionList
------ Get Behavior Description List ------

-- Get Behavior description --
on getBehaviorDescription
  return "This Behavior opens the specified file in the current directory or" & RETURN & "the subfolder(upto level 2) with an associated Program." & RETURN & RETURN &"This Behavior needs Buddy API Xtra to work, so please ensure You Have Buddy API Xtra." & RETURN & RETURN & "Parameters" & RETURN & "* File." & RETURN & "* Window State." & RETURN & "* Where to attach this Script"
end
-- Get Behavior description --

---- get the file name to be opened ----
on getfilelist me
  set mypath=the moviepath
  set fileslist=[]
  set Folders = baFolderList( mypath )
  repeat with i = 1 to folders.count
    set subfolders = baFolderList( mypath & "" & folders[i])
    if subfolders.count <> 0 then
      repeat with j=1 to subfolders.count
        set Files = baFileList( mypath & " " &  folders[i] & "" & subfolders[j],"*.*")
        repeat with k=1 to Files.count
          fileslist.append(folders[i] & "" & subfolders[j] & "" & files[k])
        end repeat
      end repeat
      set Files = baFileList( mypath & " " &  folders[i],"*.*")    
      repeat with j=1 to Files.count
        fileslist.append(folders[i] & "" & files[j])
      end repeat    
    else
      set Files = baFileList( mypath & " " &  folders[i],"*.*")
      repeat with j=1 to Files.count
        fileslist.append(folders[i] & "" & files[j])
      end repeat
    end if      
  end repeat
  return fileslist
end
---- get the file name to be opened ----

-- Events --
on EnterFrame me
  if WhereTo = "On EnterFrame" then
    openfile
  end if
end EnterFrame

on ExitFrame me
  if WhereTo = "On EnterFrame" then
    openfile
  end if
end ExitFrame

on MouseUp
  if WhereTo = "On MouseUp" then
    openfile
  end if
end MouseUp

on MouseDown
  if WhereTo = "On MouseDown" then
    openfile
  end if
end MouseDown

on MouseEnter
  if WhereTo = "On MouseEnter" then
    openfile
  end if
end MouseEnter

on MouseLeave
  if WhereTo = "On MouseLeave" then
    openfile
  end if
end MouseLeave
------ Events ------

---open file ---
on openfile
  set OK = baOpenFile( the moviepath & "" & thefile , state )
end
---open file ---

  

 


Contact

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

Send e-mail