Drag & drop for copying standalone

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
Peter@multidesk.se
Posts: 95
Joined: Fri Oct 14, 2011 6:53 am

Drag & drop for copying standalone

Post by Peter@multidesk.se » Sun Apr 16, 2017 7:53 pm

I'm trying to build a function where I draw a standalone into a text field to copy it to a predetermined location on the hard drive.
Once there, I want to open it from the same application, but I can not make it work. What am I doing wrong?, is it not possible to handle standalones in this way?

Grateful for any help


on mouseDown
set the dragaction to copy
end mouseDown

on dragDrop
if "Pro-Cell" is in the dragdata
then
put the dragdata into thePath
if the platform is "MacOS"
then
set the itemdel to "/"
end if
if the platform is "Win32"
then
set the itemdel to "\"
end if
put item -1 of thePath into myFile
set the defaultFolder to specialFolderPath ("temporary")
put the defaultFolder into tempFolder
put "/" & "Pro-Cell" after tempFolder
if there is no folder tempFolder
then
create folder tempFolder
end if
load url thePath
replace ".app" with empty in myFile
put tempfolder & "/" & myFile into theNewPath
put url ("binfile:" & thePath) into url ("binfile:" & theNewPath)

launch theNewPath
else
beep
end if
end dragDrop



/// Peter
/*Whats all the fuss with c# ?*/

Klaus
Posts: 10291
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Drag & drop for copying standalone

Post by Klaus » Sun Apr 16, 2017 8:39 pm

Hi Peter,

here a couple of hints:
1. No need to differ between Mac and Win here!
LC uses the Unix SLASH as path delimiter internally on ALL platforms!

2. "the dragdata" is an ARRAY!
Check -> the dragdata["files"]

3. "load url xyz" will only work with (from the dictionary) -> Any valid http or ftp URL.

4.

Code: Select all

on mouseDown
  set the dragaction to copy
end mouseDown
will not work, use:

Code: Select all

on dragenter
  set the dragaction to "copy"
end dragenter
5. and most important!
Mac apps are actually FOLDERS, so this will not work on a Mac at all!
Use SHELL with "ditto" on a Mac or "revCopyFolder".


Best

Klaus

Post Reply

Return to “Mac OS”