Drag & drop for copying standalone
Posted: 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
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