drag n drop

Klaus Major klaus at major-k.de
Thu Mar 31 12:07:24 EST 2005


Hi Thomas,

> Hello to the list,
>
> I need a little advice here.
>
> I want to make a standalone that will except drag n drop. I need to 
> know how to tell the difference between a folder, file, and 
> application on both Macintosh and Windows based computers.

i use to check the dropped items:

on dragdrop
   put the dragdata into tFiles
   repeat for each line l in tFiles
     if there is a file l then
       ## This is a file :-)
     end if
     if there is a folder l then
      ## And this is a folder :-)
     end if
   end repeat
...

> I want the user to be able to drag anything to a standalone window and 
> then interpret what it is and create a short cut to it. I also want to 
> treat the different types differently, so I need to know what was 
> dropped.

set the itemdel to "."
switch item -1 of tFiles
   case "jpg"
   case "jpeg"
etc...

You get the picture :-)

Apps do have an "*.exe" suffix on windows and an "*.app" suffix on the 
mac (OS X)...

> Any help on both the Mac and Win approach is appreciated.

It is almost identical on Win and Mac, except if you want to check the 
"FILETYPE"/"CREATORCODE"
on the mac, in case the files do NOT have a suffix...

Please also check my famous plug-in "2lz2", which also supplies drag 
and drop functionality
to new created stacks. Tweak the script to make it work for your needs!

Hope that helps...

> Thanks
>
> Tom
>
>
> Thomas J McGrath III
> 3mcgrath at adelphia.net
>
> 412-831-3094
> 220 Drake Road
> Bethel Park, PA 15102

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de



More information about the use-livecode mailing list