Sign in to follow this  
Followers 0
Seldon

Simple script NOT working on IE9

5 posts in this topic

Hi alls,

I have this simple script :

[code]
Func MakeLogin()
    Local $o_form_login, $o_login, $o_password, $o_accedi
    ; apre IE e la pagina
    $oIE = _IECreate("http://www.casa.it/pubblica-annunci", 0, $visibile, 1, $focus)
    $o_form_login = _IEFormGetObjByName($oIE, "aspnetForm")
    ; esegue il login
    $o_login = _IEFormElementGetObjByName($o_form_login, "ctl00$MasterContentPlaceHolder$f_login_codice")
    _IEFormElementSetValue($o_login, $codice)
    $o_password = _IEFormElementGetObjByName($o_form_login, "ctl00$MasterContentPlaceHolder$f_login_password")
    _IEFormElementSetValue($o_password, $password)
    $o_accedi = _IEGetObjById($oIE, "ctl00_MasterContentPlaceHolder_lbLogin")
    _IEAction($o_accedi, "click")
    _IELoadWait($oIE)
EndFunc

'$codice' and '$password' variables are global... Anyway the values are correctly set, but it seems the 'click' action is not

performed. Such code works very well with IE8.

Thanks for any hints !

Share this post


Link to post
Share on other sites



Welcome to the forums ! Posted Image

See this


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Thanks for your time and help !

Share this post


Link to post
Share on other sites

Just a note... I did this:

Func MakeLogin()
    Local $o_form_login, $o_login, $o_password, $o_accedi

    ; apre IE e la pagina
    $oIE = _IECreate("http://www.casa.it/pubblica-annunci", 0, $visibile, 1, $focus)

    _SetIE8($oIE)

    $o_form_login = _IEFormGetObjByName($oIE, "aspnetForm")
    ; esegue il login
    $o_login = _IEFormElementGetObjByName($o_form_login, "ctl00$MasterContentPlaceHolder$f_login_codice")
    _IEFormElementSetValue($o_login, $codice)
    $o_password = _IEFormElementGetObjByName($o_form_login, "ctl00$MasterContentPlaceHolder$f_login_password")
    _IEFormElementSetValue($o_password, $password)
    $o_accedi = _IEGetObjById($oIE, "ctl00_MasterContentPlaceHolder_lbLogin")
    _IEAction($o_accedi, "click")
    _IELoadWait($oIE)
EndFunc

Func _SetIE8($_oIE)  ; by forumer100  -----  Set IE9 to IE8 Browser mode
    If RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\IEDevTools", "Pinned") Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\IEDevTools", "Pinned", "REG_DWORD", 0)
    $hwnd1 = _IEPropertyGet($_oIE, "hwnd")
    $titleOld = _IEPropertyGet($_oIE, "title")
    $titleNew = $titleOld & " " & Random(10000000, 99999999, 1)
    _IEPropertySet($_oIE, "title", $titleNew)
    ControlSend($hwnd1, "", "Internet Explorer_Server1", "{F12}")
    $titleF12 = $titleNew & " - F12"
    WinWait($titleF12, "", 60)
    WinSetState($titleF12, "", @SW_HIDE)
    $hwndF12 = WinGetHandle($titleF12)
    ControlSend($hwndF12, "", "ToolbarWindow321", "{alt}b8")
    Sleep(1000)
    WinClose($hwndF12)
    _IEPropertySet($_oIE, "title", $titleOld)
    WinActivate($hwnd1)
    _IEAction($hwnd1,"refresh")
EndFunc   ;==>_SetIE8

But it didn't work... it stops after _SetIE8($oIE) call. If I insert a delay or a MsgBox() , it works. Is there a way to know how big the delay must be ? Thanks again !

Share this post


Link to post
Share on other sites

Hello again,

I've a problem: on my PC (Windows-7 64bit with IE9) it works, but in another PC... the script stops on -> WinWait($titleF12, "", 60) . If I press F12 manually it works ! For some reason -> ControlSend($hwnd1, "", "Internet Explorer_Server1", "{F12}") seems to fail, but I don't know why. I'm using the English version of IE9.. maybe this text "Internet Explorer_Server1" is different in other languages ?

Thanks 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