Re: Scripting from Photos to Outlook
Re: Scripting from Photos to Outlook
- Subject: Re: Scripting from Photos to Outlook
- From: Deivy Petrescu <email@hidden>
- Date: Wed, 5 Jul 2017 00:58:28 -0400
> On Jul 4, 2017, at 22:58 , Christian Boyce <email@hidden> wrote:
>
> Apple's Photos app has a Sharing button that lets you share selected items
> via Apple's Mac Mail app. I want to use Outlook instead of Mail. I know that
> I can go to Mail's Preferences and set Outlook as the default mail app. It
> looks good, but it doesn't work. Outlook doesn't show up in the Sharing menu.
> I have this idea that I could use AppleScript to do the job. The work flow
> should be something like this:
> 1. Select some number of photos in Photos
> 2. Trigger an AppleScript-- perhaps as a Service via Contextual menu
> 3. Outlook opens up, creates a new outgoing email message, and the selected
> photos are attached to the message.
> I have this:
> tell application "Photos"
> set the_files to the selection
> end tell
> And I have this:
> tell application "Microsoft Outlook"
> activate
> set the_Message to make new outgoing message
> open the_Message
> end tell
>
> I think I know how to attach a file to an outgoing email message, but only if
> I have a path to the file. I don't get a path when I select photos-- I get
> something like this:
> media item id "1xr4dfaef73d"
>
> Maybe there's a way for me to get the path to the file on disk. That's where
> I'm looking. But maybe there is another way to do it.
> Any suggestions?
> (Microsoft SHOULD provide the fix for this, but the problem's been around for
> a few years and a few versions so it looks as if Microsoft isn't ever going
> to fix it.)
> Thank you for your help--
> cChristian Boyce
> Christian Boyce and Associates
> Mac, iPhone, and iPad Consultants
> _______________________________________________
Christian,
Photos dictionary does not have a direct way to get the path to a photo, which
is not good, but you can go around it, and it might work.
So,here are 2 similar ways to get the path.
I prefer locate, but I don’t know if everyone uses it so…
tell application "Photos"
set the_files to selection
repeat with the_file in the_files
set the_file to contents of the_file
set nome to the_file's filename
--set fpath to do shell script "locate " & nome
set fpath to do shell script "mdfind -name " & nome
return fpath —this is here for you to test it change it to your
needs
end repeat
end tell
Deivy Petrescu
email@hidden
_______________________________________________
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