Jump to content
Sign in to follow this  
PCFUN

IE.au3 [router-reconnect] no control of reboot popup window

Recommended Posts

PCFUN

Hi,

I'm using IE.au3, and I'm having some problems getting what I need done.

I would like to restart my D-link router

Posted Image

This site uses javascript to generate a popup window, so how I open the popup window by this:

;--------------Button "Reboot the Device" -------------------------------------------

$oForm = _IEFormGetCollection($oIE,0)
$oMAC_Address = _IEFormElementGetCollection($oForm,0)
$oSubmit = _IEFormElementGetCollection($oForm,1)
_IEFormElementSetValue($oMAC_Address,$MAC)
_IEAction($oSubmit,"click")


$oInputs = _IETagNameGetCollection ($oIE, "input")
For $oInput In $oInputs
    If $oInput.value = "Reboot the Device" Then
        _IEAction ($oInput, "click")      ; <= here the script is waiting to press the OK-Button
        ExitLoop
    EndIf
Next
;--------------------------------------------------------------

A part of the html-code:

CODE
....

<table border="0" cellpadding="0" cellspacing="0" summary="">

<tr>

<td id="maincontent_container">

<div id="maincontent_1col">

<!-- === BEGIN MAINCONTENT === -->

<!--@UNIQUE:maincontent@-->

<div id="box_header">

<h1>Success</h1>

<p>

The new settings have been saved.

</p>

<p>

The router must be rebooted before the new settings will take

effect. You can reboot the router now using the button below, or

make other changes and then use the reboot button on the

Tools/System page.

</p>

<p>

<input type="button" class="button_submit" value="Reboot the Device" onclick="doReboot()" />

</p>

<p>

<input type="button" class="button_submit" value="Continue" onclick="location.replace('Basic_WAN.html')" />

</p>

</div>

<!--@ENDUNIQUE@-->

<!-- === END MAINCONTENT === -->

</div>

<!--@OPTIONAL:the_lpj_output.I18N_ENABLED and this_file ~= 'Reboot.html' and this_file ~= 'forbidden.html' and this_file ~= 'restore_helper.html' and this_file ~= 'ugood.html' and this_file ~= 'ubad.html'@--><!--@ENDOPTIONAL@-->

</td>

</tr>

</table>

....

I think this html part is essential:

CODE:

<input type="button" class="button_submit" value="Reboot the Device" onclick="doReboot()" />

The problem, is that I cannot gain control of the popup window, no matter what I've tried.

Nothing that I have tried seems to be working correctly. I don't care too much how I do it, I just need control of the popup window to restart my router.

I have no idea.

Can someone please help me do this?

Thanks in advance

PCFUN

Share this post


Link to post
Share on other sites
bogQ

to gain control on window

WinWaitActive combinated with command WinGetHandle

to click button on popup window

MouseClick or Send or ControlClick

on part to click "rebot the device" on page button i dono, dont have d-link to test it on that ie button, maby somone else can b more helpful.

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
DaleHohm

See the second example for _IEAction for a work-around. The Javascript takes control from AutoIt...

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites
PCFUN

See the second example for _IEAction for a work-around. The Javascript takes control from AutoIt...

Dale

Hi Dale,

thnx for your input with the second example! It works fine! :mellow:

Here my solution:

;------------Press Button "Reboot the Device" and close the POPUP window with OK -------------------------------------------

$oForm = _IEFormGetCollection($oIE,0)
$oMAC_Address = _IEFormElementGetCollection($oForm,0)
$oSubmit = _IEFormElementGetCollection($oForm,1)
_IEFormElementSetValue($oMAC_Address,$MAC)
_IEAction($oSubmit,"click")


$oInputs = _IETagNameGetCollection ($oIE, "input")
$hwnd = _IEPropertyGet($oIE, "hwnd")
For $oInput In $oInputs
    If $oInput.value = "Reboot the Device" Then
            ; "focus" and not "click"
                _IEAction ($oInput, "focus")
        ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")
        ; waiting for popup.
        ControlClick("Windows Internet Explorer", "", "[CLASS:Button; TEXT:OK; Instance:1;]")
        _IELoadWait ($oIE)
        ExitLoop
    EndIf
Next

Kind regards

PCFUN

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  

×