Page 1 of 1

Can AHK Copy page title and url?

Posted: 04 May 2019, 00:37
by ButterZ
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

Re: Can AHK Copy page title and url?

Posted: 05 May 2019, 12:26
by garry
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

Re: Can AHK Copy page title and url?

Posted: 05 May 2019, 17:40
by jeeswg
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

Re: Can AHK Copy page title and url?

Posted: 06 May 2019, 02:26
by garry
jeeswg, thank you for the examples also for chrome and internetexplorer