I want to move selected photo in Photos to Desktop, how can I do it?

I have a photograph selected in Photos like so :

I want to make a macro that when triggered by hotkey, will copy this image to ~/Desktop. How can I do that. So far I have :slight_smile:

Thank you for any help.

This is fairly easy.

See the following for examples:

  1. Copy a file from one location to another
  2. Working with the Finder Selection

You can also do a forum search using this criteria:
tag:files_folders move

If you get stuck, or have questions, feel free to ask more.

Use the Write to a File action.

Write or Append a File.kmactions (0.8 KB)

Hey Peter,

I get action failed when I try and trigger the macro on a photo :

Is my macro :

Also can I ask what do %ICUDateTime expand to? I understand the year, month, day and second expansion.

Also I am curious what is the best way to debug these issue? Is there something built-in to KM that allows me to easily do it?

Sorry, I missed that you are using the Photos app.

In that case, just select one or more photos in the Photos app, and trigger this macro, which is just a container for the AppleScript:

2016-07-22 17:12 CT (Fri)

  • ADDED Choose Folder
  • ADDED Open Output Folder after export

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

### UnComment the next statement if you want an explicit folder set
--set folderOutput to (((path to home folder) as text) & "Documents:Test") as alias

### Comment out the next statement if you use the one above
set folderOutput to (choose folder with prompt ¬
  "Choose FOLDER for Export of Selected Photos" default location (path to home folder))

tell application "Photos"
  set photoList to selection
  set numPhotos to count of photoList
  export photoList to folderOutput with using originals
end tell

tell application "Finder"
  open folderOutput
end tell

set msgStr to ((numPhotos as text) & " Photos have been exported")
display notification msgStr ¬
  with title "Export Photos to Folder"

###MACRO: [Photos] Export Selection of Photos to Folder

[Photos] Export Selection of Photos to Folder.kmmacros (2.3 KB)


UPDATED: 2016-07-22 17:12 CT (Fri)

ADDED Choose Folder
ADDED Open Output Folder after export

The action is failing because there is not an image on the clipboard.

See the documentation on the ICUDateTime token.

The format is a specified with an ICU Date Time Format Specifier which allows you to produce the date in almost any format you desire.