Open application when file double clicked

Richard Gaskin ambassador at
Tue Feb 24 22:53:05 CET 2015

Peter Haworth wrote:
 > I also noticed that I can't drag/drop a file onto the app's window
 > but I think that's probably something to do with its plist entry.

For that you'll need to define the receiving area as a drobbable space. 
  There are a couple ways to do that depending on what you want to do, 
but here's some of the code I use in a tool palette I have open during 
development onto which I drop LC files to open them (more convenient 
then using File->Open, and I often have multiple LC instances open so 
this helps ensure which one gets the file):

on dragEnter
    put the dragData["files"] into tFiles
    if tFiles is not empty then
       set the dragAction to "link"
    end if
    pass dragEnter
end dragEnter

on dragDrop
    put the dragData["files"] into tFiles
    if tFiles is empty then
       exit dragDrop
    end if
    set the itemdel to "."
    repeat for each line tFile in tFiles
       if char 1 to 7 of  tFile = "file://" then delete char 1 to 7 \
          of tFile
       if there is a stack tFile then
          open stack tFile
       end if
    end repeat
    pass dragDrop
end dragDrop

  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  Ambassador at      

More information about the use-livecode mailing list