• Intro to AutoHotkey HotStrings with AutoHotkey Intermediate AutoHotkey GUIs are Easy with AutoHotkey Intro to DOS & AutoHotkey

AutoHotkey Webinar- Advanced Web Scraping with AutoHotkey

Advanced Web Scraping with AutoHotkeyToday’s AutoHotkey Webinar on Advanced Web Scraping with AutoHotkey we covered some “fun” topics.   We also demonstrated using Visual Events 2 to detect Event Listeners on a page

Video Hour 1: High-level overview

Video Hour 2: Q&A

Be sure to grab our Web scraping syntax writer

Script highlight

; Stupid simple webScraping with AutoHotkey
Send, ^a ;Select All
sleep, 50
Send, ^c ;copy
sleep, 50
Clipboard:=StrSplit(Clipboard,”:”).1 ;split the clipboard on the colon and return everything to the left of the first one
Send, ^v ;paste
sleep, 350
Send, {tab 4} ;tab to the next field where I need to re-run

We also showed a bit about dealing with Try and using .item[0] in the DOM call. i.e. instead of using

pwb.document.getElementsByClassName(“feed”)[0].InnerText
use
pwb.document.getElementsByClassName(“feed”).item[0].InnerText
This way, if an element doesn’t exist, it will not error out.

To wait for it to be present you could do this

while (pwb.document.getElementsByClassName(“feed-identity-module__stat link-without-visited-state”).length < 3){
ToolTip, Here
Sleep, 50
Cap’n Odin offered up these two gems.  The first will close all running AutoHotkey scripts and the second one will pause them.

; Close all AutoHotkey scripts
DetectHiddenWindows On
Winget, lst, List, ahk_exe autohotkey.exe

loop % lst {
hwnd := lst%A_Index%
if(hwnd != A_ScriptHwnd) {
WinClose, % “ahk_id ” hwnd
}
return

; pause all AutoHotkey scripts
DetectHiddenWindows On
SetTitleMatchMode, 2
Winget, lst, List, AutoHotkey ahk_exe autohotkey.exe

loop % lst {
hwnd := lst%A_Index%
if(hwnd != A_ScriptHwnd) {
PostMessage, 0x111, 65306, , , % “ahk_id ” hwnd
}
}

Paste plain text- Use 7 lines of AutoHotKey to easily strip complex RTF/HTML formatting

Paste plain text

I (AutoHotkey Bottle 1like everyone else in the world) frequently copy-paste between various programs. While some programs like Word and Excel allow for paste plain text, a lot do not.

Paste plain text

I wrote a small script in AutoHotKey which takes the contents of the clipboard and strips it of HTML/RTF format. This way it allows me to paste as plain text in any program by hitting a key combination (Control+G).  What’s great is that I don’t actually lose the original format so, if I decide I actually wanted the original content, I can still just paste with Control+V and I’m good to go!

Below is the actual code to paste plain text in AutoHotKey.

paste plain text

  • Intro to AutoHotkey HotStrings with AutoHotkey Intermediate AutoHotkey GUIs are Easy with AutoHotkey Intro to DOS & AutoHotkey