I’m stuck on this seemingly easy part of the code. I need to create a folder with the same filename than a file. The problem is I can’t make it work when the folder is not a specific location but a variable. The file is an Indesign file created from a template therefore it has never being saved before…
tell application "Finder"
set theFileName to "testText"
set loc to "MAC:Users:miguelarias:Desktop:Stationery:Pending:"
set newfo to make new folder at loc with properties {name:contents of theFileName}
end tell
tell application id "com.adobe.InDesign"
tell active document
save to "Users:miguelarias:Desktop:Stationery: Pending: newfo:" & theFileName
move theFileName to newfo -----<<<---Here's the problem!!
end tell
tell application id "com.adobe.InDesign"
close document 1
end tell
end tell
you cannot use Finder item specifiers in an Indesign environment. You have to use string (HFS) paths
set pendingFolder to (path to desktop as text) & "Stationery:Pending:" -- relative path, works on every computer
set theFileName to "testText"
tell application "Finder"
make new folder at folder pendingFolder with properties {name:theFileName}
end tell
tell application id "com.adobe.InDesign"
save active document to (pendingFolder & theFileName & ":" & theFileName & ".indd")
close document 1
end tell
set pendingFolder to (path to desktop as text) & "Stationery:Pending:" -- relative path, works on every computer
set theFileName to "testText"
tell application "Finder"
set newfo to (make new folder at folder pendingFolder with properties {name:theFileName}) as text
--> "MAC:Users:miguelarias:Desktop:Stationery:Pending:testText:"
end tell
tell application id "com.adobe.InDesign"
save active document to (newfo & theFileName & ".indd")
close document 1
end tell
Or, if inDesign accepts such syntax :
tell application id "com.adobe.InDesign"
tell active document
save it to (newfo & theFileName & ".indd")
close it
end tell
end tell
Yvan KOENIG running Sierra 10.12.2 in French (VALLAURIS, France) lundi 2 janvier 2017 14:51:00