2013-09-27 34 views
0

這是我的腳本,我不斷收到這個錯誤 - 我一直在嘗試一整天,但似乎沒有得到它的工作。 這裏是事情:我運行2如果在這裏的情況下,每次我刪除其中一個(只插入一個文件)它工作正常。所以代碼不會出錯。我得到它與兩個ifs之前工作,但不知何故,我被我需要插入真正的pdf文件卡住了。任何想法是什麼錯誤? 我已經複製了2007年在帖子中發現的腳本的一部分,但它沒有解決問題。applescript&acrobat pro:文檔不理解插入頁面消息

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 

幫助非常感謝!謝謝你們

+0

請你告訴我的屏幕截圖文件夾結構器 – mcgrailm

+0

我已經回答了你的問題,試圖回答你的問題請求回覆 – mcgrailm

回答

0

我不確定這是否正是你想要做的,但我想我明白了。

在您的文章

您使用相同的變量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 
相關問題