Copy Filename to "Title" Metadata Field

Discussion regarding all scripting related questions
Please DO NOT post to this thread anything that is not directly related to scripting of Capture One.

Copy Filename to "Title" Metadata Field

Postby NN635261809663419495UL » Fri Mar 16, 2018 7:00 pm

I found this same question is the legacy discussion board for Capture One 8, but there was still no answer for this one so I thought I'd throw it over this way.

I'd like to find an automated way to copy the filename of each image into the title field without doing it manually for every image. Because of the way Squarespace functions, I need the filename to be in the title field so it will be displayed when clients are previewing images. I found a work around code for Squarespace that will allow the filename to be displayed below the thumbnail version, but I need the filename in the title field for it to appear when the image is opened up the larger lightbox. Any suggestions are greatly appreciated.

Thanks!
NN635261809663419495UL
 
Posts: 5
Joined: Fri Jan 24, 2014 6:22 pm

Re: Copy Filename to "Title" Metadata Field

Postby Eric Nepean » Sat Mar 17, 2018 2:17 am

A simple Applescript will do it. Are you comfortable running Applescript? If so, we should move this conversation to the Scripting forum.
Eric Nepean
 
Posts: 657
Joined: Sat Oct 25, 2014 8:02 am
Location: Ottawa

Re: Copy Filename to "Title" Metadata Field

Postby NN635261809663419495UL » Sat Mar 17, 2018 1:01 pm

I have never run AppleScript but am more than happy to learn if it will help. I’m sure with the proper guidance I can figure it out. Thanks!
NN635261809663419495UL
 
Posts: 5
Joined: Fri Jan 24, 2014 6:22 pm

Re: Copy Filename to "Title" Metadata Field

Postby Eric Nepean » Sat Mar 17, 2018 4:57 pm

@Jim_DK Can you move this thread to the scripting forum, please
Eric Nepean
 
Posts: 657
Joined: Sat Oct 25, 2014 8:02 am
Location: Ottawa

Re: Copy Filename to "Title" Metadata Field

Postby Eric Nepean » Sat Mar 17, 2018 5:39 pm

This Applescript below should do the job on every variant in the user collection you have selected (which is currently shown in the window). I've tested it and it works.

The posting at this link has an informal tutorial of how to get started and run an Applescript with Capture One:
https://forum.phaseone.com/En/viewtopic.php?f=70&t=25783&p=120960#p120864

Code: Select all
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

tell application "Capture One 11" to tell current document to tell current collection
   repeat with thisVariantIndex from 1 to count of every variant
      set imagePathName to path of parent image of variant thisVariantIndex
      if length of imagePathName = 0 then
         log ("could not get path of Image " & (get name of variant thisVariantIndex))
      else
         set ImageFileName to last item of my splitStringToList(imagePathName, "/")
         tell variant thisVariantIndex to set status title to ImageFileName
      end if
   end repeat
end tell

on splitStringToList(theString, theDelim)
   set astid to AppleScript's text item delimiters
   try
      set AppleScript's text item delimiters to theDelim
      set theList to text items of theString
   on error
      set AppleScript's text item delimiters to astid
   end try
   set AppleScript's text item delimiters to astid
   return theList
end splitStringToList
Eric Nepean
 
Posts: 657
Joined: Sat Oct 25, 2014 8:02 am
Location: Ottawa

Re: Copy Filename to "Title" Metadata Field

Postby NN635261809663419495UL » Mon Mar 19, 2018 2:22 pm

Thanks Eric! I'll give this a try and see if I can get it to work.
NN635261809663419495UL
 
Posts: 5
Joined: Fri Jan 24, 2014 6:22 pm

Re: Copy Filename to "Title" Metadata Field

Postby rapdigital » Sun Mar 25, 2018 10:30 am

Variant Class contains name property so there is no need to parse the parent image path you can just call the property directly. This works for both CO10 and 11

Code: Select all
tell application "Capture One 10" to tell current document to tell current collection
   repeat with thisVariantIndex from 1 to count of every variant
      set TheName to name of parent image of variant thisVariantIndex
      tell variant thisVariantIndex to set status title to TheName
      
   end repeat
end tell
rapdigital
Certified Professional
Certified Professional
 
Posts: 185
Joined: Mon Feb 02, 2009 1:52 pm

Re: Copy Filename to "Title" Metadata Field

Postby Eric Nepean » Mon Mar 26, 2018 2:41 am

Good point, thanks Rick.
Eric Nepean
 
Posts: 657
Joined: Sat Oct 25, 2014 8:02 am
Location: Ottawa

Re: Copy Filename to "Title" Metadata Field

Postby Matthew Jensen1 » Tue Jun 05, 2018 12:33 am

Hey Rick!

Nice one. Is there a way for me to incorporate removing the trailing number counter i.e. -003 within this script?

Cheers

Matt
Matthew Jensen1
 
Posts: 10
Joined: Sun Jul 05, 2009 1:32 pm

Re: Copy Filename to "Title" Metadata Field

Postby rapdigital » Tue Jun 05, 2018 1:46 am

Hey Jensen

If its always the last 4 characters then below should work. If you need to remove anything after the dash then thats going to cost a beer :lol:


Code: Select all
tell application "Capture One 10" to tell current document to tell current collection
   repeat with thisVariantIndex from 1 to count of every variant
      set TheName to name of parent image of variant thisVariantIndex
tell app "finder" to set theNameS to text 1 thru -4 of TheName
      tell variant thisVariantIndex to set status title to theNameS
     
   end repeat
end tell
rapdigital
Certified Professional
Certified Professional
 
Posts: 185
Joined: Mon Feb 02, 2009 1:52 pm

Re: Copy Filename to "Title" Metadata Field

Postby Matthew Jensen1 » Tue Jun 05, 2018 2:17 am

Haha! You know it!

6 Pack? I am doing everything I can to get this studio off LR. It is sucking my soul away.
Matthew Jensen1
 
Posts: 10
Joined: Sun Jul 05, 2009 1:32 pm

Re: Copy Filename to "Title" Metadata Field

Postby rapdigital » Tue Jun 05, 2018 11:11 am

I'm sure there is a more elegant way but its been a big day on set.
Beers in Bondi Matt next month...

Code: Select all
tell application "Capture One 10" to tell current document to tell current collection
   repeat with thisVariantIndex from 1 to count of every variant
      set TheName to name of parent image of variant thisVariantIndex
      set astid to AppleScript's text item delimiters
      set AppleScript's text item delimiters to "-"
      set theNameS to text 1 thru text item -2 of TheName
                set AppleScript's text item delimiters to astid
      tell variant thisVariantIndex to set status title to theNameS
      
   end repeat
end tell
rapdigital
Certified Professional
Certified Professional
 
Posts: 185
Joined: Mon Feb 02, 2009 1:52 pm


Return to Scripting



Who is online

Users browsing this forum: No registered users and 1 guest