Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if runningProcess("Safari") then
- set defaultLanguage to defaultLanguageCheck()
- tell application "System Events"
- tell process "Safari"
- activate
- set frontmost to true
- if defaultLanguage is "ja" then
- click menu bar 1's menu bar item "開発"
- click menu item "機能拡張を無効にする" of menu 1 of menu bar 1's menu bar item "開発"
- else if defaultLanguage is "en" then
- click menu bar 1's menu bar item "Develop"
- click menu item "Disable Extensions" of menu 1 of menu bar 1's menu bar item "Develop"
- end if
- end tell
- end tell
- end if
- on defaultLanguageCheck()
- try
- set aRes to paragraphs of (do shell script " defaults read -g AppleLanguages")
- set defaultLangurage to item 2 of aRes
- set bRes to repChar(defaultLangurage, ",", "") of me
- set cRes to repChar(bRes, " ", "") of me
- return cRes
- on error
- return "error"
- end try
- end defaultLanguageCheck
- --Written By Philip Aker
- --文字置換ルーチン
- on repChar(origText, targStr, repStr)
- set {txdl, AppleScript's text item delimiters} to {AppleScript's text item delimiters, targStr}
- set temp to text items of origText
- set AppleScript's text item delimiters to repStr
- set res to temp as text
- set AppleScript's text item delimiters to txdl
- return res
- end repChar
- on runningProcess(appName) --return true or false
- tell application "System Events"
- if application process appName exists then
- return true
- else
- return false
- end if
- end tell
- end runningProcess
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement