Ok thanks I understand that work !
I have a very last question
how i can convert path to a valid path (convert “:” to “/”)
I found a way with POSIX but with it that dont write in my files again…
what’s wrong with my POSIX ?
thanks for your help
on createTextFile(fileName, myFormat, aFile, renderFolder)
try
set destinationFile to ((destinationFolder as text) & fileName & ":" & fileName & ".nk")
set renderFile to (renderFolder & fileName & ":" & fileName)
set dataStream to open for access file destinationFile with write permission
set CleanFile to aFile from user domain
set CleanRender to renderFile from user domain
set NukeRender to POSIX path of CleanRender
set NukeSource to POSIX path of CleanFile
set textToWrite to myText1 & myFormat & myText2 & NukeSource & myText3 & NukeRender & "_comp_%05d.tga" & myText4
write textToWrite to dataStream
tell application "Finder" to set file type of destinationFile to "Nuke Project"
--tell application "Finder" to set creator type of destinationFile to "Kaiz'r - menthor-skillz.com © 2010"
close access dataStream
on error
try
close access file destinationFile
end try
end try
end createTextFile
StefanK
December 18, 2010, 12:50pm
#22
user domain is used in the path to command and is wrong in the syntax.
I cleaned up your script a bit (for example to put the properties to the beginning of the script).
There were some other problems, but I hope it works now.
The file type and creator type must be of some of the 4-letter identifier (like AAPL)
A normal literal string causes an error
-- the AppleScript's name
property mytitle : "Nuke Them !"
property myText1 : "#! /Applications/Nuke6.0v7-32/Nuke6.0v7.app/Contents/MacOS/Nuke6.0v7 -nx
version 6.0 v7
Root {
format " as string
property myText2 : "
}
Viewer {
input_process false
name Viewer1
}
Read {
inputs 0
file " as string
property myText3 : "
name Read1
}
Write {
file " as string
property myText4 : "
name Write1
}" as string
property destinationFolder : missing value
property renderFolder : missing value
--Nuke files format setup
set Formatsetup to choose from list {"HD", "2K_Super_35", "4K_Super_35"} with prompt "Choose your full size format :" with title mytitle
if Formatsetup is false then return
set Formatsetup to item 1 of Formatsetup
if (Formatsetup = "HD") then
set myFormat to "1920 1080 0 0 1920 1080 1 HD"
else if (Formatsetup = "2K_Super_35") then
set myFormat to "2048 1556 0 0 2048 1556 1 2K_Super_35(full-ap)"
else if (Formatsetup = "4K_Super_35") then
set myFormat to "4096 3112 0 0 4096 3112 1 4K_Super_35(full-ap)"
end if
--double click operation
set sourceFolder to (choose folder with prompt "Source files Folder")
set destinationFolder to (choose folder with prompt "Nuke Project Destination Folder")
set renderFolder to (choose folder with prompt "Render Destination Folder")
--Folders creation
tell application "Finder"
set theFiles to files of sourceFolder
repeat with aFile in theFiles
set {name:Nm, name extension:Ex} to aFile
set Nom to text 1 thru ((get offset of "." & Ex in Nm) - 1) of Nm
make new folder at destinationFolder with properties {name:Nom}
make new folder at renderFolder with properties {name:Nom}
my createTextFile(Nom, myFormat, (aFile as text))
end repeat
end tell
--project files creation
on createTextFile(fileName, aFormat, filePath)
try
set destinationFile to (destinationFolder as text) & fileName & ":" & fileName & ".nk"
set renderFile to (POSIX path of renderFolder) & fileName & "/"
set dataStream to open for access file destinationFile with write permission
set textToWrite to myText1 & aFormat & myText2 & POSIX path of filePath & myText3 & renderFile & fileName & "_comp_%05d.tga" & myText4
write textToWrite to dataStream
close access dataStream
-- tell application "Finder" to set file type of file destinationFile to "Nuke Project"
-- tell application "Finder" to set creator type of file destinationFile to "Kaiz'r - menthor-skillz.com © 2010"
on error
try
close access file destinationFile
end try
end try
end createTextFile
thanks for your help
a last detail, how is possible to keep the " " in a variable
set myFormat to "1920 1080 0 0 1920 1080 1 HD"
result 1920 1080 0 0 1920 1080 1 HD and I need “1920 1080 0 0 1920 1080 1 HD” exactly to have a valid code
StefanK
December 18, 2010, 2:53pm
#24
.
set textToWrite to myText1 & quote & aFormat & quote & myText2 & POSIX path of filePath & myText3 & renderFile & fileName & "_comp_%05d.tga" & myText4
.
perfect !
thanks again for your massive help
you’re the man