Automation Applescript旁路提示

Automation Applescript旁路提示,automation,applescript,prompt,repeat,adobe-indesign,Automation,Applescript,Prompt,Repeat,Adobe Indesign,我正试图绕过提示。这是一段“我的”代码: 稍后,我需要将此文件置于InDesign中: tell myPage set myPDFPage to place myPDF set myPDFPage to item 1 of myPDFPag end tell 但我不想手动选择文件,而是以这种方式自动选择: tell application "Adobe InDesign CS6" repeat with i from 1 to listCount

我正试图绕过提示。这是一段“我的”代码:

稍后,我需要将此文件置于InDesign中:

tell myPage
    set myPDFPage to place myPDF    
    set myPDFPage to item 1 of myPDFPag
end tell
但我不想手动选择文件,而是以这种方式自动选择:

tell application "Adobe InDesign CS6"
    repeat with i from 1 to listCount
        set myDocument to make document
        set myPDF to item i of folderA4
这样folderA4的所有pdf文件都会被自动选择

但是,这会导致一个错误,即无法请求项目1的别名。 (电话号码:1728)

我做错了什么


提前谢谢

试试这个,它会给你一个文件夹中的pdf文件列表:

tell application "Finder"
    set folderA4 to choose folder with prompt "Please select the Folder with A4-booklets"
    set allFiles to every file of folderA4
    set listCount to count every item of allFiles
    set pdfFiles to {}
    repeat with i from 1 to listCount
        tell application "Finder" to set {fType, nExt} to ({file type, name extension} of item i of allFiles)
        if (fType is "PDF ") or (nExt is "pdf") then
            set pdfFiles to pdfFiles & {item i}     
        end if
    end repeat
end tell
这是基于jweaks之前的回答:

答案是:

set myPDF to item 1 of allFiles as alias

就这些

如果我这样使用它,这对我来说很好:

tell application "Finder"
    repeat with i from 1 to listCount
        set myPDF to item i of folderA4

tell application "Adobe InDesign CS6"
    repeat with i from 1 to listCount
        set myDocument to make document
我认为混合使用finder和InDesign函数在这种情况下不起作用。尝试在循环中调用Finder:

repeat with i from 1 to listCount
  tell application "Adobe InDesign CS6"
    set myDocument to make document
  tell application "Finder"
    set myPDF to item i of folderA4

该文件夹只包含pdf文件,所以这并不能真正改变我尝试过的情况,但它不起作用。谢谢你的努力!好的,我很高兴您能解决这个问题,但是当我尝试您的原始问题的代码片段时,它们工作得很好,没有别名错误。我怀疑这个错误稍后会出现在您请求别名的代码中。正如我提到的,这个问题很不清楚,你的评论也没有帮助
repeat with i from 1 to listCount
  tell application "Adobe InDesign CS6"
    set myDocument to make document
  tell application "Finder"
    set myPDF to item i of folderA4