Using CoreFoundation via ASOC - possible?
Using CoreFoundation via ASOC - possible?
- Subject: Using CoreFoundation via ASOC - possible?
- From: has <email@hidden>
- Date: Sat, 30 Jan 2016 00:11:33 +0000
Shane, Chris, etc
Any idea how to convert between AS and CF or ASOCified NS and CF types?
I need to call a couple CFURL functions to convert between POSIX- and
Windows-style file paths but ASOC doesn't seem to like CF very much:
use framework "CoreFoundation"
set filePath to "/Users/jsmith"
current application's CFURLCreateWithFileSystemPath(missing value,
filePath, current application's kCFURLPOSIXPathStyle, false)
-- error "CFURLCreateWithFileSystemPath unable to set argument 1 -
the AppleScript value <NSAppleEventDescriptor:
'utxt'(\"/Users/jsmith\")> could not be coerced to type {__CFString=}."
number -10000
use framework "CoreFoundation"
set filePath to "/Users/jsmith"
set filePath to (current application's NSString's
stringWithString:filePath)
current application's CFURLCreateWithFileSystemPath(missing value,
filePath, current application's kCFURLPOSIXPathStyle, false)
-- error "CFURLCreateWithFileSystemPath unable to set argument 1 -
the AppleScript value <NSAppleEventDescriptor: 'obj '{ 'form':'ID ',
'want':'ocid', 'seld':'optr'($307664E0D97F0000$), 'from':null() }> could
not be coerced to type {__CFString=}." number -10000
Thanks,
has
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden