Reputation: 21
Scenario:
I'm logged in on a website, and want to make AutoIt write in an input field.
How can I achieve this?
Upvotes: 1
Views: 9154
Reputation: 2151
Try something like this
#include<IE.au3>
$sUsername = "Username"
$sPassword = "Password"
$sUrl = "https://yoururl.com"
$oIE = _IECreate($sUrl, 0, 1, 0, 1)
Sleep(2000)
$oHWND = _IEPropertyGet($oIE, "hwnd")
WinSetState($oHWND, "", @SW_MAXIMIZE)
$oForm = _IEFormGetCollection($oIE, 0)
$oUsername = _IEFormElementGetObjByName($oForm, 'login') ; change name !
$oPassword = _IEFormElementGetObjByName($oForm, "password") ; change name !
_IEFormElementSetValue($oUsername, $sUsername)
_IEFormElementSetValue($oPassword, $sPassword)
_IEFormSubmit($oForm)
There is also an UDF FF.au3 for firefox, but I would use greasemonkey instead if you need the script only on your PC.
Upvotes: 3