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

05: Automating Chrome with AutoHotkey & getting data from page (part 1)

Automating Chrome with AutoHotkeyWhen GeekDude and I recorded this topic, it was over an hour long so I broke it into two parts.  This session covers how to get content from a page.

The great news is that GeekDude explained how we can see the Reddit site the way it was the below video!

By logging into https://old.reddit.com/r/AutoHotkey/, the HTML will be the same as in the video!

Automating Chrome with AutoHotkey & getting data from page


donate to GeekDudeIf you’re loving this, please consider donating to GeekDude!
Notes from Automating Chrome with AutoHotkey & getting data from page

Scraping data with Chrome and AutoHotkey

00:30     Let’s scrape from the AutoHotkey subreddit  https://www.reddit.com/r/AutoHotkey/

00:42     Maybe you want to get all of the links to the comment section.  Or maybe the titles for all of them for text analysis.

Continue reading

AutoHotkey Webinar- SQLite3 with AutoHotkey

SQLite3 with AutoHotkeyIn today’s webinar Jean Lalonde, author of Quick Access Popup, lead us through a demonstration how to use SQLite with AutoHotkey.

Video Hour 1:  High level overview

Video Hour 2: Continue overview and Q&A

Script Highlight: This was actually a “website” highlight.  Skrommel’s 1-hour Software is a great site with 116 examples of scripts that can manipulate various tasks on Windows.  His code is available both as an executable as well as the AutoHotkey source files.

SQLite3 with AutoHotkey

Here is a link to the SQLite3 with AutoHotkey files Jean shared and reviewed below

–SQLite files:

–Class_SQLiteDB library (by just me)

–Utility DB Browser for SQLite

SQLite-First_Example.ahk

  • Open an existing database

–Display error report

  • Query the database
    • in a RecordSet with Query()
    • in a Table with GetTable()
  • Execute various commands
    • Insert rows into a table
    • Delete rows

 

BLOB_Sample.ahk

  • Store and retrieve binary large objects (BLOB)

SQLite-TheBeatles.ahk

  • Create a new database
  • Create table and indexes
  • Insert multiple rows (import)
  • Display in a ListView with GetTable
  • Execute various commands
    • Alter table (add columns)
    • Vacuum the database

Using transactions

  • BEGIN TRANSACTION;
  • ROLLBAK:
  • COMMIT:

Automating Chrome with AutoHotkey: Getting InnerText, OuterHTML & Values

AutoHotkey Merchandise-White Stress ballBeing able to Automate Chrome has been a long-time goal of mine.  With GeekDude’s Chrome.ahk Class you now can do this.  Read more about his class on the AHK forum here.

If you didn’t see it, also check out my other tutorial on Setting values with Chrome and AutoHotkey.

 

Here is the function I demonstrate in the below video on Automating Chrome with AutoHotkey: Getting InnerText, OuterHTML & Values
Tab := Chrome.GetTab() ;Connect to Active tab

;********************Methd: Class, Tag, Name, ID **** ***********************************
data:=Chm_Get(Tab,Method:=”Name”,Attribute:=”s”,Index:=2)
;~ MsgBox % data.InnerText
DebugWindow(ExploreObj(data),1,1,200,0)

;********************Method: Class, Tag, Name, ID **** ***********************************
;********************Get Property***********************************
Chm_Get(Tab,Method=”Class”,Attribute=”hfeed”,Index=1){
Obj:={}
;***********Class*******************
if (Format(“{:L}”,Method)=”class”){ ;Case-insensitive check to see if method = Class
Obj.OuterHTML:= Tab.Evaluate(“document.getElementsByClassName(‘” Attribute “‘)[” Index-1 “].outerHTML”).Value
Obj.Value:= Tab.Evaluate(“document.getElementsByClassName(‘” Attribute “‘)[” Index-1 “].value”).Value
Obj.InnerText:= Tab.Evaluate(“document.getElementsByClassName(‘” Attribute “‘)[” Index-1 “].innerText”).Value
Obj.TextContent:= Tab.Evaluate(“document.getElementsByClassName(‘” Attribute “‘)[” Index-1 “].textContent”).Value
} ;***********Tag*******************
Else if (Format(“{:L}”,Method)=”tag”){ ;Case-insensitive check to see if method = Tag
Obj.OuterHTML:= Tab.Evaluate(“document.getElementsByTagName(‘” Attribute “‘)[” Index-1 “].outerHTML”).Value
Obj.Value:= Tab.Evaluate(“document.getElementsByTagName(‘” Attribute “‘)[” Index-1 “].value”).Value
Obj.InnerText:= Tab.Evaluate(“document.getElementsByTagName(‘” Attribute “‘)[” Index-1 “].innerText”).Value
Obj.TextContent:= Tab.Evaluate(“document.getElementsByTagName(‘” Attribute “‘)[” Index-1 “].textContent”).Value
} ;************Name******************
Else if (Format(“{:L}”,Method)=”name”){ ;Case-insensitive check to see if method = Name
Obj.OuterHTML:= Tab.Evaluate(“document.getElementsByName(‘” Attribute “‘)[” Index-1 “].outerHTML”).Value
Obj.Value:= Tab.Evaluate(“document.getElementsByName(‘” Attribute “‘)[” Index-1 “].value”).Value
Obj.InnerText:= Tab.Evaluate(“document.getElementsByName(‘” Attribute “‘)[” Index-1 “].innerText”).Value
Obj.TextContent:= Tab.Evaluate(“document.getElementsByName(‘” Attribute “‘)[” Index-1 “].textContent”).Value
} ;***********ID*******************
Else if (Format(“{:L}”,Method)=”id”){ ;Case-insensitive check to see if method = ID
Obj.OuterHTML:= Tab.Evaluate(“document.getElementById(‘” Attribute “‘).outerHTML”).Value
Obj.Value:= Tab.Evaluate(“document.getElementById(‘” Attribute “‘).value”).Value
Obj.InnerText:= Tab.Evaluate(“document.getElementById(‘” Attribute “‘).innerText”).Value
Obj.TextContent:= Tab.Evaluate(“document.getElementById(‘” Attribute “‘).textContent”).Value
} Else{ MsgBox fix Attribute- Valid values are: Name, Class, Tag, ID
}
return obj
}

 

 

 

Video Tutorial Automating Chrome with AutoHotkey: Getting InnerText, OuterHTML & Values

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