tell application "System Events"
repeat
set pList to name of every process whose visible is true and frontmost is true
if (pList = {"Finder"}) then
my front_app()
else if (pList = {"System Preferences"}) then
my quiet_app()
else
my other_app()
end if
--何秒おきに監視するかの秒数
delay 3
end repeat
end tell
--システム環境設定を開いている間は何もしない
on quiet_app()
end quiet_app
--Finderがアクティブの場合
on front_app()
my open_pref()
my open_univ()
tell application "System Events"
if UI elements enabled then
tell slider "カーソルのサイズ:" of tab group 1 of window "ユニバーサルアクセス" of application process "System Preferences"
set value to 4
end tell
end if
end tell
end front_app
--他がアクティブの場合
on other_app()
my open_pref()
my open_univ()
tell application "System Events"
tell slider "カーソルのサイズ:" of tab group 1 of window "ユニバーサルアクセス" of application process "System Preferences"
set value to 1
end tell
end tell
end other_app
--システム環境設定 > マウス を開く動作
on open_pref()
tell application "System Preferences"
set current pane to pane "com.apple.preference.mouse"
end tell
end open_pref
--システム環境設定 > ユニバーサルアクセス を開く動作
on open_univ()
tell application "System Preferences"
set current pane to pane "com.apple.preference.universalaccess"
end tell
end open_univ
tell application "System Events"
repeat
set pList to name of every process whose visible is true and frontmost is true
if (pList = {"Finder"}) then
my front_app()
else
my other_app()
end if
--何秒おきに監視するかの秒数
delay 3
end repeat
end tell
--Finderがアクティブの場合
on front_app()
my open_pref()
my open_univ()
tell application "System Events"
if UI elements enabled then
tell slider "カーソルのサイズ:" of tab group 1 of window "ユニバーサルアクセス" of application process "System Preferences"
set value to 4
end tell
end if
end tell
end front_app
--他がアクティブの場合
on other_app()
my open_pref()
my open_univ()
tell application "System Events"
tell slider "カーソルのサイズ:" of tab group 1 of window "ユニバーサルアクセス" of application process "System Preferences"
set value to 1
end tell
end tell
end other_app
--システム環境設定 > マウス を開く動作
on open_pref()
tell application "System Preferences"
set current pane to pane "com.apple.preference.mouse"
end tell
end open_pref
--システム環境設定 > ユニバーサルアクセス を開く動作
on open_univ()
tell application "System Preferences"
set current pane to pane "com.apple.preference.universalaccess"
end tell
end open_univ