Problem Using COM to set text in Username Topic is solved

Get help with using AutoHotkey and its commands and hotkeys

Problem Using COM to set text in Username

25 Apr 2016, 16:20

Hi Everyone

I have been trying to sort this problem out for over one week now and going around in circles too as I have looked at many of the posts on this matter but I still cannot seem to be able to manipulate control boxes when the active window spy gives little data as in the case with my example which is to try and auto fill the Facebook login ID.
Once I have a solution to this control I will of course be able to do the same with the password control box and the submit button.

Here is what I have at present but I am not sure it is even getting focus at the moment

Hope someone can help here.

Code: Select all

If !IsObject(pwb)
	pwb := ComObjCreate("InternetExplorer.Application")

If !IsObject(ie)
	ie := ComObjCreate("InternetExplorer.Application")
ie.Visible := true
ControlFocus, Internet Explorer_Server8, Facebook - Log In or Sign Up - Internet Explorer
ControlSetText, Internet Explorer_Server8, MyloginName, Facebook - Log In or Sign Up - Internet Explorer

	While !(Pwb.busy)
		Sleep, 100
	While (Pwb.busy)
		Sleep, 100
	While !(Pwb.document.Readystate = "Complete")
		Sleep, 100
User avatar
Posts: 5239
Joined: 21 Dec 2014, 02:44

Re: Problem Using COM to set text in Username  Topic is solved

25 Apr 2016, 22:47

You're not really using COM when you use ControlFocus and ControlSetText. You want to assign the contents of that field by identifying an element in the DOM, whether it's by ID or whatever. You don't get that info by using the window spy but rather by looking at the HTML source, using the DOM explorer (press F12 in IE), or using one of the tools like iWB2 Learner.

Return to “Ask For Help”

Who is online

Users browsing this forum: boiler, gecko, Google [Bot], Ian, metatron, PuzzledGreatly, tee_rock and 350 guests