Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. if runningProcess("Safari") then
  2.  
  3.  
  4. set defaultLanguage to defaultLanguageCheck()
  5. tell application "System Events"
  6. tell process "Safari"
  7. activate
  8. set frontmost to true
  9. if defaultLanguage is "ja" then
  10. click menu bar 1's menu bar item "開発"
  11. click menu item "機能拡張を無効にする" of menu 1 of menu bar 1's menu bar item "開発"
  12. else if defaultLanguage is "en" then
  13. click menu bar 1's menu bar item "Develop"
  14. click menu item "Disable Extensions" of menu 1 of menu bar 1's menu bar item "Develop"
  15. end if
  16. end tell
  17. end tell
  18. end if
  19.  
  20.  
  21. on defaultLanguageCheck()
  22. try
  23. set aRes to paragraphs of (do shell script " defaults read -g AppleLanguages")
  24. set defaultLangurage to item 2 of aRes
  25. set bRes to repChar(defaultLangurage, ",", "") of me
  26. set cRes to repChar(bRes, " ", "") of me
  27. return cRes
  28. on error
  29. return "error"
  30. end try
  31. end defaultLanguageCheck
  32.  
  33.  
  34. --Written By Philip Aker
  35. --文字置換ルーチン
  36. on repChar(origText, targStr, repStr)
  37. set {txdl, AppleScript's text item delimiters} to {AppleScript's text item delimiters, targStr}
  38. set temp to text items of origText
  39. set AppleScript's text item delimiters to repStr
  40. set res to temp as text
  41. set AppleScript's text item delimiters to txdl
  42. return res
  43. end repChar
  44.  
  45.  
  46. on runningProcess(appName) --return true or false
  47.  
  48. tell application "System Events"
  49.  
  50. if application process appName exists then
  51. return true
  52. else
  53. return false
  54. end if
  55.  
  56. end tell
  57.  
  58. end runningProcess
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement