Applescript:"将用户交互级别设置为永不交互"不在插画家工作

时间:2014-05-14 12:42:36

标签: plugins applescript adobe-illustrator

我试图设置它,以便在我使用applescript打开我的插图文件时没有用户交互,但是标准:

tell application id "com.adobe.Illustrator"
activate
set user interaction level to never interact
open theFile without dialogs

对于我安装的此插件不起作用,检查白色叠印。 如果由我决定我只是卸载插件,但它适用于工作电脑。

我还尝试使用以下方法自动点击按钮(在Tim Joe的帮助下):

try
    tell application "System Events"
        tell process "Finder"
            click button "OK" of window "Adobe Illustrator"
        end tell
    end tell
end try

我已经尝试了

tell application "System Events"
  tell process "Adobe Illustrator"
    keystroke return 
  end tell
end tell

有谁知道解决这个问题的方法?

下面是目前的完整代码:

set saveLocation to ((path to desktop) as string) --place to save the files
set theFile to choose file with prompt "Choose the Illustrator file to get outlines on"
set outputFolder to choose folder with prompt "Select the output folder"
tell application "Finder" to set fileName to name of theFile
set fullPath to (saveLocation & fileName) --file path of new .ai
set fileName to (text 1 thru ((length of fileName) - 3) of fileName) --remove .ai from fileName
set olPath to text 1 thru ((length of fullPath) - 3) of fullPath & "_OL.ai" --path of outlined file


 tell application id "com.adobe.Illustrator"
activate
ignoring application responses
    open theFile without dialogs
end ignoring
tell application "System Events"
    tell process "Adobe Illustrator"
        repeat 60 times -- wait up to 60 seconds for WOPD window to appear
            try
                tell window "White Overprint Detector"
                    keystroke return
                    exit repeat
                end tell
            on error
                delay 1
            end try
        end repeat
    end tell
end tell
save current document in file fullPath 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 file to desktop
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 another copy to desktop with name + _OL.ai 

 end tell
 tell application "Finder"
set newFolder to make new folder at saveLocation with properties {name:fileName}
move fullPath to newFolder --create new folder and move both new files into it
move olPath to newFolder
set newFolderPath to (newFolder) as string
set newFolderPath to text 1 thru -2 of newFolderPath --remove the trailing ":" 

tell current application --zip up the new folder
    set qpp to quoted form of POSIX path of newFolderPath
    do shell script "cd $(dirname " & qpp & ")
zip -r  \"$(basename " & qpp & ").zip\" \"$(basename " & qpp & ")\""
end tell
set zipFile to newFolderPath & ".zip"
move zipFile to outputFolder --move .zip to output
delete newFolder --delete folder on desktop left from zipping
 end tell


 --prepare a notification email 
 set presetText to "Hello,    


 Files Uploaded: 


  " & fileName & ".zip


 To access our FTP Server: 
 http://217.207.130.162:8080/WebInterface/login.html   

 To access our FTP server, log onto our website below: 

 Username: 
 Password: 

 Thanks, 
  Joe"
tell application "Mail" --open up prepared email
activate
set theMEssage to make new outgoing message with properties {visible:true,       subject:fileName, content:presetText}
  end tell
  --open file containing usernames and passwords for the FTP
  do shell script "open /Users/produser/Desktop/FTP_Users"

2 个答案:

答案 0 :(得分:2)

我追踪并安装了White Overprint Detector我可以看到你的意思。我不得不使用旧版本,因为我只有CS3,我看到它打开文档时产生的对话框。以下是让我解雇的问题:

tell application "Adobe Illustrator" to activate
tell application "System Events"
    tell process "Adobe Illustrator"
        repeat 60 times -- wait up to 60 seconds for WOPD window to appear
            try
                tell window "White Overprint Detector"
                    keystroke return
                    exit repeat
                end tell
            on error
                delay 1
            end try
        end repeat
    end tell
end tell

答案 1 :(得分:1)

由于我原来的帖子似乎过于客观,无法理解我会修改。

在Illustrator的tell块中查找打开文件的行。某些命令允许使用和不使用属性。尝试应用"不使用对话框"财产看起来像这样。

    tell application id "com.adobe.Illustrator"
        open file (VariableOfFilePath) without dialogs
    end tell

更新

我能想到的两种解决方法。 1)尝试告诉系统事件告诉AI在没有对话框的情况下打开

tell application "system events"
    tell application id "com.adobe.Illustrator"
        open file (VariableOfFilePath) without dialogs
    end tell
end tell

其他只是添加一点就可以提示。

     try
        tell application "System Events"
           tell process "Finder"
              click button "Continue" of window "Adobe Illustrator"
           end tell
        end tell
     end try

可以尝试让它接受默认按钮。

tell application "System Events"
   tell process "Finder"
      keystroke return
   end tell
end tell