Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Created July 13, 2020 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoeGlines/0e1f4aac78c1070163367e8659b0dbfa to your computer and use it in GitHub Desktop.
Save JoeGlines/0e1f4aac78c1070163367e8659b0dbfa to your computer and use it in GitHub Desktop.
Extract Pagename and Group from Site Catalyst
;~ Automate Extracting tracking codes from HTML pages
pwb:=WBGet()
text := pwb.document.documentElement.innerHTML
url:=pwb.locationURL
RegExMatch(text,"tiPageName\s?=\s?""(.*?)"";",Page_Name) ; making it greedy so it gets the last one,not the first one
StringLower,Page_Name1,Page_Name1
RegExMatch(text,"tiContentGroup\s?=\s?""(.*?)"";",Content_Group) ; making it greedy so it gets last one
StringLower,Content_Group1,Content_Group1
Clipboard:=Page_Name1 ; "`t" Content_Group1 "`t" URL
MsgBox,,Pagename is on Clipboard, % "Pagename: " Page_Name1 "`r`n`r`nContent Group: " Content_Group1
;************Pointer to Open IE Window******************
WBGet(WinTitle="ahk_class IEFrame", Svr#=1) { ;// based on ComObjQuery docs
static msg := DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT")
, IID := "{0002DF05-0000-0000-C000-000000000046}" ;// IID_IWebBrowserApp
;// , IID := "{332C4427-26CB-11D0-B483-00C04FD90119}" ;// IID_IHTMLWindow2
SendMessage msg, 0, 0, Internet Explorer_Server%Svr#%, %WinTitle%
if (ErrorLevel != "FAIL") {
lResult:=ErrorLevel, VarSetCapacity(GUID,16,0)
if DllCall("ole32\CLSIDFromString", "wstr","{332C4425-26CB-11D0-B483-00C04FD90119}", "ptr",&GUID) >= 0 {
DllCall("oleacc\ObjectFromLresult", "ptr",lResult, "ptr",&GUID, "ptr",0, "ptr*",pdoc)
return ComObj(9,ComObjQuery(pdoc,IID,IID),1), ObjRelease(pdoc)
}
}
}
;~ If you get value out of this video... https://www.paypal.me/JoeGlines
;~ Check out more of my scripts at: http://the-automator.com Joe Glines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment