AppleScript prefPane

prefPaneはSystem Settingsに

macOS13以降は
https://quicktimer.cocolog-nifty.com/icefloe/cat76052438/index.html

|

[RCDefaultApp]デフォルトで開くアプリケーションを設定

デフォルトで開くアプリケーションを設定できます
アプリケーションIDでの指定も可能ですので
色々ソフトをインストールしている方には便利です
https://www.rubicode.com/Software/RCDefaultApp/

メールリンクをクリックした時にブラウザ使いたい場合は
その他から使いたいアプリケーションを選択すればOKです。

20220314-123832

ダウンロード

|

[prefPane] システム環境設定(まとめ)

1:パネルIDを取得する
2:パネルの名前を取得する
3:各アンカーを取得する
4:コマンドで開く
5:アンカーを選んでURLコマンドにする



1:パネルIDを取得する
tell application "System Events"
tell application "System Preferences"
set theIdOfPane to (get every pane)
end tell
end tell

theIdOfPane



2:パネルの名前を取得する
tell application "System Events"
tell application "System Preferences"
set theNameOfPane to (get name of every pane)
end tell
end tell

theNameOfPane



3:各アンカーを取得する


tell application "System Preferences"
set listIDOfAnchors to (get every pane)
end tell

set theLog to ""

repeat with refPaneID in listIDOfAnchors

tell application "System Preferences"
set thePaneID to id of refPaneID as text
end tell


tell application "System Preferences"
set refNameOfAnchors to (get anchors of pane id thePaneID)
end tell
set theAnchors to ""
set theCntRef to count of refNameOfAnchors
set numCnt to 1
repeat theCntRef times
tell application "System Preferences"

set refAnchors to (text item numCnt of refNameOfAnchors)
tell refAnchors
set theAnchorName to name as text
end tell
set theAnchors to "" & theAnchors & "\n" & theAnchorName & ""
end tell

set numCnt to numCnt + 1
end repeat

set theLog to "" & theLog & "\n" & thePaneID & "\n" & theAnchors & "\n" & ""
end repeat

theLog




4:コマンドで開く

#!/usr/bin/env osascript


do shell script "open 'x-apple.systempreferences:com.apple.preference.universalaccess?Seeing_Display'"



5:アンカーを選んでURLコマンドにする



use AppleScript version "2.8"
use scripting additions
set refAnchor to {}

tell application "System Preferences"

tell current pane
set refPaneID to id
tell anchors
set AppleScript's text item delimiters to ","
set refAnchor to name as text
set AppleScript's text item delimiters to ""
end tell
end tell

end tell
set AppleScript's text item delimiters to ","
set listAnchor to every text item of refAnchor
set AppleScript's text item delimiters to ""

set objRes to (choose from list listAnchor)



set theUrlSchemes to "x-apple.systempreferences:" as text


set theURl to "open " & theUrlSchemes & refPaneID & "?" & objRes & ""

tell application "Finder"
display dialog "openURL" default answer theURl

end tell


ダウンロード

ダウンロード - prefpane.zip




|

[prefPane] com.apple.preferences.softwareupdate

anchor "SoftwareUpdate"

ダウンロード - com.apple.preferences.softwareupdate.scpt.zip


(*
anchor "SoftwareUpdate"
*)

tell application "System Preferences" to launch

--システム環境設定が開くのを待つ
repeat
set doLaunchApp to get running of application "System Preferences"
if doLaunchApp is false then
delay 0.5
else
exit repeat
end if
end repeat

--アクセシビリティのパネルが開くを待つ
repeat
try
tell application "System Preferences"
set current pane to pane "com.apple.preferences.softwareupdate"
set thePaneID to id of current pane
end tell
on error
delay 0.5
tell application "System Preferences"
set thePaneID to id of current pane
end tell
end try
if thePaneID is "com.apple.preferences.softwareupdate" then
exit repeat
else
delay 0.5
end if
end repeat

--アンカーを指定する
tell application "System Preferences"
tell current pane
reveal anchor "SoftwareUpdate"
end tell
end tell
tell application "System Preferences"
tell current pane
reveal anchor "SoftwareUpdate"
end tell
activate
end tell

tell application "System Preferences"
tell current pane
authorize
end tell
end tell

|

[prefPane] com.apple.preference.displays

anchor "displaysDisplayTab"
anchor "displaysNightShiftTab"
anchor "universalControlTab"
anchor "displaysArrangementTab"
anchor "displaysColorTab"
anchor "displaysGeometryTab"

ダウンロード - com.apple.preference.displays.scpt.zip


(*
anchor "displaysDisplayTab"
anchor "displaysNightShiftTab"
anchor "universalControlTab"
anchor "displaysArrangementTab"
anchor "displaysColorTab"
anchor "displaysGeometryTab"
*)

tell application "System Preferences" to launch

--システム環境設定が開くのを待つ
repeat
set doLaunchApp to get running of application "System Preferences"
if doLaunchApp is false then
delay 0.5
else
exit repeat
end if
end repeat

--アクセシビリティのパネルが開くを待つ
repeat
try
tell application "System Preferences"
set current pane to pane "com.apple.preference.displays"
set thePaneID to id of current pane
end tell
on error
delay 0.5
tell application "System Preferences"
set thePaneID to id of current pane
end tell
end try
if thePaneID is "com.apple.preference.displays" then
exit repeat
else
delay 0.5
end if
end repeat

--アンカーを指定する
tell application "System Preferences"
tell current pane
reveal anchor "displaysDisplayTab"
end tell
end tell
tell application "System Preferences"
tell current pane
reveal anchor "displaysDisplayTab"
end tell
activate
end tell

tell application "System Preferences"
tell current pane
authorize
end tell
end tell

|

[prefPane] com.apple.preference.desktopscreeneffect

anchor "ScreenSaverPref_HotCorners"
anchor "DesktopPref"
anchor "ScreenSaverPref"

ダウンロード - com.apple.preference.desktopscreeneffect.scpt.zip

(*
anchor "ScreenSaverPref_HotCorners"
anchor "DesktopPref"
anchor "ScreenSaverPref"
*)

tell application "System Preferences" to launch

--システム環境設定が開くのを待つ
repeat
set doLaunchApp to get running of application "System Preferences"
if doLaunchApp is false then
delay 0.5
else
exit repeat
end if
end repeat

--アクセシビリティのパネルが開くを待つ
repeat
try
tell application "System Preferences"
set current pane to pane "com.apple.preference.desktopscreeneffect"
set thePaneID to id of current pane
end tell
on error
delay 0.5
tell application "System Preferences"
set thePaneID to id of current pane
end tell
end try
if thePaneID is "com.apple.preference.desktopscreeneffect" then
exit repeat
else
delay 0.5
end if
end repeat

--アンカーを指定する
tell application "System Preferences"
tell current pane
reveal anchor "ScreenSaverPref"
end tell
end tell
tell application "System Preferences"
tell current pane
reveal anchor "ScreenSaverPref"
end tell
activate
end tell

tell application "System Preferences"
tell current pane
authorize
end tell
end tell

|

[prefPane] com.apple.preference.trackpad

trackpadTab

ダウンロード - com.apple.preference.trackpad.scpt.zip

(*
anchor "trackpadTab"
*)

tell application "System Preferences" to launch

--システム環境設定が開くのを待つ
repeat
set doLaunchApp to get running of application "System Preferences"
if doLaunchApp is false then
delay 0.5
else
exit repeat
end if
end repeat

--アクセシビリティのパネルが開くを待つ
repeat
try
tell application "System Preferences"
set current pane to pane "com.apple.preference.trackpad"
set thePaneID to id of current pane
end tell
on error
delay 0.5
tell application "System Preferences"
set thePaneID to id of current pane
end tell
end try
if thePaneID is "com.apple.preference.trackpad" then
exit repeat
else
delay 0.5
end if
end repeat

--アンカーを指定する
tell application "System Preferences"
tell current pane
reveal anchor "trackpadTab"
end tell
end tell
tell application "System Preferences"
tell current pane
reveal anchor "trackpadTab"
end tell
activate
end tell

tell application "System Preferences"
tell current pane
authorize
end tell
end tell

|

[prefPane] com.apple.preference.network

anchor "VPN"
anchor "PPP"
anchor "Bluetooth"
anchor "Advanced Ethernet"
anchor "DNS"
anchor "Advanced VPN"
anchor "WINS"
anchor "6to4"
anchor "Bond"
anchor "Ethernet"
anchor "WWAN"
anchor "Advanced Modem"
anchor "Proxies"
anchor "Advanced Wi-Fi"
anchor "Modem"
anchor "VLAN"
anchor "PPPoE"
anchor "TCP/IP"
anchor "802.1X"
anchor "FireWire"
anchor "VPN on Demand"
anchor "Wi-Fi"

ダウンロード - com.apple.preference.network.scpt.zip


(*
anchor "VPN"
anchor "PPP"
anchor "Bluetooth"
anchor "Advanced Ethernet"
anchor "DNS"
anchor "Advanced VPN"
anchor "WINS"
anchor "6to4"
anchor "Bond"
anchor "Ethernet"
anchor "WWAN"
anchor "Advanced Modem"
anchor "Proxies"
anchor "Advanced Wi-Fi"
anchor "Modem"
anchor "VLAN"
anchor "PPPoE"
anchor "TCP/IP"
anchor "802.1X"
anchor "FireWire"
anchor "VPN on Demand"
anchor "Wi-Fi"
*)

tell application "System Preferences" to launch

--システム環境設定が開くのを待つ
repeat
set doLaunchApp to get running of application "System Preferences"
if doLaunchApp is false then
delay 0.5
else
exit repeat
end if
end repeat

--アクセシビリティのパネルが開くを待つ
repeat
try
tell application "System Preferences"
set current pane to pane "com.apple.preference.network"
set thePaneID to id of current pane
end tell
on error
delay 0.5
tell application "System Preferences"
set thePaneID to id of current pane
end tell
end try
if thePaneID is "com.apple.preference.network" then
exit repeat
else
delay 0.5
end if
end repeat

--アンカーを指定する
tell application "System Preferences"
tell current pane
reveal anchor "DNS"
end tell
end tell
tell application "System Preferences"
tell current pane
reveal anchor "DNS"
end tell
activate
end tell

tell application "System Preferences"
tell current pane
authorize
end tell
end tell

|

[prefPane] com.apple.Passwords

anchor "StartupSearchGroup"

ダウンロード - com.apple.passwords.scpt.zip

(*
anchor "StartupSearchGroup"
*)

tell application "System Preferences" to launch

--システム環境設定が開くのを待つ
repeat
set doLaunchApp to get running of application "System Preferences"
if doLaunchApp is false then
delay 0.5
else
exit repeat
end if
end repeat

--アクセシビリティのパネルが開くを待つ
repeat
try
tell application "System Preferences"
set current pane to pane "com.apple.Passwords"
set thePaneID to id of current pane
end tell
on error
delay 0.5
tell application "System Preferences"
set thePaneID to id of current pane
end tell
end try
if thePaneID is "com.apple.Passwords" then
exit repeat
else
delay 0.5
end if
end repeat

--アンカーを指定する
tell application "System Preferences"
tell current pane
reveal anchor "StartupSearchGroup"
end tell
end tell
tell application "System Preferences"
tell current pane
reveal anchor "StartupSearchGroup"
end tell
activate
end tell

tell application "System Preferences"
tell current pane
authorize
end tell
end tell

|

[prefPane] com.apple.preference.battery

anchor "schedule"
anchor "currentSource"
anchor "usage"
anchor "adapter"
anchor "battery"
anchor "ups"

ダウンロード - com.apple.preference.battery.scpt.zip


(*
anchor "schedule"
anchor "currentSource"
anchor "usage"
anchor "adapter"
anchor "battery"
anchor "ups"
*)

tell application "System Preferences" to launch

--システム環境設定が開くのを待つ
repeat
set doLaunchApp to get running of application "System Preferences"
if doLaunchApp is false then
delay 0.5
else
exit repeat
end if
end repeat

--アクセシビリティのパネルが開くを待つ
repeat
try
tell application "System Preferences"
set current pane to pane "com.apple.preference.battery"
set thePaneID to id of current pane
end tell
on error
delay 0.5
tell application "System Preferences"
set thePaneID to id of current pane
end tell
end try
if thePaneID is "com.apple.preference.battery" then
exit repeat
else
delay 0.5
end if
end repeat

--アンカーを指定する
tell application "System Preferences"
tell current pane
reveal anchor "currentSource"
end tell
end tell
tell application "System Preferences"
tell current pane
reveal anchor "currentSource"
end tell
activate
end tell

tell application "System Preferences"
tell current pane
authorize
end tell
end tell

|

より以前の記事一覧

その他のカテゴリー

Acrobat Acrobat Annotation Acrobat Dialog Acrobat Form Acrobat JS Acrobat Open Acrobat Plugin Acrobat python Acrobat Reader Acrobat Sequ Acrobat Stamps Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin System Information Admin Tools Admin Users Admin Volumes Adobe Apple AppleScript AppleScript Guide AppleScript Accessibility AppleScript AppKit AppleScript Applications AppleScript AppStore AppleScript Archive AppleScript Attributes AppleScript Automator AppleScript AVAsset AppleScript AVconvert AppleScript AVFoundation AppleScript AVURLAsset AppleScript BackUp AppleScript Barcode AppleScript Bash AppleScript Basic AppleScript Basic Path AppleScript Bluetooth AppleScript BOX AppleScript Browser AppleScript Calendar AppleScript CD/DVD AppleScript Choose AppleScript Chrome AppleScript CIImage AppleScript CloudStorage AppleScript Color AppleScript com.apple.LaunchServices.OpenWith AppleScript Console AppleScript Contacts AppleScript CotEditor AppleScript CURL AppleScript current application AppleScript Date&Time AppleScript delimiters AppleScript Desktop AppleScript Device AppleScript Disk AppleScript do shell script AppleScript Dock AppleScript DropBox AppleScript eMail AppleScript Encode Decode AppleScript Error AppleScript EXIFData AppleScript ffmpeg AppleScript File AppleScript Finder AppleScript Firefox AppleScript Folder AppleScript Fonts AppleScript GIF AppleScript HTML AppleScript Icon AppleScript Illustrator AppleScript Image Events AppleScript Image2PDF AppleScript ImageOptim Applescript iWork AppleScript Javascript AppleScript Jedit AppleScript Json AppleScript Label AppleScript List AppleScript locationd AppleScript LRC AppleScript LSSharedFileList AppleScript m3u8 AppleScript MakePDF AppleScript Map AppleScript Math AppleScript Microsoft AppleScript Microsoft Edge AppleScript Microsoft Excel AppleScript Mobileconfig AppleScript Mouse AppleScript Movie AppleScript Music AppleScript NetWork AppleScript Notes AppleScript NSArray AppleScript NSBitmapImageRep AppleScript NSBundle AppleScript NSCFBoolean AppleScript NSCharacterSet AppleScript NSColor AppleScript NSColorList AppleScript NSData AppleScript NSDictionary AppleScript NSError AppleScript NSEvent AppleScript NSFileAttributes AppleScript NSFileManager AppleScript NSFont AppleScript NSFontManager AppleScript NSImage AppleScript NSIndex AppleScript NSKeyedArchiver AppleScript NSKeyedUnarchiver AppleScript NSLocale AppleScript NSMutableArray AppleScript NSMutableDictionary AppleScript NSMutableString AppleScript NSNotFound AppleScript NSNumber AppleScript NSOpenPanel AppleScript NSPasteboard AppleScript NSPDFImageRep AppleScript NSpoint AppleScript NSPredicate AppleScript NSRange AppleScript NSRegularExpression AppleScript NSRunningApplication AppleScript NSScreen AppleScript NSSize AppleScript NSString AppleScript NSStringCompareOptions AppleScript NSTask AppleScript NSTimeZone AppleScript NSURL AppleScript NSURL File AppleScript NSURLBookmark AppleScript NSURLComponents AppleScript NSURLResourceKey AppleScript NSUserDefaults AppleScript NSUUID AppleScript NSView AppleScript NSWorkspace AppleScript Numbers AppleScript OAuth AppleScript ObjC AppleScript OneDrive AppleScript Osax AppleScript PDF AppleScript PDFAnnotationWidget AppleScript PDFContext AppleScript PDFDisplayBox AppleScript PDFDocumentPermissions AppleScript PDFKit AppleScript PDFnUP AppleScript PDFOutline AppleScript Photos AppleScript Photoshop AppleScript Plist System Events AppleScript PostScript AppleScript prefPane AppleScript Preview AppleScript Python AppleScript QR AppleScript QR Decode AppleScript QuickLook AppleScript QuickTime AppleScript record AppleScript Regular Expression AppleScript Reminders AppleScript ReName AppleScript Repeat AppleScript RTF AppleScript Safari AppleScript SaveFile AppleScript ScreenCapture AppleScript ScreenSaver AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript Sort AppleScript Sound AppleScript Spotlight AppleScript SRT AppleScript StandardAdditions AppleScript stringByApplyingTransform AppleScript System Events AppleScript System Settings AppleScript TemporaryItems AppleScript Terminal AppleScript Text AppleScript Text CSV AppleScript Text TSV AppleScript TextEdit AppleScript Translate AppleScript Trash AppleScript Twitter AppleScript UI AppleScript Unit Conversion AppleScript UTType AppleScript valueForKeyPath AppleScript Video AppleScript VisionKit AppleScript Visual Studio Code AppleScript webarchive AppleScript webp AppleScript Wifi AppleScript XML AppleScript XML EPUB AppleScript XML OPML AppleScript XML Plist AppleScript XML RSS AppleScript XML SVG AppleScript XML TTML AppleScript XML webloc AppleScript YouTube AppleScript Zero Suppress Applications Barcode OnLine Tools CityCode Design iPhone List Logs lsappinfo Memo Music perl PlistBuddy pluginkit postalcode ReadMe SF Symbols character id SF Symbols Entity sips Skype Slack sqlite TCC Tools Typography Video Wacom zoom