display dialog "Google Chrome を修復します。" & return & return & "修復方を選んでください。" buttons {"最適化する", "リセットする", "キャンセル"} default button 1 with icon caution
copy the result as list to {bp}
if the bp is "最適化する" then
tell application "Google Chrome" to quit
display dialog "Google Chrome をリセットします。" & return & return & "システムファイルを削除しますがよろしいですか?。" default button 1 with icon caution
tell application "Google Chrome" to quit
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Web Data" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Web*Data vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Thumbnails" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Thumbnails vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/History" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/History vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Login Data" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Login*Data vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Archived History" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Archived*History vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Cookies" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Cookies vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Extension" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Extension vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Web Data" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Web*Data reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Thumbnails" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Thumbnails reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/History" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/History reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Login Data" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Login*Data reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Archived History" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Archived*History reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Cookies" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Cookies reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Extension" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Extension reindex" with administrator privileges
end if
end tell
do shell script "sudo rm -rf ~/Library/Caches/Google/Chrome/Default/Cache/ ~/Library/Caches/Google/Chrome/Default/Media*Cache/" with administrator privileges
tell application "Google Chrome" to activate
else if the bp is "リセットする" then
tell application "Google Chrome" to quit
do shell script "sudo rm -rf ~/Library/Application*Support/Google/Chrome/Default/Cookies ~/Library/Application*Support/Google/Chrome/Default/Extension*Web ~/Library/Application*Support/Google/Chrome/Default/History ~/Library/Application*Support/Google/Chrome/Default/History*Index* ~/Library/Application*Support/Google/Chrome/Default/Visited* ~/Library/Application*Support/Google/Chrome/Default/Web*Data ~/Library/Application*Support/Google/Chrome/Default/Thumbnails ~/Library/Application*Support/Google/Chrome/Default/Archived*History ~/Library/Application*Support/Google/Chrome/Default/Current* ~/Library/Application*Support/Google/Chrome/Default/Last*Session ~/Library/Application*Support/Google/Chrome/Default/Last*Tabs ~/Library/Caches/Google/Chrome/Default/Cache/ ~/Library/Caches/Google/Chrome/Default/Media*Cache/ ~/Library/Preferences/com.google.Chrome.plist && sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Login*Data vacuum && sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Login*Data reindex" with administrator privileges
end if
tell application "Google Chrome" to activate