Autohotkey IE sending info to page problem Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Axxi
Posts: 15
Joined: 02 Apr 2020, 10:56

Autohotkey IE sending info to page problem

02 Apr 2020, 11:02

Hi!

I am trying to automate some browser tasks with IE/Chrome, but there's this one website that i just cant seem to send information/keys to.

The website is https www.pacsoftonline.se / Broken Link for safety , i am just trying to enter username/password into the fields for automating login, but i just cant seem to match the name/tag-arrays that the website is giving me.

Im literally using the most basic script ever, but i even tried it using selenium with chrome but same problem occured where it says that it cannot match the name on the website. Ill post my simple code below:

Please let me know if u manage to get this website to work, other websites work perfectly.


Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases. ;*[Ny IE - kopia]
; #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.

f8::

pwb := WBGet()

Var:=pwb.document.GetElementsByName("CompanyLogin")[0].Value ;Object Name- Get array value
Var:=pwb.document.GetElementsByTagName("INPUT")[8].Value ;Get Tagname and Array value

msgbox, %var%



;FUNCTIONS BELOW

;************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)
		}
	}
}
gregster
Posts: 4921
Joined: 30 Sep 2013, 06:48

Re: Autohotkey IE sending info to page problem  Topic is solved

03 Apr 2020, 08:32

Welcome to the forums!

You have to realize that you are dealing with frames here - in this case, the login field is in a frame named outer:

Code: Select all

pwb := ComObjCreate( "InternetExplorer.Application" )
pwb.visible := true
pwb.navigate("https://www.pacsoftonline.se/")
return

F8::
outer := pwb.document.parentWindow.frames["outer"]
outer.document.GetElementsByName("CompanyLogin")[0].Value := "test"
var := outer.document.GetElementsByName("CompanyLogin")[0].Value
msgbox, %var%
ExitApp
Axxi
Posts: 15
Joined: 02 Apr 2020, 10:56

Re: Autohotkey IE sending info to page problem

03 Apr 2020, 08:47

gregster wrote:
03 Apr 2020, 08:32
Welcome to the forums!

You have to realize that you are dealing with frames here - in this case, the login field is in a frame named outer:

Code: Select all

pwb := ComObjCreate( "InternetExplorer.Application" )
pwb.visible := true
pwb.navigate("https www.pacsoftonline.se /")  Broken Link for safety
return

F8::
outer := pwb.document.parentWindow.frames["outer"]
outer.document.GetElementsByName("CompanyLogin")[0].Value := "test"
var := outer.document.GetElementsByName("CompanyLogin")[0].Value
msgbox, %var%
ExitApp

Thank you for the solution, ill look into this more to try and understand what it all means. :thumbup: :thumbup:

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], kiwiboost, teadrinker, Xtra and 66 guests