Adding Folder

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

Adding Folder

Postby FL_ » Mon Dec 30, 2019 10:49 am

Hi,

capture One can only add one folder (in finder) at a time. Is it possible to use scripting for adding all subfolders of a particular folder on my mac to Capture One?

Best
Frank
FL_
 
Posts: 133
Joined: Mon May 18, 2015 10:11 pm

Re: Adding Folder

Postby Eric Nepean » Mon Jan 06, 2020 5:53 pm

Its unclear if you are using a Session or a Catalog, and how you normally go about adding a folder. If you clarify this, you may get better answers.
Eric Nepean
 
Posts: 677
Joined: Sat Oct 25, 2014 8:02 am
Location: Ottawa

Re: Adding Folder

Postby FL_ » Tue Jan 07, 2020 2:35 pm

I am using catalogs and store my photos outside the catalog in directories named with dates. From within Capture One I often need to add additional subfolders (on the hard disk). I do this using "add folder" and then "new folder" and "add". So I generate the subfolders from within Capture One but this can only be done one at a time whereas I need sometimes 10 or more.

Best
Frank
FL_
 
Posts: 133
Joined: Mon May 18, 2015 10:11 pm

Re: Adding Folder

Postby Eric Nepean » Tue Jan 07, 2020 6:33 pm

Empty sub folders generated by Capture One - should be no issue- with an xxx01, xxx02, xxx03 pattern?
Eric Nepean
 
Posts: 677
Joined: Sat Oct 25, 2014 8:02 am
Location: Ottawa

Re: Adding Folder

Postby FL_ » Tue Jan 07, 2020 8:07 pm

Indeed, i.e. for focus stacks which are stored in individual folders on the memory card I use something like fs_1..fs_x, same for panos (pano_1...pano_n).
FL_
 
Posts: 133
Joined: Mon May 18, 2015 10:11 pm

Re: Adding Folder

Postby Eric Nepean » Wed Jan 08, 2020 1:48 pm

Generating empty folders is something best done without using Capture One.

I made a slight modification to my handler findTargetFolder() to make a starting point for your script.

Once you put image files in the folders, if you import the image files into Capture One then Capture One will automatically show the folders.

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

set debug to true -- or false, once verified
set alias2TopParent_a to alias (((get path to desktop) as text) & "DPR:") -- alias of the top parent folder
set alias2Parent_a to choose folder with prompt "Select Parent Folder" default location alias2TopParent_a
## Use display dialog to enter the number of subfolders and what they are called
set alias2CoScriptPrefs_a to findTargetFolder(alias2Parent_a, "Prefs1", debug)

on findTargetFolder(targetFolderParent_a, targetFolderName, debug)
   ## Return a reference to a folder. If the folder doesn't exist, create it.
   ## modify this handler to include the root name of the folder, the number of folders and the starting number
   local targetFolderParent_p, targetFolder_p, targetFolder_a, newFolderRef
   set targetFolderParent_p to get POSIX path of targetFolderParent_a
   
   ## Put a repeat loop here  to g1) generate the alias for the subfolder, 2) create it if it doesn't exist
   set targetFolder_p to (targetFolderParent_p & targetFolderName)
   if debug then log " Initializing Folder \"" & targetFolder_p & "\""
   
   try
      set targetFolder_a to (get alias POSIX file targetFolder_p)
      if debug then log "Folder " & targetFolder_p & "  Exists"
   on error
      tell application "Finder" to set newFolderRef to make new folder at targetFolderParent_a with properties {name:targetFolderName}
      set targetFolder_a to newFolderRef as alias
      if debug then log targetFolder_p & "  Created"
   end try
   return targetFolder_a
end findTargetFolder


--choose folder
--choose folder (verb)Choose a folder on a disk or server (from the User Interaction suite, defined in StandardAdditions.osax)
--FUNCTION SYNTAX
--set theResult to choose folder with prompt text ¬
--      default location alias ¬
--      invisibles boolean ¬
--      multiple selections allowed boolean ¬
--      showing package contents boolean
--RESULT
--alias the chosen folder
--PARAMETERS
--Parameter                        Required      Type      Description
--default location                  optional      alias      the default folder location
--invisibles                        optional      boolean   Show invisible files and folders? (default is false)
--multiple selections allowed         optional      boolean   Allow multiple items to be selected? (default is false)
--showing package contents         optional      boolean   Show the contents of packages? (Packages will be treated as folders. Default is false.)
--with prompt                     optional      text      the prompt to be displayed in the dialog box
Eric Nepean
 
Posts: 677
Joined: Sat Oct 25, 2014 8:02 am
Location: Ottawa


Return to Scripting



Who is online

Users browsing this forum: No registered users and 2 guests