Jump to content

new to Autoit need help with a comand


Recommended Posts

I've written a script in vbs and now have been told it needs to be in autoit. I have never used autoit untill today.

i have managed to get my web pages username and password in. but cant get it to click.

bellow is my vbscript

Dim IE
Set IE = CreateObject("InternetExplorer.Application")
Set WshShell = Wscript.CreateObject("Wscript.Shell")
IE.Visible = 3
IE.FullScreen = True
IE.navigate "[url=https://xxxxxxxxxxxxx]https://xxxxxxxxxxxxx"[/url]
Do While (IE.Busy)
    WScript.Sleep 10
Loop
Set Helem = IE.document.getElementByID("UserName")
Helem.Value = ""
Set Helem = IE.document.getElementByID("Password")
Helem.Value = ""
'set Helem = IE.document.getElementByID("LogIn")
set objForms = IE.document.getElementsByTagName("form")
set objForm = objForms(0)
for each objField in objForm
      if (objField.type = "submit") then
       objField.Click
   end if
next
my autoit script looks like this

#include <IE.au3>

$oIE = _IECreate("url")
$oForm = _IEFormGetObjByName($oIE, 0)
Local $oQuery = _IEFormElementGetObjByName($oForm, "UserName")
_IEFormElementSetValue($oQuery, "username")
Local $oQuery1 = _IEFormElementGetObjByName($oForm, "Password")
_IEFormElementSetValue($oQuery1, "password")
 
so i am missing the
 
set objForms = IE.document.getElementsByTagName("form")
set objForm = objForms(0)
for each objField in objForm
      if (objField.type = "submit") then
       objField.Click
   end if
next
any help will deserve a n internet beer Edited by Melba23
Addedcode tags
Link to comment
Share on other sites

just let follow up this, i fixed it. i realised how close to vbscript autoit commands can be. so imanaged to get my click/submit command sorted :thumbsup:

$oFormElements = _IEFormElementGetCollection ( $oForm )
        
For $oFormElement In $oFormElements
            
If $oFormElement.type = 'submit' Then
                 
_IEAction ($oFormElement, "click")
            
EndIf
         

Next
Edited by DrRobert
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...