Hi, I thought I would create a script which would automatically fill-in some standard fields on any form on the net by searching for the field text on the page (using COM), then moving to the right to entry field (with sending a Tab) and finally sending a field value.
Unfortunately my example script below only fills some fields but not all so obviously I'm doing something wrong.
Any ideas? Alternatively, could something like this be done without sending keys and only using COM? Thanks!
return F10:: Data:= { "first name":"John", "surname":"Smith", "number":"6", "street":"MyLongStreet", "town":"MyLittleTown", "city":"MyBigCity", "zip":"1234"} url:="https://www.onespaworld.com/main/Applicationform.aspx" ;example form urltab:="OneSpaWorld.com" WinActivate ahk_class IEFrame pwb := IEGet(urltab) While pwb.busy Sleep, 50 range := pwb.document.body.createTextRange() for Field, Value in Data { range.findText(Field) range.select() Sleep, 1000 Send, {Tab}%Value% Sleep, 1000 } return IEGet(Name="") ;Retrieve pointer to existing IE window/tab { IfEqual, Name,, WinGetTitle, Name, ahk_class IEFrame Name := ( Name="New Tab - Windows Internet Explorer" ) ? "about:Tabs" : RegExReplace( Name, " - (Windows|Microsoft) Internet Explorer" ) For wb in ComObjCreate( "Shell.Application" ).Windows If ( wb.LocationName = Name ) && InStr( wb.FullName, "iexplore.exe" ) Return wb } ;written by Jethrow