My first #Applescript for blocking Ads via the hosts-file on Mac - TopicsExpress



          

My first #Applescript for blocking Ads via the hosts-file on Mac OS X v:1.0 --tell application "Safari" -- set theURL to URL of front document -- set the clipboard to theURL as string --end tell tell application "Terminal" activate do script "sudo -k vi + /etc/hosts" end tell delay 7 tell application "Terminal" activate tell application "System Events" keystroke "o" keystroke "127.0.0.1 " keystroke "v" using command down key code 53 keystroke "." using shift down key code 23 using shift down keystroke "s" key code 26 using shift down keystroke "http" key code 26 using {shift down, option down} keystroke "." using shift down key code 26 using {shift down, option down} key code 26 using shift down key code 26 using {shift down, option down} key code 26 using shift down key code 26 using shift down key code 26 using shift down keystroke "g" & return keystroke "." using shift down key code 23 using shift down keystroke "s" key code 26 using shift down keystroke "https" key code 26 using {shift down, option down} keystroke "." using shift down key code 26 using {shift down, option down} key code 26 using shift down key code 26 using {shift down, option down} key code 26 using shift down key code 26 using shift down key code 26 using shift down keystroke "g" & return keystroke "." using shift down keystroke "wq" & return end tell delay 7 do script "sudo dscacheutil -flushcache" in window 1 delay 7 tell application "System Events" keystroke "w" using command down keystroke "q" using command down end tell end tell
Posted on: Thu, 25 Jul 2013 20:30:53 +0000

Trending Topics



Recently Viewed Topics




© 2015