我正在尝试根据其文件夹结构打开并保存插图文件,但出于某种原因我不断收到此错误:
error "Adobe Illustrator got an error: an Illustrator error occurred: -54 (' ˇˇˇ')" number 1200
连同消息:
Illustrator couldn't open this file as it may be locked or in use
好吧它没有锁定,因为我可以手动打开它,当时它肯定没有被使用。 以下是我的代码,如果可以,请提供帮助:)
set inputFolder to choose folder with prompt "Select the folder"
tell application "Finder" to set jobNumber to name of inputFolder
set aiPath to inputFolder & "Assembly:" & jobNumber & ".ai" --path of outlined file
set olPath to inputFolder & "Deliverables:" & jobNumber & "_OL.ai" --path of outlined file
tell application id "com.adobe.Illustrator"
activate
open aiPath without dialogs
convert to paths (every text frame of current document) --convert text to paths
save current document in file olPath as Illustrator with options {class:Illustrator save options, compatibility:Illustrator 15, font subset threshold:0.0, embed linked files:true, save multiple artboards:false} --save an outlined copy to Deliverables with name + _OL.ai
end tell
*****编辑******
我试图通过在别名中添加文本作为字符串来修复它,然后将其转换为别名。
出于某种原因,这适用于第一条路径,但是当它到达第二条路径时,它说"不能将别名变成类型别名" 我很困惑,请帮忙:/
set inputFolder to choose folder with prompt "Select the folder"
tell application "Finder" to set jobNumber to name of inputFolder
set temp to inputFolder & "Assembly:" & jobNumber & ".ai" as string --path of outlined file
set aiPath to temp as alias
set temp to inputFolder & "Deliverables:" & jobNumber & "_OL.ai" --path of outlined file
set olPath to temp as alias
tell application id "com.adobe.Illustrator"
activate
open file aiPath without dialogs
convert to paths (every text frame of current document) --convert text to paths
save current document in file olPath as Illustrator with options {class:Illustrator save options, compatibility:Illustrator 15, font subset threshold:0.0, embed linked files:true, save multiple artboards:false} --save an outlined copy to Deliverables with name + _OL.ai
end tell
答案 0 :(得分:1)
你的变量" inputFolder"是一个别名,他们通常不喜欢添加文字。试着把它变成一个字符串。试试这个:
set inputFolder to choose folder with prompt "Select the folder"
set inputFolder to inputFolder as string
tell application "Finder" to set jobNumber to name of folder inputFolder
set aiPath to inputFolder & "Assembly:" & jobNumber & ".ai" --path of outlined file
set olPath to inputFolder & "Deliverables:" & jobNumber & "_OL.ai" --path of outlined file
tell application id "com.adobe.Illustrator"
activate
open aiPath without dialogs
convert to paths (every text frame of current document) --convert text to paths
save current document in file olPath as Illustrator with options {class:Illustrator save options, compatibility:Illustrator 15, font subset threshold:0.0, embed linked files:true, save multiple artboards:false} --save an outlined copy to Deliverables with name + _OL.ai
end tell
<强>更新强>
检查&#34; olPath&#34;的文件路径存在。 AI不会从我记忆中创建新文件夹。如果我使用你的保存命令并将其更改为保存在我的桌面上,它可以正常工作。
set FilePath to ((path to desktop) as string) & "TestFile.ai"
tell application id "com.adobe.Illustrator"
activate
save current document in file FilePath as Illustrator with options {class:Illustrator save options, compatibility:Illustrator 15, font subset threshold:0.0, embed linked files:true, save multiple artboards:false} --save an outlined copy to Deliverables with name + _OL.ai
end tell
更新2
这适合我。
set inputFolder to choose folder with prompt "Select the folder"
set inputFolder to inputFolder as string
tell application "Finder" to set jobNumber to name of folder inputFolder
set aiPath to inputFolder & "Assembly:" & jobNumber & ".ai" --path of outlined file
set olPath to inputFolder & "Deliverables:" & jobNumber & "_OL.ai" --path of outlined file
tell application id "com.adobe.Illustrator"
activate
open file aiPath without dialogs
convert to paths (every text frame of current document) --convert text to paths
save current document in file olPath as Illustrator with options {class:Illustrator save options, compatibility:Illustrator 15, font subset threshold:0.0, embed linked files:true, save multiple artboards:false} --save an outlined copy to Deliverables with name + _OL.ai
end tell