Guest User

Untitled

a guest
Jun 8th, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. set x to isAppLoaded("Python")
  2. if x then
  3. tell application "System Events"
  4. tell application process "Terminal"
  5. set frontmost to true
  6. keystroke "c" using control down
  7. end tell
  8. end tell
  9. tell application "Terminal" to quit
  10. else
  11. tell application "Terminal"
  12. do script "sh /PATH TO YOUR AAFMTRIGGERHELPER FILE/aafmtriggerhelper.sh"
  13. end tell
  14. tell application "System Events"
  15. tell application process "Terminal"
  16. set frontmost to true
  17. keystroke "h" using command down
  18. end tell
  19. end tell
  20.  
  21. repeat
  22. tell application "System Events"
  23. if (exists (application process "Python")) then
  24. exit repeat
  25. end if
  26. end tell
  27. end repeat
  28.  
  29. repeat
  30. tell application "System Events"
  31. if visible of process "Python" is false then
  32. set visible of process "Python" to true
  33. end if
  34. end tell
  35. tell application "System Events"
  36. if visible of process "Python" is true then
  37. exit repeat
  38. end if
  39. end tell
  40. end repeat
  41.  
  42. repeat
  43. tell application "System Events"
  44. if application process "Python" is frontmost then
  45. exit repeat
  46. else
  47. tell application process "Python"
  48. set frontmost to true
  49. end tell
  50. end if
  51. end tell
  52. end repeat
  53.  
  54. end if
  55.  
  56. on isAppLoaded(app_name)
  57. tell application "System Events"
  58. set app_list to every application process whose name contains app_name
  59. if the (count of app_list) > 0 then
  60. return true
  61. else
  62. return false
  63. end if
  64. end tell
  65. end isAppLoaded
Advertisement
Add Comment
Please, Sign In to add comment