20260526

[システム設定]CDとDVDパネルを開く AS

[システム設定]CDとDVDパネルを開く AS

NOTE記事一覧ですnote.com

【スクリプトエディタで開く】 |

CDとDVDパネルを開くAS.scpt.scpt
ソース
001#!/usr/bin/env osascript
002#coding: utf-8
003----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
004(*
005
006CDとDVDシステム設定パネルを開く
007
008CDとDVDのシステム設定のパネルは旧仕様
009かつ
010CDプレイヤーデバイスが接続されないと表示されない設定
011
012
013
014com.cocolog-nifty.quicktimer.icefloe *)
015----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
016use AppleScript version "2.8"
017use scripting additions
018
019set strFilePath to ("/System/Library/PreferencePanes/DigiHubDiscs.prefPane") as text
020set aliasFilePath to (POSIX file strFilePath) as alias
021
022
023tell application id "com.apple.systempreferences"
024   activate
025   set miniaturized of the settings window to false
026end tell
027repeat 10 times
028   tell application id "com.apple.systempreferences"
029      set boolFrontMost to frontmost as boolean
030   end tell
031   if boolFrontMost is true then
032      delay 1
033      exit repeat
034   else
035      tell application id "com.apple.systempreferences" to activate
036      delay 0.5
037   end if
038end repeat
039
040tell application "Finder"
041   open location aliasFilePath
042end tell
043delay 2
044
045tell application "Finder"
046   open location aliasFilePath
047end tell
AppleScriptで生成しました