How would I go about assigning a picture to a new Outlook contact in Applescript? The Outlook dictionary tells me that Outlook does have an image class, but I have no clue how to populate one. It doesn't seem to like just being given what the finder thinks is a Jpeg file:
tell application "Finder"
set theImageFile to a reference to file "/path/to/mypicture.jpg"
--set theImageFilePosixPath to POSIX file "/path/to/mypicture.jpg"
set filekind to (kind of theImageFile) as string
display dialog "its a" & filekind--displays "its a jpeg"
end tell
tell application "Microsoft Outlook"
make new contact with properties {first name:"some", last name:"one", image:theImageFile, email addresses:{{address:"*** Email address is removed for privacy ***", type:work}, {address:"*** Email address is removed for privacy ***", type:home}}}
end tell
Result: error "„«class docf» \"image-151718-galleryV9-zhek.jpg\" of «class cfol» \"Pictures\" of «class cfol» \"maximiliantyrtania\" of «class cfol» \"Users\" of «class sdsk» of application \"Finder\"“ kann nicht in den erwarteten
Typ umgewandelt werden." number -1700 from «class docf» "image-151718-galleryV9-zhek.jpg" of «class cfol» "Pictures" of «class cfol» "maximiliantyrtania" of «class cfol» "Users" of «class sdsk»
I may have to create an Image from NSData then, but I'd be curious to see how this is done.
Recent Comments