2016-03-29 98 views
0

私は.xlsxファイルを持っています.Applescriptを使用してPDF形式で保存します。私はこれを徹底的に探検したが、明らかに百万の問題がある。AppleScriptを使用してExcelをPDFに変換する(PDFとして保存)

私はこのように、コード内の...は、PDFへのアクティブなブックを変換するためのコードチャンクに置き換えられます.APP、として保存する何かをしたいと思いますが:

tell application "Microsoft Excel" 
    activate 
    open "/somedirectory/workbook1.xlsx" 
    ... 
end tell 

答えて

-1

それを見つけました!ここに答えている:

http://blog.krugazor.eu/2010/01/applescript-batch-saving-to-pdf/

次は、上記のリンクから引用されています

は「基本的に、どのようなそれがないと、シミュレートキーストロークとクリックでユーザーができるようになる何かをすることを可能にすること。

アップルスクリプトは、印刷ダイアログを使用してExcelファイルを一括してpdfに保存します。

on open some_items 
    repeat with this_item in some_items 
     try 
      tell application "Microsoft Excel" 
       activate 
       open this_item 
       tell application "System Events" to tell process "Microsoft Excel" 
        --Bring up print window 
        keystroke "p" using command down 
        --Choose "PDF" > "Save as PDF" 
        click (menu button "PDF" of window 1) 
        click (menu item 1 of menu of menu button "PDF" of window 1) 
        delay 2 
        -- Choose the desktop as save locaton (Command-D) 
        keystroke "d" using command down 
        --Save 
        keystroke "s" using command down 
        keystroke return 

        -- wait and close 
        delay 3 
        keystroke "w" using command down 
       end tell 
      end tell 
     end try 
    end repeat 

    tell application "Finder" 
     open desktop 
    end tell 
end open 
+1

あなたの回答に役立つリンクの関連部分を追加できますか?そうすれば、リンクがダウンしたり、変更されたりするなど、あなたの答えが役に立たなくなることはありません。どうもありがとう。 –

関連する問題