First of all I think the template for editing the hosts is great.
Subsequent code sections did not work for me. The command setAlias requires that an entry already exists in the hosts. In my opinion it should be called setHosts which worked for me.
[PatchHosts_add] setAlias %website%
[PatchHosts_remove] delAlias %website%
You have a point - I forgot to take into account that the 127.0.0.1 might not exist
I started out with the setHosts, but in my experience the hosts would be overwritten by each other, so that you would end out with just the last line from the blocklist.
I need to figure out a way of using both..
I am actually using this very usefull tool. I encounter some troubles as previously given by Martin.
1) I cannot declare domains if the entry 127.0.0.1 did not exist in the hosts file. After that, if IP 127.0.0.1 without anything else after, is set i can push all domains.
2) When i try to remove all entries, it allways let the firt line in the blocklist defineded previously. It won't clear all , it stays and is never deleted, but all others entries are removed.
a) example : 127.0.0.1 netflix.com
3) Then if I modify list in blocklist file, and i push again the script, the first entry in hosts file is not overwritten but added … so if i do that many times for example i had that in host file :
a) 127.0.0.1 netflix.com netflix.com www.netflix.com bho.com www.bho.com crave.ca www.crave.ca movies.disney.com www.movies.disney.com disneyplus.com www.disneyplus.com wetransfer.com thepiratebay.org b) I noted that space between domains is not the same, is that due to tab spaces or something else ? c) I find that domains are not written in list but all on the same line (is that a normal way or not ?)
Thanks a lot for your help. Asks me if in can give you more informations about my issues to help to increase the script.