Can AHK copy to clipboard the webpage title and url in markdown format? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
cadudesun
Posts: 129
Joined: 04 Jun 2016, 10:26

Can AHK copy to clipboard the webpage title and url in markdown format?

10 Feb 2020, 19:42

Hi,

I'd appreciate your assistance.

For the webpage "https://www.autohotkey.com/" loaded on Google Chrome, can I trigger an AutoHotkey script to copy the webpage title and url in markdown format?

The expected result would be:

[AutoHotkey](https://www.autohotkey.com/)

Thank you very much!
nou
Posts: 26
Joined: 24 Feb 2019, 21:21

Re: Can AHK copy to clipboard the webpage title and url in markdown format?

10 Feb 2020, 23:55

Yes. It can.

You can use WinGetTitle or something to get the title.

You can google "Get current URL with AHK".

Then you can use the "Send" command to type whatever you need, however you need.
User avatar
Yakshongas
Posts: 590
Joined: 21 Jan 2020, 08:41

Re: Can AHK copy to clipboard the webpage title and url in markdown format?

11 Feb 2020, 09:55

I think this is what you are asking for.

Code: Select all

F1::
SendEvent, {Control Down}
SendInput, l
Sleep, 200
SendInput, c
SendEvent, {Control Up}
WinGetActiveTitle, Titulo
Run, Notepad.exe
Sleep, 300
SendRaw, [
Send, %Titulo%
SendRaw, ]
Send, {Space} (
Send, %clipboard%
SendRaw, )
SendEvent, {Control Down}
Send, e
Send, c
SendEvent, {Control Up}
WinKill, ahk_exe Notepad.exe
Sleep, 450
SendInput, n
MsgBox, Copied %clipboard%
return

Please mark your topics as solved if you don't need any further help. ✅

Need a little more help? Discord : Yakshongas#9893 🕹
teadrinker
Posts: 4330
Joined: 29 Mar 2015, 09:41
Contact:

Re: Can AHK copy to clipboard the webpage title and url in markdown format?  Topic is solved

11 Feb 2020, 10:13

@Yakshongas, no, no, no! As you like, but not like this! :shock:

Code: Select all

#If WinActive("ahk_class Chrome_WidgetWin_1 ahk_exe chrome.exe")
$F1::
   Clipboard := ""
   Send ^l
   while !Clipboard {
      Sleep, 50
      Send ^c
   }
   Send {End}
   WinGetActiveTitle, title
   Clipboard := "[" . title . "](" . Clipboard . ")"
   MsgBox, % Clipboard
   Return
User avatar
Yakshongas
Posts: 590
Joined: 21 Jan 2020, 08:41

Re: Can AHK copy to clipboard the webpage title and url in markdown format?

11 Feb 2020, 11:00

@teadrinker
Lol your Script looks smooth AF!
I still have so much to learn, :crazy:
Please mark your topics as solved if you don't need any further help. ✅

Need a little more help? Discord : Yakshongas#9893 🕹
cadudesun
Posts: 129
Joined: 04 Jun 2016, 10:26

Re: Can AHK copy to clipboard the webpage title and url in markdown format?

11 Feb 2020, 13:21

Thanks all for the replies!
The last script deliveries exactly what I was looking for.
flacito
Posts: 44
Joined: 06 Oct 2019, 11:43

Re: Can AHK copy to clipboard the webpage title and url in markdown format?

19 Sep 2021, 15:48

teadrinker wrote:
11 Feb 2020, 10:13
@Yakshongas, no, no, no! As you like, but not like this! :shock:

Code: Select all

#If WinActive("ahk_class Chrome_WidgetWin_1 ahk_exe chrome.exe")
$F1::
   Clipboard := ""
   Send ^l
   while !Clipboard {
      Sleep, 50
      Send ^c
   }
   Send {End}
   WinGetActiveTitle, title
   Clipboard := "[" . title . "](" . Clipboard . ")"
   MsgBox, % Clipboard
   Return
This is great. Thank you!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, inseption86, jaka1 and 426 guests