Sign in to follow this  
Followers 0
minaset

<option> _IE

12 posts in this topic

Hi . I dont know english so well or i just dont understand how to make my browser in GUI to select option from IE combobox.

[/size][/font][/color]
[color=#000000][font=Consolas, 'Lucida Console', monospace][size=3]<form method="post" action="javascript:void(0)" onsubmit="bar.makeTegevus(get('tegevus').value);">
<select id="tegevus" name="tegevus" class="kast">
  <option value="-1">Millega tegeled ?</option>
<option value="10">Õpin</option>
<option value="20">Töötan</option>
<option value="30">Muu</option>

I have tried this , but its not working...

[/size][/font][/color]

$oForm = _IEFormGetObjByName($browser, 0)
$oSelect = _IEFormElementGetObjByName($oForm, "tegevus")
;_IEFormElementOptionSelect($oSelect, "10", 1, "byValue")
_IEFormElementOptionSelect($oSelect, "Õpin", 0, "byText")
_IEAction($oButton, "click")
[color=#000000][font=Consolas, 'Lucida Console', monospace][size=3]

Thanks in advance

Share this post


Link to post
Share on other sites



IIRC if you embed the IE into a GUI it is done with an ActiveX control. This doesn't act like the real IE.

Could you try your script without embedding IE into the GUI?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I dont actually know how to use it outside of the GUI . Anyway i still would like to use GUI and i know that its wrong topic but maybe you can help me with which functions should i search for to get answer ?

Share this post


Link to post
Share on other sites

You use function _IECreateEmbedded now to create the IE control in your GUI. Replace this with _IECreate and see if your script works now.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

i still didnt get it to work . it just dont choose the option and continues with other commands.

Share this post


Link to post
Share on other sites

Can you post the code you have so far?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Sry , but i dont want to publish my webpage .

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
_IEErrorHandlerRegister()Local $oIE = _IECreate("www.mywebsite.ee/?id=andmed", 1, 1, 0)
            $oLink = _IEGetObjById($oIE, "valge")
    _IEAction($oLink, "click")
    Sleep(300)
   
    $oForm = _IEFormGetCollection($oIE, 0)
    $oQuery1 = _IEFormElementGetObjByName ($oForm, "firstname") 
    $oQuery2 = _IEFormElementGetObjByName ($oForm, "lastname")
   
     _IEFormElementSetValue($oQuery1, "minu")
    Sleep(300)
    _IEFormElementSetValue($oQuery2, "nimi")
    Sleep(300)
    Send("{ENTER}")
    Sleep(2000)    _IENavigate($oIE, "http://www.mywebsite.ee/?id=andmed#ankeet")
    Sleep(800)
   
    local $oButton2, $oButton
   $oForm2 = _IEFormGetObjByName($oIE, 0)
   $oSelect = _IEFormElementGetObjByName($oForm2, "tegevus")
   ;_IEFormElementOptionSelect($oSelect, "10", 1, "byValue")
   _IEFormElementOptionSelect($oSelect, "Õpin", 0, "byText")
   _IEAction($oButton2, "click")
   $oButton = _IEGetObjById ($oIE, "saada_ankeet")
   _IEAction($oButton, "click")
   Sleep(500)

Share this post


Link to post
Share on other sites

If you run your script from SciTE what error messages do you get?

To do some debugging you could insert the following line after each _IE* function call:

ConsoleWrite(@error & @CRLF)
So you can see which statements fail.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

It show these errors :

--> IE.au3 V2.4-0 Warning from function _IEFormElementGetObjByName, $_IEStatus_NoMatch
7
--> IE.au3 V2.4-0 Error from function _IEFormElementOptionSelect, $_IEStatus_InvalidDataType
3
--> IE.au3 V2.4-0 Error from function _IEAction, $_IEStatus_InvalidDataType
3

Share this post


Link to post
Share on other sites

So one of the _IEFormElementGetObjByName calls doesn't find the specified object.

BTW: If I interpret your correctly you try to automate the login to a website. Is this correct?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi,

in js/html you can choose an option via selectedIndex.

So in autoit you can use something like:

$index = 0 ;=first element

$oIe.document.all.tegevus.selectedIndex = $index

HTH, Reinhard

Share this post


Link to post
Share on other sites

I wouldn't say that it is login . I just try to make something for my web. If i log in to my computer i open autoit script and then its sends my name and "tegevus" which means whats my position.

ReFran , i got by selectedIndex.

Thanks alot to both of you :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0