Script for folder names of session

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

Script for folder names of session

Postby SvenK » Mon Feb 04, 2019 2:42 pm

Hi,

i am trying to script a new session. Not really into applescript, just did some small ones like creating some kind of folders and subfolders.
Works fine, but i cannot get it to change the names of the subfolders capture or output.
Part of looks like this:

Code: Select all
tell application "Capture One 10"
         set newSession to make new document with properties {name:dasDatum & "_" & text returned of dialogInfo1 & "_P0" & dialogInfo2, path:sessionPath}


Tried with some phrases found, but nothing worked so far. Searched the whole forum without success. Perhaps someone can help me out?

Sven
SvenK
 
Posts: 2
Joined: Tue Feb 07, 2012 11:34 am
Location: Germany

Re: Script for folder names of session

Postby SvenK » Tue Feb 05, 2019 8:36 am

Rest of the code - perhaps helpful for someone:

Code: Select all
set d to current date
set derTag to text -2 thru -1 of ("0" & d's day)
set Monat to word 3 of ((current date) as text)
set MonatsListe to {January, February, March, April, May, June, July, August, September, October, November, December}

repeat with i from 1 to 12
   
   if d's month = item i of MonatsListe then
      set MM to text -2 thru -1 of ("0" & i)
      exit repeat
   end if
end repeat
set Jahr to ((year of d) as text)
set dasDatum to Jahr & "" & MM & "" & derTag


display dialog "Welcher Fotograf bist Du?" default answer "Dein Nachname"
copy the result to text_returned
set dialogInfo1 to result

set correctEntry to false
repeat while correctEntry is false
   
   set textToDisplay to "In welchem Studio (1-11) arbeitest Du jetzt?"
   display dialog textToDisplay default answer "1-11 / 7WW / 0 für Location"
   set dialogInfo2 to text returned of the result
      
   if dialogInfo2 = 0 then
      set dilogInfo2 to "Location"
      set correctEntry to true
   end if
   
   if dialogInfo2 = "7WW" then
      set correctEntry to true
      set dialogInfo2 to "7WW"
   end if
   
   if dialogInfo2 is not "7WW" then
      
      try
         set dialogInfo2 to dialogInfo2 as integer
         
         set correctEntry to true
         
      on error
         
         try
            set dialogInfo2 to dialogInfo2 as number
            display dialog "Du hast keine ganze Zahl eingegeben."
            
         on error
            display dialog "Statt einer ganzen Zahl hast Du Text eingegeben."
         end try
         
      end try
      
      if dialogInfo2 > 11 then
         set correctEntry to false
      end if
      
      if dialogInfo2 > 11 then
         display dialog "Bitte eine Zahl zwischen 1-11 eingeben."
      end if
      
      
      if dialogInfo2 < 0 then
         set correctEntry to false
      end if
      if dialogInfo2 < 0 then
         display dialog "Bitte eine Zahl zwischen 1-11 eingeben."
      end if
      
   end if
   
end repeat

tell application "Capture One 10" to run
activate
tell application "Capture One 10"
   set defaultLocation to path to desktop
   set sessionName to dasDatum
      
   if dialogInfo2 = 0 then
      tell application "Capture One 10"
         set newSession to make new document with properties {name:dasDatum & "_" & text returned of dialogInfo1 & "_A", path:sessionPath}
         
      end tell
      
   end if
   
   if dialogInfo2 is not 0 then
      tell application "Capture One 10"
         set newSession to make new document with properties {name:dasDatum & "_" & text returned of dialogInfo1 & "_P0" & dialogInfo2, path:sessionPath}
      end tell
   end if
      
   tell application "Capture One 10" to run
   activate
   display dialog "Dein heutiger Produktionsordner wurde auf dem Schreibtisch angelegt." buttons {"OK"} default button "OK"
   
end tell

end
SvenK
 
Posts: 2
Joined: Tue Feb 07, 2012 11:34 am
Location: Germany

Re: Script for folder names of session

Postby Eric Nepean » Fri Feb 08, 2019 2:45 pm

The Capture One Document has the setable properties captures and output, which are the names (type text or file) used for Capture and Output.

I would start with a test script to show these proprerties:

Code: Select all
tell application "Capture One 12" to tell current document to set Var1 to {captures, output} of it
log Var1


The command "Choose folder" gives the folder name in to correct format.

so:
Code: Select all
set theOutput to choose folder "select the Output Folder"
tell application "Capture One 12" to tell current document to set its captures to theOutput
Cheers, Eric
[late 2015 iMac, 4GHz i7, 24GB RAM, external SSDs. GX8, E-M1, GX7, GM5, GM1 ....]
Eric Nepean
 
Posts: 398
Joined: Sat Oct 25, 2014 8:02 am

Re: Script for folder names of session

Postby Eric Nepean » Fri Feb 08, 2019 2:54 pm

Eric Nepean wrote:The Capture One Document has the setable properties captures and output, which are the names (type text or file) used for Capture and Output.

I would start with a test script to show these proprerties:

Code: Select all
tell application "Capture One 12" to tell current document to set Var1 to {captures, output} of it
log Var1


The command "Choose folder" gives the folder name in the correct format.

so:
Code: Select all
set theOutput to choose folder "select the Output Folder"
tell application "Capture One 12" to tell current document to set its captures to theOutput


It is a little confusing that the Applescript says that the properties are of type file or text.

When you do get the output property, it is of type file

But if you do convert the new folder reference to type file, as in
Code: Select all
set theOutput to (choose folder "select the Output Folder") as text
,

then Capture One has an error if you try to set its output property to this.
Cheers, Eric
[late 2015 iMac, 4GHz i7, 24GB RAM, external SSDs. GX8, E-M1, GX7, GM5, GM1 ....]
Eric Nepean
 
Posts: 398
Joined: Sat Oct 25, 2014 8:02 am


Return to Scripting



Who is online

Users browsing this forum: No registered users and 2 guests