Help! Won't create new document because folder already exists.
Hello! I'm not sure if this is possible due to the existing directory?
Normally, (without scripting), I import photo using Photo Mechanic which creates the directory, let's call it "sessionName". Then, in Capture One, I create a new document (Session) with the same name "sessionName" that adds the additional folders and the cosession.db database file, no big deal if some of the folders already exist.
Now when I script the same thing, it freaks out because a folder already exists when it goes to create "sessionName". Anyway to overcome this?
set sessionFolderPath to alias "Macintosh HD:Users:macuser:Desktop:Photo Work:"
tell application "Finder"
set latestCreatedFolderName to name of item -1 of (sort every folder of sessionFolderPath by creation date)
set sessionName to latestCreatedFolderName
end tell
tell application "Capture One 20"
activate
close every document without saving
set newDoc to make new document with properties {name:sessionName, path:sessionFolderPath}
end tell
Error is:
--> error "A file already exists at the path at which this document was to be created." number -1421
Result:
error "Capture One 20 got an error: A file already exists at the path at which this document was to be created." number -1421
-
A simple work around would be to make a folder "Macintosh HD:Users:macuser:Desktop:Photo Work:Sessions" and put all your sessions in that folder.
0 -
I've now worked it out, I'll post it here for anyone else that might ever want to try the same thing.
set thisFolderPath to alias "Macintosh HD:Users:mattloxton:Desktop:Photo Work:"
tell application "Finder"
set latestModifiedFolderName to name of item -1 of (sort every folder of thisFolderPath by modification date)
set the clipboard to latestModifiedFolderName
end tell
tell application "Capture One 20"
activate
close every document without saving
end tell
delay 1
tell application "System Events"
key code 45 using command down
key code 9 using command down
keystroke return
end tell
tell application "Photo Mechanic 6"
activate
end tell0
投稿コメントは受け付けていません。
コメント
2件のコメント