AppleScript Exporting EmptyName.tif

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

AppleScript Exporting EmptyName.tif

Postby ChrisNorman » Tue Jul 30, 2019 8:22 pm

Hi all,
I am trying to write a script for someone who uses Capture One. It doesn't seem to matter what we do, the file that is exported as part of the script comes out with an "EmptyName.tif" name on the file. On my machine(using a Demo version of Capture One 12) the file that is exported has the same name as the file that was imported.

What am I doing wrong that is causing this on the other users machine?

Here is a sample script that has has demonstrated the issue on the other users machine.

---------
set theFiles to (choose file of type {"public.image"} with prompt "Choose Files to import" with multiple selections allowed)

repeat with i from 1 to (count of theFiles)
set theFile to (item i of theFiles)
tell application "Capture One 12"
set theDocument to (get current document)
import theDocument source theFile
delay 2
set theImage to last image of theDocument
set theVariant to first variant of theImage
process theVariant recipe "TIFF"
end tell
end repeat
---------
ChrisNorman
 
Posts: 2
Joined: Sat Jul 06, 2019 8:37 am

Re: AppleScript Exporting EmptyName.tif

Postby Eric Nepean » Wed Jul 31, 2019 3:54 am

Hi Chris

First, I separate your script into two parts, Import and Export, and verify each part separately.

Once you have images in the document, you can export the variants as many times as you like.

Second, the Document is a poor place to look for variants, you can only find the variants in the user albums and smart albums which are not in a project or group. (you may not have any such collections, and even if you do, they may not contain variants of interest).

I reccomend that you address the application's selected variants, like this example, at least for degugging purposes. Then the user or debugger may choose any collection, "All Images" or any other collection, select none orr one or some variants, and then run the script.
Code: Select all
tell application "Capture One 12"
   repeat with theVariant in (variants whose selected is true)
      ## do stuff to theVariant
   end repeat
end tell
or
Code: Select all
tell application "Capture One 12" to set theVariantList to (variants whose selected is true)
repeat with theVariant in theVariantList
   ## do stuff to the variant
end repeat

A further issue may be the process recipe itself. There is a recipe within theta recipe for creating the name of the exported file. It may be that that recipe is empty, resulting in your file naming problem.

I would first select on variant and export it manually, just the way, and with the exact process receipe, that you want Applescript to do. That may reveal a problem or two.

Once solved, then continue with the Applescript.
Last edited by Eric Nepean on Wed Jul 31, 2019 5:23 am, edited 3 times in total.
Eric Nepean
 
Posts: 614
Joined: Sat Oct 25, 2014 8:02 am
Location: Ottawa

Re: AppleScript Exporting EmptyName.tif

Postby Eric Nepean » Wed Jul 31, 2019 4:37 am

Hi Chris

Further to the above, I expect that your friend doesn't simply want to import and then export again, rather import, apply some processing, and then export the modified images.

Consequently you need to keep track of where your imports went.

My approach is typically like this:

tell the current doument to make a project (for this purpose), and inside that make a new album (for each batch perhaps). (this is the the destination album)

tell the current document to tell its import receipe to set its destination collection to the destination album.

Now all your imports will end up in a place where you can find them and process them. You can just process all the variants in this album, or the script or the user can add a subset of the variants to the selection., and the process the selected variants

You can also make a user defined style that holds all the image adjustments wanted. The style can applied on import, by identifying this in the import recipe.
Eric Nepean
 
Posts: 614
Joined: Sat Oct 25, 2014 8:02 am
Location: Ottawa

Re: AppleScript Exporting EmptyName.tif

Postby ChrisNorman » Wed Jul 31, 2019 6:17 pm

Eric Nepean wrote:Hi Chris

Further to the above, I expect that your friend doesn't simply want to import and then export again, rather import, apply some processing, and then export the modified images.


Thanks for the information Eric. While I also do photography, I am not at the level where I need C1, so this is my first experience with it. I really am more of an AppleScript guy in this instance, and C1 definitly has its own unique way of doing things! It has been a learning experience, more that I thought it might have been!
ChrisNorman
 
Posts: 2
Joined: Sat Jul 06, 2019 8:37 am


Return to Scripting



Who is online

Users browsing this forum: No registered users and 3 guests