applescript&;acrobat pro:文档不存在';无法理解插入页面消息

applescript&;acrobat pro:文档不存在';无法理解插入页面消息,applescript,acrobat,Applescript,Acrobat,这是我的脚本,我不断地遇到这个错误-我已经尝试了一整天,但似乎没有得到它的工作。 事情是这样的:我在这里运行2个if案例,每次我删除其中一个(只插入一个文档),它都可以正常工作。所以代码不可能有那么大的错误。我以前用过两个ifs,但不知怎么的,我被需要插入的真正的pdf文档卡住了。你知道怎么回事吗?? 我已经复制了我在2007年的一篇文章中找到的脚本的一部分,但它并没有解决这个问题 set mainfolder to choose folder tell application "Finder"

这是我的脚本,我不断地遇到这个错误-我已经尝试了一整天,但似乎没有得到它的工作。 事情是这样的:我在这里运行2个if案例,每次我删除其中一个(只插入一个文档),它都可以正常工作。所以代码不可能有那么大的错误。我以前用过两个ifs,但不知怎么的,我被需要插入的真正的pdf文档卡住了。你知道怎么回事吗?? 我已经复制了我在2007年的一篇文章中找到的脚本的一部分,但它并没有解决这个问题

set mainfolder to choose folder
tell application "Finder" to set folderList to (sort folders of mainfolder as alias list by name)
display dialog "Ordner docs wählen"
set source_folder to choose folder

repeat with i from 1 to count of folderList
   try
       tell application "Finder" to set Master_File to (files of entire contents of (item i of folderList))
   end try


   repeat with i from 1 to count of folderList
     try
        tell application "Finder" to set Master_File to (files of entire contents of (item i of folderList))
     end try


   tell application "Finder" to set file_list to (files of entire contents of source_folder)

   tell application "Adobe Acrobat Pro"
       open Master_File
       set Master_Doc to document 1
       set PageCount to 0
   end tell

   repeat with this_file in file_list

       tell application "Adobe Acrobat Pro"
           if name of this_file is "xxx.pdf" then
              open (this_file as alias)
              insert pages Master_Doc after PageCount from document 2 starting with 1 number of pages 1
              close document 2 without saving
           end if

           if name of this_file is "yyy.pdf" then
              open (this_file as alias)
              set PageCount to 2
              insert pages Master_Doc after PageCount from document 2 starting with 1 number of pages 5

              close document 2 without saving
           end if

        end tell
    end repeat

 tell application "Adobe Acrobat Pro"
 close Master_Doc saving yes
 end tell

 end repeat

非常感谢您的帮助!谢谢大家

我不确定这是否正是你们想要做的,但我想我明白了

在您的帖子中,您在嵌套循环中使用了相同的i变量。您应该在嵌套循环时始终使用新变量,否则您将遇到问题

set mainfolder to choose folder
set source_folder to choose folder
tell application "Finder"
    set folderList to (sort folders of mainfolder as alias list by name)

    repeat with afolder in folderList
        set afolder to afolder as alias
        set Master_File to (first file of folder afolder)
        tell application "Adobe Acrobat Pro"
            open Master_File
            set Master_Doc to document 1
            set PageCount to 0
        end tell

        set file_list to (files of entire contents of source_folder)
        repeat with this_file in file_list

            tell application "Adobe Acrobat Pro"
                if name of this_file is "xxx.pdf" then
                    open (this_file as alias)
                    insert pages Master_Doc after PageCount from document 2 starting with 1 number of pages 1
                    close document 2 without saving
                end if

                if name of this_file is "yyy.pdf" then
                    open (this_file as alias)
                    set PageCount to 2
                    insert pages Master_Doc after PageCount from document 2 starting with 1 number of pages 5

                    close document 2 without saving
                end if

            end tell
        end repeat

    end repeat
    tell application "Adobe Acrobat Pro" to close Master_Doc saving yes
end tell

你能给我看一下文件夹的截屏吗?我已经回答了你的问题,请礼貌地回答