To check if file is opened in browser and then activate the corresponding tab

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
john_c
Posts: 493
Joined: 05 May 2017, 13:19

To check if file is opened in browser and then activate the corresponding tab

29 Nov 2019, 12:21

Is there a simple way to check whether the specified Markdown file is already opened in Chrome? (Or another browser)

* In case the target file is not currently opened in Chrome - open it in Chrome.
* In case the target file is already opened in Chrome - activate Chrome at the specified tab.

Yes, I understand that this task is probably large and/or complicated. And thus, it will not be polite to expect that someone will publish entire code. However any ideas and drafts are welcome. It is possible that there exist some AHK library or community function for it.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: To check if file is opened in browser and then activate the corresponding tab

29 Nov 2019, 15:18

If the tab name is sufficient to identify the file, you could use this:

Firefox/Chrome, get tab names/focus tab - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26947

If you need the url to identify the file, you could download a plugin to copy titles/urls to the clipboard, and parse the clipboard text, and then use the functions above:

Firefox/Chrome: copy titles/urls to the clipboard - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=22&t=66246

Otherwise you could use SendInput, ^{Tab}, Sleep, and WinGetTitle.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], peter_ahk and 332 guests