Can AHK Copy page title and url?

Get help with using AutoHotkey and its commands and hotkeys
ButterZ
Posts: 3
Joined: 23 Feb 2019, 18:05

Can AHK Copy page title and url?

04 May 2019, 00:37

What I want to do is have a copy of the active page title and page URL copied into a notepad text document or GUI with links. .

I have little experience with AHK I have made a few simple apps, but I don't know how to make this or where to begin.

I started to make a GUI just to give you guys some inspiration and visual idea of what I am working on.


Image
garry
Posts: 1877
Joined: 22 Dec 2013, 12:50

Re: Can AHK Copy page title and url?

05 May 2019, 12:26

Example for browser Firefox
you can add also an input before write to file
use a listview to read the file , click then column-2 to start url

Code: Select all

;- for Mozilla Firefox , copy TITLE and URL from active TAB
;-----------------------------------------------------------
;- MODIFIED = 20190505
;- CREATED  = 20190505
;---------------------
#warn
#NoEnv
DetectHiddenWindows, Off
SetTitleMatchMode, 2
return

;- key win+7
$#7::
KeyWait p
SetTitleMatchMode, 2
If (WinID := WinExist("A"))   ;- active window
{
f1=%a_desktop%\Title_Url_Copied.txt
WinGetTitle, Title, ahk_id %WinID%
if title contains Mozilla
  {
  xxc:=" - Mozilla Firefox"
  stringreplace,title,title,%xxc%,,all
  url      :=""
  Clipboard:=""
  sleep,200
  sendinput,!s            ;- alt+s copies url in mozilla firefox
  sleep,1000
  sendinput, ^c{right}
  sleep,500
  clipwait,
  URL:=clipboard
;  InputBox, UserInput, comments
;   if errorlevel<>0
;      return
  FileAppend,%Title% `;%url%`r`n,%F1%
  Splashimage,,b w900 h150 x100 Y400 CWsilver m9 b fs10 zh0,%title%`n%url%
  Sleep,900
  Splashimage, off
  run,%F1%
  url      :=""
  Clipboard:=""
  return
  }
return
}
return
esc::exitapp
User avatar
jeeswg
Posts: 6724
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Can AHK Copy page title and url?

05 May 2019, 17:40

There's code here to get the title/url for the active tab in Firefox/Chrome:
Firefox/Chrome, get tab names/focus tab - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26947

There's code here to get the titles/urls for all tabs in Internet Explorer:
jeeswg's Internet Explorer and HTML tutorial - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=31766
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
garry
Posts: 1877
Joined: 22 Dec 2013, 12:50

Re: Can AHK Copy page title and url?

06 May 2019, 02:26

jeeswg, thank you for the examples also for chrome and internetexplorer

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], flyingDman and 53 guests