Page 1 of 1

Drag-drop image onto app icon?

Posted: Tue Jun 11, 2019 1:22 am
by thatkeith
I have drag and drop working fine for dropping an image into an object in my stack. But is it possible to set things up so I can drag-drop an image onto my standalone icon in the Dock (I'm on a Mac) and have it work just the same?

Re: Drag-drop image onto app icon?

Posted: Tue Jun 11, 2019 12:28 pm
by Klaus
Hi Keith,

as far as I remember you need to catch -> on appleEvent
See the dictionary for further infoand an example.

And you may need to modify the pList to include one or more image formats in the list of formats that your app can handle. If not you need to press the ALT and CMD key when dragging an image on your dock icon to "force" the apple event.


Best

Klaus

Re: Drag-drop image onto app icon?

Posted: Tue Jun 11, 2019 1:02 pm
by matthiasr
This is an example script how it will work with the standalone under Mac OS.

Put the following script into the stack script and adjust it to your needs.

Code: Select all

on appleEvent pClass, pEventID, pSender
   
   if pClass is "aevt"  and pEventID = "odoc" then
       
       ## This is an apple event
       ## We request the data about the apple event
       request appleEvent data
      
      put it into tFileName
      ## now do whatever you want....
      ## in this example i am sending upload + the complete path of the dragged file to the card Main.
      send "uploadFile tFilename,tStartup" to card "Main" in 50 milliseconds
    
   end if
   
   pass appleEvent  
end appleEvent

Re: Drag-drop image onto app icon?

Posted: Thu Feb 20, 2020 11:03 pm
by thatkeith
Reviving an old(ish) thread:

THANKS for this! I'm sorry I didn't say this before.

One more question: any suggestions for how I should try to get this working for Windows users as well?

Re: Drag-drop image onto app icon?

Posted: Fri Feb 21, 2020 12:32 am
by FourthWorld
The Windows registry is the key - here's how to use it:

http://sonsothunder.com/devres/livecode ... ile004.htm