Jump to content

Error in the expression


Recommended Posts

Hi I am new to AutoIt:

The things i need to do:

1.Login to the app

2.Redirect page to a particular page

3.select a value in combobox on page 2

4.it refreshes the page after selecting

i was able to code till step 2 and then i checked the code on net and its now giving me error

$od=_IEFormElementGetObjByName( ByRef $oIE,$m_CorporateValueDrop[,$i_index=0])

_IEFormElementOptionselect ( ByRef $oIE, $od [, $f_select = 1 [, $s_mode = "byText" [, $f_fireEvent = 1]]] )

post-59045-12791871368158_thumb.jpg

Link to comment
Share on other sites

Hi,

just leave out the word "ByRef". It is only needed in the function it self, not in the code which calls the function.

Best regards,

Marc

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Link to comment
Share on other sites

The example in the helpfile uses ByRef, square brackets and $variable = "Value" syntax to indicate different types of paramenters that can be passed to a function.

The below script demonstrates how such a function would look in the helpfile and how to call it properly.

Local $var = 1
_example($var, 2) ;this is how you can call the function below. note the following:

;you don't write byref for the first argument
;byref arguments can be altered when the function returns. In this example $var will change to 3
;you don't include the square brackets for optional arguments
;you don't have to specify the optional argument, if the value you want is the default
;if you want to specify an optional argument you have to specify all preceeding optional arguments.

ConsoleWrite($var & @CRLF) ;see how the byref variable has changed into 3

;this is the function that is called on line 2
;the helpfile example would be: _Example(ByRef $variable[, $optional = 1[, $optional2 = 1]])
Func _example(ByRef $variable, $optional1 = 0, $optional2 = 0)
    ;$variable now points to $var on line 2, which has the value of 1
    ;$optional1 was assigned the value of 2 when calling the script on line 2
    ;$optional2 was not specified on line 2, so it keeps it's default value of 0
    $variable = $variable + $optional1 + $optional2 ;adds all passed variables together.
EndFunc

For your script it looks like you want to use: "_IEFormElementOptionselect ($oIE, $od)

This will use the default values for all optional variables that where not specified.

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...