[Acrobat AppleScripts]アプリケーションの画面サイズ
(*
theStatusMenuShowHideの22はFinderメニューバーのサイズ
Acrobatで開いた書類を画面最大サイズにリサイズする
*)
---画面サイズを求める
tell application "Finder"
set theWindowSize to (bounds of window of desktop) as list
set theDesktopWidth to (item 3 of theWindowSize) as number
set theDesktopHight to (item 4 of theWindowSize) as number
end tell
----ドックのサイズを求める
tell application "System Events"
tell application process "Dock"
set {dockWidth, dockHeight} to the size of list 1
end tell
tell dock preferences
set theScreenEdge to screen edge as text
set theAutohide to autohide as text
end tell
end tell
set theStatusMenuShowHide to (do shell script "/usr/bin/defaults read NSGlobalDomain _HIHideMenuBar") as number
if theStatusMenuShowHide is 0 then
set theMenuBarHight to 22 as number
else
set theMenuBarHight to 0 as number
end if
---アクロバットの処理
tell application "Adobe Acrobat"
---ファイルを開いて
open (choose file of type {"com.adobe.pdf"})
activate
tell active doc
---アプリケーションウィンドウのサイズを取得
set theDocBounds to bounds as list
end tell
--左から
set theDocBounds01 to (item 1 of theDocBounds) as number
--上から(メニュー部分を加味)
set theDocBounds02 to (item 2 of theDocBounds) as number
--幅
set theDocBounds03 to (item 3 of theDocBounds) as number
--高
set theDocBounds04 to (item 4 of theDocBounds) as number
---DOCKが隠れない場合
if theAutohide is "false" then
--DOCKの位置が下の場合
if theScreenEdge is "bottom" then
set theDockSize to dockHeight as number
set theAcroWindowBounds to {0, theMenuBarHight, theDesktopWidth, (theDesktopHight - theMenuBarHight - theDockSize)}
--DOCKの位置が左か右の場合
else
set theDockSize to dockWidth as number
set theAcroWindowBounds to {0, theMenuBarHight, (theDesktopWidth - theDockSize), (theDesktopHight - theMenuBarHight)}
end if
---DOCKが隠れる場合
else
--DOCKの位置が下の場合
if theScreenEdge is "bottom" then
set theDockSize to dockHeight as number
set theAcroWindowBounds to {0, theMenuBarHight, theDesktopWidth, (theDesktopHight - theMenuBarHight)}
--DOCKの位置が左か右の場合
else
set theDockSize to dockWidth as number
set theAcroWindowBounds to {0, theMenuBarHight, (theDesktopWidth), (theDesktopHight - theMenuBarHight)}
end if
end if
--アプリケーションウィンドウをリサイズする
tell active doc
set bounds to theAcroWindowBounds
end tell
activate
end tell
| 固定リンク
「Acrobat AppleScripts」カテゴリの記事
- 【Acrobat】Acrobatフォームでデータ印字(はがき宛名)(2021.08.22)
- 【Acrobat AppleScripts】フルスクリーン開始(2021.08.05)
- [Acrobat AppleScripts]アプリケーションの画面サイズ(2021.05.03)
- [Acrobat AppleScript]PDFを開いてTIFFで書き出す(バージョンによる差異)(2011.04.08)
- [Acrobat AppleScript]ファイルサイズの取得(this.filesize)(2011.03.30)