Copy selection of images from Photos.app
See 4d-utility-sign-app on how to enable the plugin in 4D.
carbon | cocoa | win32 | win64 |
---|---|---|---|
You must codesign your app with the following entitlement:
com.apple.security.automation.apple-events
The app must also have the following property list key:
NSAppleEventsUsageDescription
You should disable iCould photo library update, or select "download original to this Mac", to prevent Photo from attempting to access the internet. Otherwise, the import could fail, and the application could freeze, if internet connection in unavailable.
//this is not really a drag-n-drop api, it simply returns the selected images in Photos.app
//but normally dragged items are also selected, so it should work...
//import synchron
//Photos GET SELECTION ($photos;$names;$dates;$ids)
$method:="myImport" //(picture;text;text;text;long;long)->bool
//import asynchron
Photos GET SELECTION ($photos;$names;$dates;$ids;$method;$process)
//$process(out):import process number
- myImport
C_PICTURE($1)
C_TEXT($2;$3;$4)
C_LONGINT($5;$6)
C_BOOLEAN($0)
TRACE
$photo:=$1
$name:=$2
$date:=$3
$id:=$4
$pos:=$5
$total:=$6
$0:=Caps lock down //return true to abort