Hi folks,
We have a little in-house app that is registering drag & drop events to its app bundle for certain file types.
But I’m struggling to also have an ImageView work in a similar fashion.
I do have something along the lines of https://macscripter.net/viewtopic.php?pid=165338#p165338 logging back the URL of the dragged object, but I need to pass this back to my “AppDelegate.applescript” & therefore ticket the following:
on |application|:theApp openFile:aFile
theWindow's makeKeyAndOrderFront_(null)
if openOnce
resetValues_(me)
end if
delay 0.1
set my startEnabled to false
set my textEnabled to true
validateButton's setKeyEquivalent:"\r"
set aFile to aFile as text
set my aFile to aFile as text
log "file: " & aFile
set my fileType to do shell script "/usr/bin/mdls " & quoted form of aFile & " -name kMDItemContentType | /usr/bin/awk -F'\"' '{ print $2 }'" as text
log "type: " & fileType
set my fileName to do shell script "/usr/bin/mdls " & quoted form of aFile & " -name kMDItemDisplayName | /usr/bin/awk -F'\"' '{ print $2 }'" as text
log "name : " & fileName
set my pkgLabel to fileName
set my openOnce to true
if fileType equals "com.apple.application-bundle"
set my fileType to "app"
set my appName to fileName as text
tidyName_(aFile, appName, fileType)
else if fileType equals "com.apple.installer-package"
set my fileType to "pkg"
set my appName to text 1 thru -5 of fileName
tidyName_(aFile, appName, fileType)
else if fileType contains "com.apple.installer-package-archive"
set my fileType to "pkg-archive"
set my appName to text 1 thru -5 of fileName
tidyName_(aFile, appName, fileType)
else if fileType contains "public.folder"
set my fileType to "folder" as text
set my appName to fileName as text
tidyName_(aFile, appName, fileType)
else
set errMsg to "open: please drag an app, pkg or folder containing applications"
log errMsg
userNotify_(errMsg)
end if
end
TIA!