システム設定 アクセシビリティのアンカーリスト
AppleScript サンプルコード
行番号 | ソース |
---|---|
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 scripting additions |
011 | |
012 | |
013 | set listOfAccessibilityAnchor to {"AX_ALT_MOUSE_BUTTONS", "AX_ALT_MOUSE_ENABLE_SOUNDS", "AX_ALT_MOUSE_ENABLE_VISUALS", "AX_ANIMATED_IMAGES", "AX_BACKGROUND_SOUNDS", "AX_BACKGROUND_SOUNDS_LOCK_SCREEN", "AX_BACKGROUND_SOUNDS_VOLUME", "AX_BG_SOUND_SELECT_HEADER", "AX_CAPTIONING_PREFER_SDH", "AX_CONFIGURE_CAMERA", "AX_CURSOR_SIZE", "AX_DIFFERENTIATE_WITHOUT_COLOR", "AX_DIM_FLASHING", "AX_DISPLAY_FILTER_ENABLED", "AX_DISPLAY_FILTER_INTENSITY", "AX_DISPLAY_FILTER_TINT_COLOR", "AX_DISPLAY_FILTER_TYPE", "AX_DWELL_ACTION", "AX_DWELL_AUTO_REVERT", "AX_DWELL_CURSOR_COLOR", "AX_DWELL_IN_MENU_EXTRA", "AX_DWELL_IN_PANELS", "AX_DWELL_PROGRESS_INDICATOR", "AX_DWELL_RETRIGGER_TOLERANCE", "AX_DWELL_TOLERANCE", "AX_DWELL_WAIT_TIME", "AX_DWELL_WAIT_TIME_HOME", "AX_DWELL_ZOOM", "AX_DWELL_ZOOM_WAIT", "AX_ENHANCE_CONTRAST", "AX_FACETIME_TRANSCRIPTIONS", "AX_FEATURE_AUDIO", "AX_FEATURE_AVS", "AX_FEATURE_CAPTIONS", "AX_FEATURE_DESCRIPTIONS", "AX_FEATURE_HEARINGAIDS", "AX_FEATURE_KEYBOARD", "AX_FEATURE_PERSONALVOICE", "AX_FEATURE_POINTERCONTROL", "AX_FEATURE_SHORTCUT", "AX_FEATURE_SIRI", "AX_FEATURE_SPOKENCONTENT", "AX_FEATURE_ZOOM", "AX_FIND_CURSOR", "AX_FKA_AUTO_HIDE_CHECKBOX", "AX_FKA_COLOR_POP_UP", "AX_FKA_COMMANDS_RESTORE_DEFAULTS", "AX_FKA_ENABLE_CHECKBOX", "AX_FKA_HIGH_CONTRAST_CHECKBOX", "AX_FKA_INCREASE_SIZE_CHECKBOX", "AX_FLASH_SCREEN", "AX_FONT_SIZE", "AX_HEADPHONE_HOLD_DURATION", "AX_HEADPHONE_NOISE_CANCEL", "AX_HEADPHONE_PRESS_SPEED", "AX_HEADPHONE_TONE_VOLUME", "AX_HEAD_MOUSE", "AX_HEAD_MOUSE_BUTTON", "AX_HEAD_MOUSE_MODE", "AX_HEAD_MOUSE_PAUSE_RESUME", "AX_HEAD_MOUSE_RECALIBRATE", "AX_HEAD_MOUSE_SENSITIVITY", "AX_HEAD_MOUSE_TOLERANCE", "AX_HOME_PANEL_DWELL_ACTIONS", "AX_HOVER_TEXT_ACTIVATION_LOCK_MODE", "AX_HOVER_TEXT_BG_COLOR", "AX_HOVER_TEXT_BORDER_COLOR", "AX_HOVER_TEXT_ELEMENT_COLOR", "AX_HOVER_TEXT_ENABLE", "AX_HOVER_TEXT_FG_COLOR", "AX_HOVER_TEXT_FONT_FAMILY", "AX_HOVER_TEXT_FONT_SIZE", "AX_HOVER_TEXT_MODIFIER", "AX_HOVER_TYPING_BG_COLOR", "AX_HOVER_TYPING_BORDER_COLOR", "AX_HOVER_TYPING_ELEMENT_COLOR", "AX_HOVER_TYPING_ENABLE", "AX_HOVER_TYPING_ENTRY_LOCATION", "AX_HOVER_TYPING_FG_COLOR", "AX_HOVER_TYPING_FONT_FAMILY", "AX_HOVER_TYPING_FONT_SIZE", "AX_HOVER_TYPING_INSERTION_COLOR", "AX_IGNORE_TRACKPAD", "AX_INCREASE_CONTRAST", "AX_INVERT_COLOR", "AX_INVERT_COLOR_MODE", "AX_IN_APP", "AX_KB_APPEARANCE_TYPE", "AX_KB_AUTO_CAPITALIZATION", "AX_KB_AUTO_SPACING", "AX_KB_HIDE", "AX_KB_HIDE_STEPPER", "AX_KB_HIDE_TRANSPARENCY", "AX_KB_KEY_ACCEPTED_MOUSE", "AX_KB_RIGHT_CLICK", "AX_KB_USE_CLICK_SOUNDS", "AX_LIVE_SPEECH_ADD_CATEGORY", "AX_LIVE_SPEECH_CATEGORY_DETAIL.Recent", "AX_LIVE_SPEECH_CATEGORY_DETAIL.Saved", "AX_LIVE_SPEECH_ENABLED", "AX_LIVE_SPEECH_FONT_SIZE", "AX_LIVE_SPEECH_PREFERRED_LANGUAGE", "AX_LIVE_SPEECH_SAVED_PHRASES", "AX_LIVE_SPEECH_VOICE_SELECTION", "AX_MENUBAR_DWELL_ACTIONS", "AX_MENU_FONT_SIZE", "AX_MONO_AUDIO", "AX_MOUSE_DOUBLE_CLICK_SPEED", "AX_MOUSE_KEYS", "AX_MOUSE_KEYS_DELAY", "AX_MOUSE_KEYS_IGNORE_TRACKPAD", "AX_MOUSE_KEYS_SHORTCUT", "AX_MOUSE_KEYS_SPEED", "AX_MOUSE_OPTIONS", "AX_MOUSE_SCROLL", "AX_MOUSE_SCROLL_BEHAVIOR", "AX_MOUSE_SCROLL_SPEED", "AX_NAVIGATION_TIMING", "AX_PLAY_SYSTEM_SOUNDS", "AX_PME_AMPLIFICATION", "AX_PME_BALANCE", "AX_PME_BEAM_FORMING", "AX_PME_LEVEL", "AX_PME_MEDIA", "AX_PME_NOISE_SUPPRESSOR", "AX_PME_PHONE", "AX_PME_SAMPLE", "AX_PME_SETUP", "AX_PME_SHAPE", "AX_PME_TOGGLE", "AX_PME_TONE", "AX_PME_TRANSPARENCY", "AX_POINTER_FILL_COLOR", "AX_POINTER_OUTLINE_COLOR", "AX_POINTER_RESET_COLOR", "AX_PREFERS_HORIZ_TEXT_LAYOUT", "AX_REDUCE_MOTION", "AX_REDUCE_TRANSPARENCY", "AX_RTT_ENABLE", "AX_RTT_RELAY_NUMBER", "AX_RTT_SEND_IMMEDIATELY", "AX_SHOW_TOOLBAR_BUTTON_SHAPES", "AX_SHOW_WINDOW_TITLEBAR_ICONS", "AX_SIRI_ATYPICAL_SPEECH", "AX_SLOW_KEYS", "AX_SLOW_KEYS_DELAY", "AX_SLOW_KEYS_SOUND", "AX_SOUND.BrownNoise", "AX_SOUND.Fire", "AX_SOUND.Night", "AX_SOUND.Ocean", "AX_SOUND.PinkNoise", "AX_SOUND.Rain", "AX_SOUND.Stream", "AX_SOUND.WhiteNoise", "AX_SPATIAL_AUDIO_FOLLOWS_HEAD", "AX_SPEECH_DELAY", "AX_SPEECH_PHRASE", "AX_SPEECH_TEST", "AX_SPEECH_VOICES", "AX_SPOKEN_ALERTS", "AX_SPOKEN_DETECT_LANGUAGES", "AX_SPOKEN_HOTKEY", "AX_SPOKEN_LANGUAGE", "AX_SPOKEN_POINTER_ELEMENT", "AX_SPOKEN_POINTER_ELEMENT_DELAY", "AX_SPOKEN_POINTER_ELEMENT_MODE", "AX_SPOKEN_POINTER_ELEMENT_VERBOSITY", "AX_SPOKEN_PRONUNCIATIONS", "AX_SPOKEN_PRONUNCIATIONS_EDIT", "AX_SPOKEN_SELECTION_HIGHLIGHT_CONTENT", "AX_SPOKEN_SELECTION_HIGHLIGHT_SENTENCE_COLOR", "AX_SPOKEN_SELECTION_HIGHLIGHT_SENTENCE_STYLE", "AX_SPOKEN_SELECTION_HIGHLIGHT_WORD_COLOR", "AX_SPOKEN_SELECTION_HOTKEY", "AX_SPOKEN_SELECTION_SHOW_CONTROLLER", "AX_SPOKEN_TYPING_ECHO", "AX_SPOKEN_TYPING_ECHO_CHARS", "AX_SPOKEN_TYPING_ECHO_MODIFIER_KEYS", "AX_SPOKEN_TYPING_ECHO_SELECTION", "AX_SPOKEN_TYPING_ECHO_WORDS", "AX_SPOKEN_VOICE", "AX_SPRING_LOADING", "AX_SPRING_LOADING_DELAY", "AX_STICKY_KEYS", "AX_STICKY_KEYS_BEEP", "AX_STICKY_KEYS_DISPLAY", "AX_STICKY_KEYS_DISPLAY_LOCATION", "AX_STICKY_KEYS_SHORTCUT", "AX_SWITCH_AUTOSCAN", "AX_SWITCH_AUTO_CAPITALIZATION", "AX_SWITCH_AUTO_SPACING", "AX_SWITCH_COALESCE", "AX_SWITCH_CONTROL_APPEARANCE_TYPE", "AX_SWITCH_CONTROL_ENABLE", "AX_SWITCH_CONTROL_PLATFORM_SWITCHING", "AX_SWITCH_CURSOR_SIZE", "AX_SWITCH_CURSOR_SPEED", "AX_SWITCH_ELEMENT_SPEED", "AX_SWITCH_FIRST_ITEM_DELAY", "AX_SWITCH_HIDE_AFTER_DELAY", "AX_SWITCH_HIDE_AFTER_DELAY_AMOUNT", "AX_SWITCH_HOVER_TEXT_TOOLBAR", "AX_SWITCH_MIN_DURATION", "AX_SWITCH_MOUSE_CURSOR_EDGE", "AX_SWITCH_MOUSE_MOVE_STYLE", "AX_SWITCH_NAV_FEEDBACK", "AX_SWITCH_PANEL_EDITOR", "AX_SWITCH_REPEAT_HOLD", "AX_SWITCH_RESUME_AUTO_SCANNING", "AX_SWITCH_SCAN_CYCLE", "AX_SWITCH_SCAN_RESTART", "AX_SWITCH_SCAN_SPEED", "AX_SWITCH_TIMING", "AX_SYSTEM_TRANSCRIPTION_BACKGROUND_COLOR_MAIN", "AX_SYSTEM_TRANSCRIPTION_ENABLED", "AX_SYSTEM_TRANSCRIPTION_TEXT_COLOR_MAIN", "AX_SYSTEM_TRANSCRIPTION_TEXT_FONT_FAMILY_MAIN", "AX_SYSTEM_TRANSCRIPTION_TEXT_FONT_SIZE_MAIN", "AX_TOUCH_BAR_ZOOM_ENABLE", "AX_TRACKPAD_DRAGGING", "AX_TRACKPAD_DRAGGING_BEHAVIOR", "AX_TRACKPAD_OPTIONS", "AX_TRACKPAD_SCROLL", "AX_TRACKPAD_SCROLL_BEHAVIOR", "AX_TRACKPAD_SCROLL_SPEED", "AX_TYPE_TO_SIRI_ENABLED", "AX_VIRTUAL_KEYBOARD", "AX_VIRTUAL_KEYBOARD_PANEL_EDITOR", "AX_VOICEOVER_ENABLED", "AX_VOICE_CONTROL_AUDIO_DONATION_ENABLED", "AX_VOICE_CONTROL_COMMANDS", "AX_VOICE_CONTROL_ENABLED", "AX_VOICE_CONTROL_LANGUAGE", "AX_VOICE_CONTROL_MIC", "AX_VOICE_CONTROL_OPEN_TRAINING", "AX_VOICE_CONTROL_OVERLAY", "AX_VOICE_CONTROL_OVERLAY_FADING_ENABLED", "AX_VOICE_CONTROL_PLAY_SOUND_ENABLED", "AX_VOICE_CONTROL_SHOW_HINTS_ENABLED", "AX_VOICE_CONTROL_VOCABULARY", "AX_VOICE_OPTION_COMMANDS_DELETE_ALL", "AX_VOICE_OPTION_COMMANDS_EXPORT", "AX_VOICE_OPTION_COMMANDS_IMPORT", "AX_VOICE_OPTION_VOCAB_DELETE_ALL", "AX_VOICE_OPTION_VOCAB_EXPORT", "AX_VOICE_OPTION_VOCAB_IMPORT", "AX_VO_OPEN_TRAINING", "AX_VO_OPEN_UTILITY", "AX_ZOOM_ADJUST_SIZE", "AX_ZOOM_CHOOSE_DISPLAY", "AX_ZOOM_DISABLE_UNIVERSAL_CONTROL", "AX_ZOOM_ENABLE_GESTURE", "AX_ZOOM_ENABLE_HOTKEYS", "AX_ZOOM_FLASH", "AX_ZOOM_FOCUS_MOVEMENT", "AX_ZOOM_FOCUS_MOVEMENT_DELAY", "AX_ZOOM_FOLLOW_FOCUS_ACTIVATION", "AX_ZOOM_FOLLOW_FOCUS_MODE", "AX_ZOOM_FREEZE_PANNING", "AX_ZOOM_GESTURE_FIELD", "AX_ZOOM_INVERT", "AX_ZOOM_KEEP_STATIONARY", "AX_ZOOM_MAX_FACTOR", "AX_ZOOM_MIN_FACTOR", "AX_ZOOM_MONITOR_SELECTION", "AX_ZOOM_MONITOR_SELECTION_TRACKPAD", "AX_ZOOM_MOVE", "AX_ZOOM_RAPID", "AX_ZOOM_RESIZE_SHORTCUTS", "AX_ZOOM_RESTORE", "AX_ZOOM_RESTORE_SHORTCUT", "AX_ZOOM_SMOOTH", "AX_ZOOM_STYLE_POPUP", "AX_ZOOM_TEMP_DETACH", "AX_ZOOM_TEMP_TOGGLE", "AX_ZOOM_TOGGLE_FS_AND_PIP", "AX_ZOOM_TRACKPAD", "AX_feature.alternateMouseButtons", "AX_feature.displayFilters", "AX_feature.fullKeyboardAccess", "AX_feature.headMouse", "AX_feature.hoverText", "AX_feature.hoverTyping", "AX_feature.increaseContrast", "AX_feature.invertDisplayColor", "AX_feature.liveSpeech", "AX_feature.mouseKeys", "AX_feature.reduceTransparency", "AX_feature.slowKeys", "AX_feature.stickyKeys", "AX_feature.switchControl", "AX_feature.systemTranscriptions", "AX_feature.virtualKeyboard", "AX_feature.voiceControl", "AX_feature.voiceOver", "AX_feature.zoom", "AZ_ZOOM_INDIVIDUAL_DISPLAYS", "alternateControlMethods", "display", "fullKeyboardAccessOptions", "headphones", "hoverTextColors", "hoverTextSettings", "hoverTypingColors", "hoverTypingSettings", "mouseAndTrackpad", "pointer", "switchControlNavigation", "switchControlSwitches", "switchControlTyping", "text", "virtualKeyboardDwell", "virtualKeyboardHotCorners", "zoomAppearance", "zoomControls", "zoomFollowFocus", "zoomHotkeyConfig", "zoomTempModifiersConfig"} as list |
014 | |
015 | set strName to (name of current application) as text |
016 | if strName is "osascript" then |
017 | tell application "Finder" to activate |
018 | else |
019 | tell current application to activate |
020 | end if |
021 | ### |
022 | set strTitle to ("選んでください") as text |
023 | set strPrompt to ("選んだ項目で戻します") as text |
024 | try |
025 | set objResponse to (choose from list listOfAccessibilityAnchor with title strTitle with prompt strPrompt default items (item 1 of listOfAccessibilityAnchor) OK button name "OK" cancel button name "キャンセル" with empty selection allowed without multiple selections allowed) |
026 | on error |
027 | log "エラーしました" |
028 | return "エラーしました" |
029 | end try |
030 | log class of objResponse |
031 | if (class of objResponse) is boolean then |
032 | return "キャンセルしましたA" |
033 | else if (class of objResponse) is list then |
034 | if objResponse is {} then |
035 | return "キャンセルしましたB" |
036 | else |
037 | set strResponse to (item 1 of objResponse) as text |
038 | end if |
039 | end if |
040 | |
041 | tell application id "com.apple.systempreferences" |
042 | activate |
043 | set miniaturized of the settings window to false |
044 | end tell |
045 | |
046 | #wait systempreferences |
047 | repeat 10 times |
048 | tell application id "com.apple.systempreferences" |
049 | set boolFrontMost to frontmost as boolean |
050 | end tell |
051 | if boolFrontMost is true then |
052 | # one-second prayer after exit |
053 | delay 1 |
054 | exit repeat |
055 | else |
056 | tell application id "com.apple.systempreferences" to activate |
057 | delay 0.5 |
058 | end if |
059 | end repeat |
060 | |
061 | #set anchor |
062 | tell application id "com.apple.systempreferences" |
063 | reveal anchor strResponse of pane id "com.apple.Accessibility-Settings.extension" |
064 | end tell |
065 | tell application id "com.apple.systempreferences" to activate |
066 | |
067 | #wait Accessibility |
068 | repeat 10 times |
069 | tell application id "com.apple.systempreferences" |
070 | activate |
071 | tell current pane |
072 | set strPaneID to id |
073 | end tell |
074 | end tell |
075 | if strPaneID is "com.apple.systempreferences.GeneralSettings" then |
076 | delay 0.5 |
077 | else if strPaneID is "pane com.apple.Accessibility-Settings.extension" then |
078 | exit repeat |
079 | end if |
080 | end repeat |
081 | |
082 | #wait Voice Control |
083 | repeat 10 times |
084 | tell application id "com.apple.systempreferences" |
085 | tell front window |
086 | set strWindowName to name |
087 | end tell |
088 | end tell |
089 | if strWindowName is "Voice Control" then |
090 | exit repeat |
091 | else |
092 | delay 0.5 |
093 | end if |
094 | end repeat |
AppleScriptで生成しました |
| 固定リンク