Remove part of URL from Chrome with macro/script
Posted: 04 Feb 2020, 06:15
Hi!
Our network manager has implemented a rule that forbids us to go to web pages via the ad.doubleclick.net adware links that prefix many web URL's that is ads in Google Chrome. My thought was that it would be nice to simply run a AutoHotkey macro once this happens to remove the ad.doubleclick.net-part of the string and resend, since the URLs I want go to always are at the end of the URLs and can be stripped out via regex or similar.
The problem is that I am no AutoHotkey script expert and don't know how to do this.
Is this very complicated or can it be achieved relatively easy?
Here is what I want to do:
1. Jump to the browser (Chrome) address line. The Chrome pane name always ends with the text "Chrome-sok" and will also always be the current, active window
2. Mark the entire URL
3. Process it with regex_replace or similar to end up with just the end part containing the https some_url_not being the_adware-url.
4. This regex should do it: (?<=ad.doubleclick.net.*)(http.*)
5. Send a CRLF to the browser
6. Assign the above to a hotkey combo so I can press it whenever the ad.doubleclick.net warning message shows up from our servers. This could also easily be expanded to handle other adware sites by adding site|site|site etc. in the regex look-behind.
All help is grately appreciated!
Brgds
IVerE in Oslo
Our network manager has implemented a rule that forbids us to go to web pages via the ad.doubleclick.net adware links that prefix many web URL's that is ads in Google Chrome. My thought was that it would be nice to simply run a AutoHotkey macro once this happens to remove the ad.doubleclick.net-part of the string and resend, since the URLs I want go to always are at the end of the URLs and can be stripped out via regex or similar.
The problem is that I am no AutoHotkey script expert and don't know how to do this.
Is this very complicated or can it be achieved relatively easy?
Here is what I want to do:
1. Jump to the browser (Chrome) address line. The Chrome pane name always ends with the text "Chrome-sok" and will also always be the current, active window
2. Mark the entire URL
3. Process it with regex_replace or similar to end up with just the end part containing the https some_url_not being the_adware-url.
4. This regex should do it: (?<=ad.doubleclick.net.*)(http.*)
5. Send a CRLF to the browser
6. Assign the above to a hotkey combo so I can press it whenever the ad.doubleclick.net warning message shows up from our servers. This could also easily be expanded to handle other adware sites by adding site|site|site etc. in the regex look-behind.
All help is grately appreciated!
Brgds
IVerE in Oslo