Applescript to open folder name copied to clipboard in C1

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 to open folder name copied to clipboard in C1

Postby NNN636450670260133742 » Fri Nov 24, 2017 10:03 pm

Hi,

I have had this script that does the following:

1. Finds the folder name copied to the clipboard, opens C1, and highlights/opens the folder (as if I clicked on it).

But it doesn't seem to be working. It only opens capture one; doesn't open the folder. Any suggestions.

set t to (the clipboard) as text
if the length of t is 0 then
display alert "Folder clipboard item is blank" giving up after 10
return
end if

set t to t's quoted form
try
set f to (do shell script "mdfind -onlyin ~ kMDItemDisplayName == \"" & t & "\"") as POSIX file as alias as list
on error errmsg number errnbr

my error_handler(errnbr, errmsg)
return
end try

tell application "Capture One 10"
activate
open f
end tell
return


on error_handler(handler_name, nbr, msg)
return display alert "[ " & nbr & " ] " & msg as critical giving up after 10
end error_handler
NNN636450670260133742
 
Posts: 6
Joined: Tue Oct 31, 2017 6:17 pm

Re: Applescript to open folder name copied to clipboard in C

Postby ben_US » Mon Nov 27, 2017 4:59 pm

tell application "Capture One 10"
activate
open f
end tell
return


Try telling the current document to browse to f rather than Capture One to Open it. Capture One doesn't Open directories, it opens documents (session or catalog).
Please make a support case for Technical Support with Capture One software:
http://support.phaseone.com and click on Contact Support, then select Technical Support.
ben_US
Crew
Crew
 
Posts: 557
Joined: Mon Feb 01, 2016 9:51 pm
Location: New York, USA

Re: Applescript to open folder name copied to clipboard in C

Postby NNN636450670260133742 » Wed Nov 29, 2017 1:31 am

I changed open to browse and it does not work. It still just open capture one; does not highlight the folder. Any more help?
NNN636450670260133742
 
Posts: 6
Joined: Tue Oct 31, 2017 6:17 pm

Re: Applescript to open folder name copied to clipboard in C

Postby Jim_DK » Wed Nov 29, 2017 4:29 pm

Code: Select all
tell application "Capture One 10"
   set theDoc to current document
   theDoc browse to path "/Library/Desktop Pictures"
end tell


You need to tell Capture One which document to browse, and browse needs a path - not just a name.
James
Phase One DK
Jim_DK
Crew
Crew
 
Posts: 636
Joined: Thu Dec 03, 2009 10:00 pm

Re: Applescript to open folder name copied to clipboard in C

Postby HansB » Thu Nov 30, 2017 10:17 pm

Hi Jim_DK,


Thanks for that code snippet. I tried it, just out of curiosity, and it works nicely when used in an Automator service for a folder in Finder.


Regards,
Hans
HansB
 
Posts: 875
Joined: Fri Sep 25, 2009 2:59 pm

Re: Applescript to open folder name copied to clipboard in C

Postby NNN636450670260133742 » Sun Dec 03, 2017 7:55 am

Thanks again, but It doesn't work. The script used to work a few years ago.

You have a shot list of dozens of names.
You create a C1 session and save it to Pictures.
You create shot folders inside of the Capture folder of the C1 session, from the shot list.
You copy a shot name from the shot list.
With the shot name on the clipboard you initiate the script with a key stroke (you have to put the script into automator, etc.)
The script searches and finds the shot folder, in the C1 session (mentioned above), highlights it (as though you clicked on it).
You set the folder as Capture Folder and shoot.
NNN636450670260133742
 
Posts: 6
Joined: Tue Oct 31, 2017 6:17 pm

Re: Applescript to open folder name copied to clipboard in C

Postby Jim_DK » Thu Dec 07, 2017 10:42 pm

NNN636450670260133742 wrote:Thanks again, but It doesn't work. The script used to work a few years ago.

You have a shot list of dozens of names.
You create a C1 session and save it to Pictures.
You create shot folders inside of the Capture folder of the C1 session, from the shot list.
You copy a shot name from the shot list.
With the shot name on the clipboard you initiate the script with a key stroke (you have to put the script into automator, etc.)
The script searches and finds the shot folder, in the C1 session (mentioned above), highlights it (as though you clicked on it).
You set the folder as Capture Folder and shoot.


Can't really try and help you from this. Can you post the script?
James
Phase One DK
Jim_DK
Crew
Crew
 
Posts: 636
Joined: Thu Dec 03, 2009 10:00 pm

Re: Applescript to open folder name copied to clipboard in C

Postby Digital Transitions, Doug » Fri Dec 22, 2017 8:13 pm

Sounds a lot like "Create Capture Folders from Clipboard.scpt" from https://digitaltransitions.com/building-blocks/
Digital Transitions, Doug
Certified Professional
Certified Professional
 
Posts: 154
Joined: Wed Mar 21, 2012 3:34 pm

Re: Applescript to open folder name copied to clipboard in C

Postby SeanMurp » Thu Jan 25, 2018 10:36 pm

Just a few small modifications required for your script:
    - remove the "as list" from the mdfind line
    - You need to "tell current document" to browse to that path

Code: Select all
   set t to (the clipboard) as text
   if the length of t is 0 then
      display alert "Folder clipboard item is blank" giving up after 10
      return
   end if
   
   set t to t's quoted form
   
   try
      set f to (do shell script "mdfind -onlyin ~ kMDItemDisplayName == \"" & t & "\"") as POSIX file as alias
   end try
   
   tell application "Capture One 10"
      activate
      tell current document
         try
            browse to path f
         end try
      end tell
   end tell
end run


There are also bits of code you could use for automating the creation of those Shot folders as well as telling Capture One to set the shot folder copied to your clipboard as the Capture folder (so all of your new shots go into the specified folder). Just saves a couple of mouse clicks each time you change shots.
SeanMurp
 
Posts: 71
Joined: Wed Nov 02, 2016 4:30 am


Return to Scripting



Who is online

Users browsing this forum: Eric Nepean and 1 guest