Of course I could not get that to work at all, because it stops with an error that warned that that "function does not exist"...
So, as usual I begin to do the massive SEARCH for this function... I may be incorrect, but my guess would be that I would need to find that *ahk and #Include it before I could access it...
I found some (what was labeled as Test Area code) here: Dated back in 2011
https://autohotkey.com/board/topic/6436 ... re-object/
I copied that and saved it as ExploreObj.ahk and included it....
As I run the code, and am getting a ton of message windows regarding Keys and Values, but NO actual values are being output to the Debug Window.
Just these windows:
Further details... I am using his code that he gives the examples for which point to his website page, which of course I am also using for testing..
His site:
http://the-automator.com/
And here is the code:
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
;~ #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
;SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#Include ../Chrome.ahk
#Include ExploreObj.ahk
#Include %A_ScriptDir%
for Index, Tab in Chrome.GetTabs()
MsgBox, % "type: " Tab.type "`nurl: " Tab.url
Tab := Chrome.GetTab() ;Connect to Active tab
;********************Methd: Class, Tag, Name, ID **** ***********************************
data:=Chm_Get(Tab,Method:="class",Attribute:="widget-title",Index:=1)
;MsgBox % data.InnerText
;DebugWindow(ExploreObj(obj),1,1,200,0)
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
}
The output I am getting is JUST the labels:...
Debug Window
InnerText =
OuterHTML =
TextContent =
Value =
Hmmmmm.. Any Ideas how I can make sure that I actually have the correct Include or Function... Or am I completely off the reservation here and totally incorrect
Thanks!