Simple Request - How to Open

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jamesbos
Posts: 1
Joined: 23 Mar 2017, 18:26

Simple Request - How to Open

23 Mar 2017, 18:32

I'm trying to create an automated reminder system which is triggered when I visit a certain domain.

For example, (using Chrome) if I visit http://www.youtube.com, then the script recognize the URL and opens a new window in response (another URL, perhaps containing with some text or an image of the reminder).

Any ideas on how to do this easily and simply? I've searched around, but alas I didn't find what I was looking for :(
A_AhkUser
Posts: 1147
Joined: 06 Mar 2017, 16:18
Location: France
Contact:

Re: Simple Request - How to Open

23 Mar 2017, 19:34

If your using Chrome you better off make a chrome extension
don't know if you searching for an autohotkey solution except for all others. so here's an option making your own simple chrome extension.
don't considerate this as a definitive option there's maybe
something here who know a to do this using autohotkey (and, in fact, sure it can be done a priori with it) but if you're using chrome
I think a better option and the more reliable is using native option.

create a directory @ desktop call it test, create file call it manifest.json, here's its content:

Code: Select all

{
"manifest_version": 2,
"name": "test",
"description": "",
"version": "0.1",
"content_scripts": [{"matches": ["https://www.youtube.com/*"],"js": ["script.js"],"run_at": "document_end"}]
}
see https://developer.chrome.com/extensions/manifest for manifest file.

create an another file, again within the test directory, call it script.js. this script will be called when you'll navigate to https://www.youtube.com/ as
you can see in the manifest file. for exemple its content could be the javascript:

Code: Select all

alert("you visit YouTube!");
Navigate to chrome://extensions/ from your Chrome browser. Make sure the Developer mode is enabled.
Click the load unpacked extension button and select the test folder in your
computer in order to deploy the folder's extension in your browser.


navigate to https://www.youtube.com/ it will display a message box saying you're visiting Youtube. Hope this helps


EDIT: if you explore for an autohotkey solution with function to get the URL of the current (active) browser tab https://autohotkey.com/boards/viewtopic.php?t=3702 (linked by jeeswg in another forum thread -- see: https://autohotkey.com/boards/viewtopic.php?t=26947)
Once you can get the url of the current active tab you'll just have to monitor your code using anifstatement depending on url.
my scripts

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Joey5, just me and 214 guests