モニターの数を数えるv1

USのAppleScript StudioのMLで、「接続されているモニタ(ディスプレイ)の数を調べる方法について教えてほしい」という投稿があったので、5パターンぐらい提案したのですが、その中に入っていない例がよその人から提示され、AppleScript Studio環境で使うのでなければ割といい方法だったので、サブルーチンにまとめておきました。

スクリプト名:モニターの数を数えるv1
set dCount to countDisplay() of me

on countDisplay()
  tell application Image Events
    launch
    
set myDisplays to every display
    
set displayCount to count of myDisplays
    
quit
  end tell
  
return displayCount
end countDisplay

▼新規書類に ▼カーソル位置に ▼ドキュメント末尾に

Leave a Reply