« [com.apple.digihub]com.apple.digihub設定スクリプト | トップページ | ボリュームをアンマウント »

com.apple.CD-DVD-Settings.extensionシステム設定を開く


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

###システム設定を開いて
tell application "System Settings" to launch
###起動確認10秒
repeat 10 times
  tell application "System Settings" to activate
  ###前面のアプリケーション
  tell application "System Events"
    set strAppName to (name of first application process whose frontmost is true) as text
  end tell
  ####起動確認できたら抜ける
  if strAppName is "System Settings" then
    exit repeat
  else
    ###起動に時間がかかっている場合は1秒まつ
    delay 1
  end if
end repeat

####パネルオープン確認
tell application "System Settings"
  activate
  repeat 10 times
    ####ウィンドウの名前を取得する
    set strWindowName to (name of front window) as text
    ###取得できなかったら1秒待つ
    if strWindowName is "" then
      delay 1
      ###取得できたらリピート抜ける
    else if strWindowName is "外観" then
      exit repeat
      ###すでに起動済みで外観以外を開いている場合
    else
      exit repeat
    end if
  end repeat
end tell

tell application "System Settings"
  try
reveal anchor "Main" of pane id "com.apple.CD-DVD-Settings.extension"
  on error
return "CD/DVDデバイスが接続されていないと開けません"
  end try
end tell

tell application "System Settings" to activate
####パネルオープン確認
tell application "System Settings"
  ###起動確認 最大10秒
  repeat 10 times
    activate
    ####ウィンドウの名前を取得する
    set strWindowName to (name of front window) as text
    ###取得できなかったら1秒待つ
    if strWindowName is "" then
      delay 1
      ###取得できたらリピート抜ける
    else if strWindowName is "CDとDVD" then
      exit repeat
      ###すでに起動済みで外観以外を開いている場合
    else
      delay 1
    end if
  end repeat
end tell



|

« [com.apple.digihub]com.apple.digihub設定スクリプト | トップページ | ボリュームをアンマウント »

CD/DVD」カテゴリの記事