Import image into a catalog via AppleScript

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

Import image into a catalog via AppleScript

Postby mkphotomedia » Wed Feb 01, 2017 12:46 am

Is there a way (other than using UI Scripting) to import single images into a catalog via AppleScript?

(and before you say 'open a support case', apparently Phase One Support is no longer able to support the AppleScript API and sent me back over here, despite being useful in this regard in the past...)
mkphotomedia
Certified Professional
Certified Professional
 
Posts: 64
Joined: Thu Nov 17, 2011 9:54 pm
Location: Vancouver, Canada

Re: Import image into a catalog via AppleScript

Postby Eric Nepean » Wed Feb 01, 2017 7:31 am

mkphotomedia wrote:Is there a way (other than using UI Scripting) to import single images into a catalog via AppleScript?

(and before you say 'open a support case', apparently Phase One Support is no longer able to support the AppleScript API and sent me back over here, despite being useful in this regard in the past...)

I've been doing a bit of Applescript with Capture One lately. What you are asking for isn't easily done, since CaptureOne, the application, has no import command in it's Applescript Dictionary.

Complicating things a bit further, CaptureOne, the application has no way to tell an Applescript what the current collection is. So even if you could execute an import command, there's no direct way of telling Capture One which folder to import the images too.

I wonder if the Open command might trigger Capture One to import an image.

On can however acccess the the Capture One Process through System Events. Here I see that you can access the menus and you could execute button clicks (and so start an import), and I can also see which row in the library tab is selected and what collection that refers too. But doing this is quite complicated.

I see that there is a suite of Applescripts that transfer images between Aperture and other editors including Capture One. They must be using some method to trigger Capture One to open the image, perhps in a a Session.
see https://photoapps.expert/tips/2015/7/28/aphub-aperture-hub#.WJF-uxDDHXQ and http://www.aphub.de/
Cheers
Eric
(OSX 10.12, iMac and MacBook Air, Panasonic GX7,GM5,G5, Olympus E-M1)
Eric Nepean
 
Posts: 385
Joined: Sat Jun 28, 2014 8:54 pm
Location: Ontario, Canada

Re: Import image into a catalog via AppleScript

Postby mkphotomedia » Thu Feb 02, 2017 5:50 pm

What that example is showing is a session workflow, where you don't need to actually import. That's an easy solution, because in a session workflow, all you need to do is drop things into the filesystem and they magically appear.

What I'm trying to do is script the addition of specific files across a set of folders (by criteria) without having to add everything to the session and filter it.
mkphotomedia
Certified Professional
Certified Professional
 
Posts: 64
Joined: Thu Nov 17, 2011 9:54 pm
Location: Vancouver, Canada

Re: Import image into a catalog via AppleScript

Postby Eric Nepean » Thu Feb 02, 2017 8:04 pm

mkphotomedia wrote:What that example is showing is a session workflow, where you don't need to actually import. That's an easy solution, because in a session workflow, all you need to do is drop things into the filesystem and they magically appear.

What I'm trying to do is script the addition of specific files across a set of folders (by criteria) without having to add everything to the session and filter it.

I see 3 steps:
  1. Import the image into All Images
  2. Identify the destination collections
  3. Add Variants to the destination collections
Level of difficulty IMO
  • Importing is hard
  • Identifying/selecting collections by criteria is easily done by a search, if the criteria belong to the set: {part of name, part of name of parent, collection type, number of images, contains_image}.
  • Adding variants to a collection - diffculty unknown.
Cheers
Eric
(OSX 10.12, iMac and MacBook Air, Panasonic GX7,GM5,G5, Olympus E-M1)
Eric Nepean
 
Posts: 385
Joined: Sat Jun 28, 2014 8:54 pm
Location: Ontario, Canada

Re: Import image into a catalog via AppleScript

Postby mkphotomedia » Thu Feb 02, 2017 9:22 pm

Agreed. Steps 2 and 3 are the easy (or, easier) parts. I've supplemented my support case with a request for an 'import' verb, which would make this whole routine next to dead trivial, (largely) without having to resort to UI scripting.
mkphotomedia
Certified Professional
Certified Professional
 
Posts: 64
Joined: Thu Nov 17, 2011 9:54 pm
Location: Vancouver, Canada

Re: Import image into a catalog via AppleScript

Postby Jim_DK » Thu Feb 02, 2017 10:20 pm

Just out of interest... Are you guys signed up for beta?
James
Phase One DK
Jim_DK
Crew
Crew
 
Posts: 607
Joined: Thu Dec 03, 2009 10:00 pm

Re: Import image into a catalog via AppleScript

Postby mkphotomedia » Fri Feb 03, 2017 8:55 am

Yep, I'm on beta. (and given the number of bugs I submitted particularly during the CO9.x betas, I'm surprised the dev team hasn't burned a full-scale replica of me in effigy in a square somewhere in Copenhagen before release. Or maybe they did! ;-)
mkphotomedia
Certified Professional
Certified Professional
 
Posts: 64
Joined: Thu Nov 17, 2011 9:54 pm
Location: Vancouver, Canada

Re: Import image into a catalog via AppleScript

Postby mkphotomedia » Fri Feb 03, 2017 9:20 am

Here's my use case (well, one of several): I shoot architecture on a tech cam (and sometimes on a Canon FF) tethered, and run with a session workflow. But, I spend enough time on the road that it's really useful to be able to keep past years' photos accessible in a catalog so I can find and preview things if a client asks for them and I'm not at my desk. Right now, I get to Remote Desktop onto my editing machine and run things remotely.

The Right Way To Do This at the moment is to either bulk-import your sessions into a master catalog--or, the lazy-ass way to do it, bulk-import the images into a master catalog, leaving them in place (which of course won't pick up your albums and other session-specific stuff; this I can basically live with though).

What would be really excellent and efficient is to be able to do this process based on a search criteria on the files--so I could say something like "pull any images rated >2*, LCCs, and any colour-tagged image that's in a Capture folder or subfolder" over a folder tree. This would turn what would be a 10,000-image import into, in my case, a 1,500 image import, and give me a much more manageable and portable catalog out of the deal--particularly when all that gets bulk-stored on a somewhat slow NAS.

Doing that criteria-based selection is very easy to do programmatically outside Capture One via a chunk of AS/JS that walks the folder tree and parses the XML in the Settings??/*.cos files. So what you get is a big fat file list, which needs to be thrown at C1 in order to build (or update) the catalog.
mkphotomedia
Certified Professional
Certified Professional
 
Posts: 64
Joined: Thu Nov 17, 2011 9:54 pm
Location: Vancouver, Canada

Re: Import image into a catalog via AppleScript

Postby Eric Nepean » Sat Feb 04, 2017 5:24 am

Jim_DK wrote:Just out of interest... Are you guys signed up for beta?

Yes, I'm signed up. I can't always participate if its busy at work.
Cheers
Eric
(OSX 10.12, iMac and MacBook Air, Panasonic GX7,GM5,G5, Olympus E-M1)
Eric Nepean
 
Posts: 385
Joined: Sat Jun 28, 2014 8:54 pm
Location: Ontario, Canada


Return to Scripting



Who is online

Users browsing this forum: No registered users and 1 guest