システム設定>一般>デバイス管理を開く
【スクリプトエディタで開く】 |
デバイス管理.com.apple.Profiles-Settings.extension.Main.applescript.scpt | ソース |
|---|
| 001 | #!/usr/bin/env osascript |
| 002 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
| 003 | (* |
| 004 |
|
| 005 | システム設定>一般>デバイス管理を 開きます |
| 006 |
|
| 007 | com.cocolog-nifty.quicktimer.icefloe *) |
| 008 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
| 009 | use AppleScript version "2.8" |
| 010 | use framework "Foundation" |
| 011 | use framework "AppKit" |
| 012 | use framework "UniformTypeIdentifiers" |
| 013 | use scripting additions |
| 014 | property refMe : a reference to current application |
| 015 | set strBundleID to ("com.apple.systempreferences") as text |
| 016 | ###URLにする |
| 017 | set ocidURLComponents to refMe's NSURLComponents's alloc()'s init() |
| 018 | ###スキーム |
| 019 | ocidURLComponents's setScheme:("x-apple.systempreferences") |
| 020 | ###パネルIDをパスにセット |
| 021 | ocidURLComponents's setPath:("com.apple.Profiles-Settings.extension") |
| 022 | ###アンカーをクエリーとして追加 |
| 023 | ocidURLComponents's setQuery:("Main") |
| 024 | set ocidOpenAppURL to ocidURLComponents's |URL| |
| 025 | set strOpenAppURL to ocidOpenAppURL's absoluteString() as text |
| 026 | ###ワークスペースで開く |
| 027 | set appShardWorkspace to refMe's NSWorkspace's sharedWorkspace() |
| 028 | set boolDone to appShardWorkspace's openURL:(ocidOpenAppURL) |
| 029 | log boolDone |
| 030 | if boolDone is false then |
| 031 | tell application id "com.apple.systempreferences" |
| 032 | activate |
| 033 | set miniaturized of the settings window to false |
| 034 | end tell |
| 035 | tell application id "com.apple.finder" |
| 036 | open location "x-apple.systempreferences:com.apple.Profiles-Settings.extension?Main" |
| 037 | end tell |
| 038 | tell application id "com.apple.systempreferences" |
| 039 | reveal anchor "Main" of pane id "com.apple.Profiles-Settings.extension" |
| 040 | end tell |
| 041 | tell application id "com.apple.systempreferences" to activate |
| 042 | end if |
| 043 | ###開くのを待つ |
| 044 | repeat 10 times |
| 045 | tell application id "com.apple.systempreferences" |
| 046 | set boolFrontMost to frontmost as boolean |
| 047 | end tell |
| 048 | if boolFrontMost is true then |
| 049 | delay 1 |
| 050 | exit repeat |
| 051 | else |
| 052 | tell application id "com.apple.systempreferences" to activate |
| 053 | delay 0.5 |
| 054 | end if |
| 055 | end repeat |
| 056 | ###アンカーを再指定 |
| 057 | ##tell application "System Events" |
| 058 | tell application "System Settings" |
| 059 | tell pane id "com.apple.Profiles-Settings.extension" |
| 060 | reveal |
| 061 | end tell |
| 062 | end tell |
| 063 | ##end tell |
| 064 | return 0 |
| AppleScriptで生成しました |
|---|