我有一个看起来像这样的苹果:
repeat
tell application "Adobe Reader"
open "filepath/name.pdf"
end tell
delay (60)
tell application "Adobe Reader"
open "filepath/name1.pdf"
end tell
delay (60)
tell application "Adobe Reader"
open "filepath/name2.pdf"
end tell
delay (60)
end repeat
我希望能够在打开后关闭pdf窗口。问题是这些pdf驻留在共享上,用户可以更新它们。如果停止并重新启动,脚本将仅显示更新的pdf。我不想手动这样做。我怎么能这样做?
答案 0 :(得分:0)
这是一个解决方案,它使预览可编写脚本,然后继续打开和关闭您选择的文件。
-- http://www.macworld.com/article/1053391/previewscript.html
on addAppleScriptFeatures()
try
tell application "Finder"
set the Preview_app to (application file id "com.apple.Preview") as alias
end tell
set the plist_filepath to the quoted form of ¬
((POSIX path of the Preview_app) & "Contents/Info")
do shell script "defaults write " & the plist_filepath & space ¬
& "NSAppleScriptEnabled -bool YES" with administrator privileges
do shell script "chmod -R 755 " & the quoted form of (POSIX path of the Preview_app) with administrator privileges
return true
on error myErr number MyNr
display dialog myErr & " (" & MyNr & ")." buttons {"OK"} default button "OK" with icon 0
return false
end try
end addAppleScriptFeatures
if addAppleScriptFeatures() then
set f to choose file
tell application "Preview"
activate
open f
delay 5 -- short for testing
close window 2
end tell
end if