サファリでswfファイルを開き、組み込みの「PDFとして保存」機能を使用してPDFとして印刷するスクリプトを作成しようとしています。これまでのところ、私のコードは次のようになっています。
set appleworksFolder to choose folder
tell application "Finder"
set folderItems to (files of entire contents of appleworksFolder)
repeat with I from 1 to number of items in folderItems
set the_doc to item I of folderItems
set doc_name to name of the_doc as text
tell application "Finder"
set the clipboard to doc_name & ".pdf"
end tell
if name of the_doc is not ".DS_Store" then
try
tell application "Safari"
activate
open the_doc
tell application "System Events"
tell application process "Safari"
delay 1
click menu item "Print…" of menu "File" of menu bar 1
delay 5
click menu button "PDF" of window "Print" of application process "Safari" of application "System Events"
delay 1
click menu item "Save as PDF…" of menu "PDF" of menu button "PDF" of window "Print" of application process "Safari" of application "System Events"
delay 1
keystroke "v" using command down
click button "Save" of window "Save" of application process "Safari" of application "System Events"
delay 8
keystroke "w" using command down
delay 0.5
end tell
end tell
end tell
end try
end if
end repeat
end tell
これは、印刷ダイアログを表示するまでは機能しますが、PDFメニューボタンをクリックしていないように見えるため、これ以上進むことはありません。これがマウンテンライオンがボタンを制御するためにapplescriptを使用できないという問題であるかどうか疑問に思いました。もしそうなら、それに対する修正はありますか?どんな助けでも大歓迎です!