Skip to content

Commit

Permalink
Added support for CaptureOne 21
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleugoletti committed Mar 19, 2021
1 parent c965c88 commit 64e4c41
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 0 deletions.
128 changes: 128 additions & 0 deletions CaptureOne 21/Virtual Copy.applescript
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
(*
Create a Virtual Copy of the image
Created by Daniele Ugoletti
*)
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

tell the application "Capture One 21"
set isSession to (get session = (kind of current document))
set theSource to primary variant

-- check if a image is sselected
if theSource is equal to missing value then
set theDialogText to "Please select a image or variant."
display dialog theDialogText buttons {"Ok"} default button "Ok"
return
end if

-- check if the image is offline
if not (exists file of (parent image of theSource)) then
set theDialogText to "Virtual Copy does not work with offline file."
display dialog theDialogText buttons {"Ok"} default button "Ok"
return
end if

set theFilePath to path of (parent image of theSource)
copy adjustments theSource


-- create the sym link
set theBashScript to "#!/bin/bash
fullfilename=" & quoted form of theFilePath & "
filename=$(basename \"$fullfilename\")
dirname=$(dirname \"$fullfilename\")
fname=\"${filename%.*}\"
ext=\"${filename##*.}\"
cd \"$dirname\"
i=1
while [[ -e \"$fname-$i.$ext\" || -L \"$fname-VC$i.$ext\" ]] ; do
let i++
done
ln \"$filename\" \"$fname-VC$i.$ext\"
ln -s \"$filename\" \"$fname-VC$i.$ext-s\"
echo \"$dirname/$fname-VC$i.$ext\""

set theNewImage to do shell script theBashScript

if not isSession then
-- import the file and select it
tell the (current document)
import source theNewImage
delay 2
set theDest to (item 1 of variants)
end tell
else
delay 2
repeat with theVariant in (every variant of current document)
set theVariantPath to path of ((parent image) of theVariant)
if theVariantPath is theNewImage then
set theDest to theVariant
exit repeat
end if
end repeat
end if

set theBashScript to "#!/bin/bash
fullfilename=" & quoted form of theNewImage & "
rm \"$fullfilename\"
mv \"$fullfilename-s\" \"$fullfilename\""

do shell script theBashScript

-- apply adjustments
select variant theDest
apply adjustments theDest

-- copy metadata
set (crop of theDest) to (crop of theSource)
set (color tag of theDest) to (color tag of theSource)
set (rating of theDest) to (rating of theSource)
set (contact address of theDest) to (contact address of theSource)
set (contact city of theDest) to (contact city of theSource)
set (contact country of theDest) to (contact country of theSource)
set (contact creator of theDest) to (contact creator of theSource)
set (contact creator job title of theDest) to (contact creator job title of theSource)
set (contact email of theDest) to (contact email of theSource)
set (contact phone of theDest) to (contact phone of theSource)
set (contact postal code of theDest) to (contact postal code of theSource)
set (contact state of theDest) to (contact state of theSource)
set (contact website of theDest) to (contact website of theSource)
set (content category of theDest) to (content category of theSource)
set (content description of theDest) to (content description of theSource)
set (content description writer of theDest) to (content description writer of theSource)
set (content headline of theDest) to (content headline of theSource)
set (content subject codes of theDest) to (content subject codes of theSource)
set (content supplemental categories of theDest) to (content supplemental categories of theSource)
set (Getty original filename of theDest) to (Getty original filename of theSource)
set (Getty parent MEID of theDest) to (Getty parent MEID of theSource)
set (Getty personalities of theDest) to (Getty personalities of theSource)
set (image city of theDest) to (image city of theSource)
set (image country of theDest) to (image country of theSource)
set (image country code of theDest) to (image country code of theSource)
set (image intellectual genre of theDest) to (image intellectual genre of theSource)
set (image location of theDest) to (image location of theSource)
set (image scenes of theDest) to (image scenes of theSource)
set (image state of theDest) to (image state of theSource)
set (status copyright notice of theDest) to (status copyright notice of theSource)
set (status instructions of theDest) to (status instructions of theSource)
set (status job identifier of theDest) to (status job identifier of theSource)
set (status provider of theDest) to (status provider of theSource)
set (status rights usage terms of theDest) to (status rights usage terms of theSource)
set (status source of theDest) to (status source of theSource)
set (status title of theDest) to (status title of theSource)

-- copy LCC and Lens Correction
set (lens correction of theDest) to (lens correction of theSource)
set (LCC color cast of theDest) to (LCC color cast of theSource)
set (LCC dust removal of theDest) to (LCC dust removal of theSource)
set (LCC uniform light of theDest) to (LCC uniform light of theSource)
set (LCC uniform light amount of theDest) to (LCC uniform light amount of theSource)

-- copy keywords
repeat with theKeyword in (keywords of theSource)
theKeyword apply keyword to variants
end repeat
end tell
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ Are supported both catalog and session.

# Installation

## Capture One 21

- Open Capture One
- Select the menu "Scripts > Open script folder", a finder folder will be open
- Open the folder "CaptureOne 21"
- Copy the file Virtual Copy.applescript in scripts folder
- Select the menu "Scripts > Update Menu Scripts"

If you want the shortcut (⇧f2), open the terminal and paste this line:
```
defaults write com.captureone.captureone14 NSUserKeyEquivalents -dict-add "Virtual Copy" "$\\Uf705"
```

## Capture One 20

- Open Capture One
Expand Down

0 comments on commit 64e4c41

Please sign in to comment.