tell application "System Preferences" to activate
tell application "System Events"
repeat 7 times
if exists menu item "キーボード" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "System Preferences" then exit repeat
delay 1
end repeat
click menu item "キーボード" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "System Preferences"
delay 1
click radio button "ユーザ辞書" of tab group 1 of window "キーボード" of application process "System Preferences"
set string_ to ""
repeat with row_ in rows of table 1 of scroll area 1 of tab group 1 of window "キーボード" of application process "System Preferences" as list
set string_ to string_ & value of text field 1 of UI element 1 of row_ & tab as string
set string_ to string_ & value of text field 1 of UI element 2 of row_ & return as string
end repeat
end tell
tell application "TextEdit" to make new document at beginning with properties {text:string_ as string}
●このスクリプトの内容(環境設定→ユーザー辞書登録.scpt)
tell application "System Preferences" to activate
tell application "System Events"
repeat 7 times
if exists menu item "キーボード" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "System Preferences" then exit repeat
delay 1
end repeat
click menu item "キーボード" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "System Preferences"
delay 1
click radio button "ユーザ辞書" of tab group 1 of window "キーボード" of application process "System Preferences"
end tell
tell application "TextEdit" to set string_ to text of first document as string
tell application "System Events"
repeat with line_ in paragraphs of string_ as list
if line_ as string is not "" and (offset of tab in line_) is not 0 then
set my text item delimiters to tab
click button 1 of group 1 of tab group 1 of window "キーボード" of application process "System Preferences"
delay 1
--keystroke tab
set value of text field 1 of UI element 1 of last row of table 1 of scroll area 1 of tab group 1 of window "キーボード" of application process "System Preferences" to first text item of line_ as string
keystroke tab
set value of text field 1 of UI element 2 of last row of table 1 of scroll area 1 of tab group 1 of window "キーボード" of application process "System Preferences" to last text item of line_ as string
keystroke return
delay 1
select last row of table 1 of scroll area 1 of tab group 1 of window "キーボード" of application process "System Preferences"
end if
end repeat
end tell