Jump to content

I can't close alert pop-up


 Share

Recommended Posts

function postSetEcam(field) 
{
    if (field.name == "mine") {
    alert("Your setting will take effect\n"
          + "after you reboot your system");
    }
}

<SELECT id=mine onchange=setEcam(this) name=mine>
g <OPTION value=auto selected>auto<OPTION value=100full>100full<OPTION value=100half>100half<OPTION value=10full>10full<OPTION value=10half>10half</OPTION>
</SELECT>

#include <IE.au3>
#include <File.au3>
#include <Process.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <Array.au3>

Opt("WinTextmatchMode", 1)
Opt("WinTitleMatchMode",2)

$dsm = _IETagNameGetCollection ($oIE, "select")
For $ds In $dsm
    If ($ds.name) = "mine" then 
        $dopt = _IETagNameGetCollection($ds, "OPTION")
            For $dop in $dopt 
                Sleep(2000)
                $o = $dop.innerText
                _IEFormElementOptionselect($ds, $o, 1, "byText")
                
            Next
        ExitLoop
    EndIf
Next
Sleep(3000)
$title = WinGetTitle("[active]")
    If String($title) = "Windows Internet Explorer" Then
        ControlFocus("Windows Internet Explorer", "", "[CLASS:Button; INSTANCE:1]")
        Sleep(1000)
        ControlClick("Windows Internet Explorer", "", "[CLASS:Button; INSTANCE:1]")
    EndIf

_IELoadWait($oIE)
$avWinList = WinList("[CLASS:#32770]")
For $n = 1 To $avWinList[0][0]
    If String($avWinList[$n][0]) = "Windows Internet Explorer" Then
        ControlFocus("Windows Internet Explorer", "", "[CLASS:Button; INSTANCE:1]")
            Sleep(500)
        ControlClick("Windows Internet Explorer", "", "[CLASS:Button; INSTANCE:1]")
        
    EndIf
Next

How comes the WinGetTitle or WinList doesn't access the alert window??

Edited by diikee
Link to comment
Share on other sites

Anyone encountered this problem before???

What problem? The code posted is not runnable. How is anyone supposed to evaluate it?

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

when I select the option using _IEFormElementOptionselect($ds, $o, 1, "byText"), it alerts the user of changes to take effect after reboot, through the javascript function postSetEcam.

that alert pop up is what autoit can't close or is blocked somehow

how do I go about controlling such popups???

Link to comment
Share on other sites

when I select the option using _IEFormElementOptionselect($ds, $o, 1, "byText"), it alerts the user of changes to take effect after reboot, through the javascript function postSetEcam.

that alert pop up is what autoit can't close or is blocked somehow

how do I go about controlling such popups???

What does AU3Info.exe show about the popup window (class/title/text)?

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

>>>> Window <<<<

Title: Windows Internet Explorer

Class: #32770

Position: 739, 551

Size: 218, 126

Style: 0x94C801C5

ExStyle: 0x00010101

Handle: 0x005308B4

>>>> Control <<<<

Class: Button

Instance: 1

ClassnameNN: Button1

Advanced (Class): [CLASS:Button;INSTANCE:1]

ID: 2

Text: OK

Position:

Size:

ControlClick Coords:

Style:

ExStyle:

Handle: 0x013708C0

>>>> Mouse <<<<

Position: 922, 576

Cursor ID: 2

Color: 0x0065FD

>>>> StatusBar <<<<

>>>> Visible Text <<<<

OK

Your setting will take effect

after you reboot your system

>>>> Hidden Text <<<<

Link to comment
Share on other sites

>>>> Window <<<<

Title: Windows Internet Explorer

Class: #32770

Position: 739, 551

Size: 218, 126

Style: 0x94C801C5

ExStyle: 0x00010101

Handle: 0x005308B4

>>>> Control <<<<

Class: Button

Instance: 1

ClassnameNN: Button1

Advanced (Class): [CLASS:Button;INSTANCE:1]

ID: 2

Text: OK

Position:

Size:

ControlClick Coords:

Style:

ExStyle:

Handle: 0x013708C0

>>>> Mouse <<<<

Position: 922, 576

Cursor ID: 2

Color: 0x0065FD

>>>> StatusBar <<<<

>>>> Visible Text <<<<

OK

Your setting will take effect

after you reboot your system

>>>> Hidden Text <<<<

Set WinTitleMatchMode = 4 and then "[CLASS:#32770; TITLE:Windows Internet Explorer; TEXT:Your setting will take effect]" should work.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

The alert popup is sitting on top and the script is just waiting.

there must be something blocking since the are in the waiting phase forever.

Run just this while the popup is present:
#include <Array.au3>; Only for _ArrayDisplay()

Opt("WinTitleMatchMode", 4)

$avWinList = WinList("[CLASS:#32770; TITLE:Windows Internet Explorer]")
_ArrayDisplay($avWinList, "$avWinList")

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I've had a similar issue while trying to automate my router, which was causing internet explorer to show a jscript error window, somehow the popup seemed to pause the script until it was clicked on.

I solved this by having the script write to a temporary .au3 file, then running the au3 file(the au3 waited for the popup to occur, then closed it by clicking on one of the buttons in the window). ;)

Link to comment
Share on other sites

I've had a similar issue while trying to automate my router, which was causing internet explorer to show a jscript error window, somehow the popup seemed to pause the script until it was clicked on.

I solved this by having the script write to a temporary .au3 file, then running the au3 file(the au3 waited for the popup to occur, then closed it by clicking on one of the buttons in the window). ;)

Aha! I think what you are seeing there is the fact that the java script popup keeps the navigation of IE from completing. The IE.au3 UDFs, like _IENavigate() set the $f_wait parameter = 1 by default. So the function doesn't complete until IE clears the "LOADWAIT". While the popup is presented, "LOADWAIT" is still up.

The way to handle that is use $f_wait = 0 so your script can continue, handle the popup, and just check the browser with _IELoadWait().

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I guess both your suggestions are good to go with but in this case I am dealing with _IEFormElementOptionselect($e, "100full", 1, "byText"), and $f_fireEvent is the only option to play with.

FreeFry, trying your idea. (will update on progress)

FreeFry, can you post a sample of how you solved your issue??

Edited by diikee
Link to comment
Share on other sites

I guess both your suggestions are good to go with but in this case I am dealing with _IEFormElementOptionselect($e, "100full", 1, "byText"), and $f_fireEvent is the only option to play with.

FreeFry, trying your idea. (will update on progress)

Hmm... I think that's a Dale question. The function _IEFormElementOptionselect() uses "$o_object.fireEvent("onchange")" and "$o_object.fireEvent("onclick")" to fire the event, and the Object method .FireEvent may not return control to AutoIt before the popup is handled.

Maybe Dale knows a trick...

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Could you forward this to Dale then??

He is already aware of this topic... because he is Dale...

;)

... though he may be Dale, taking a nap. So be patient.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Hmmm...

Looks like the script called onchange in this case just creates an informational popup that has no affect on processing.

Suggest you try adding this:

$ds.onchange=""

after the line:

If ($ds.name) = "mine" then

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

Link to comment
Share on other sites

Aha! I think what you are seeing there is the fact that the java script popup keeps the navigation of IE from completing. The IE.au3 UDFs, like _IENavigate() set the $f_wait parameter = 1 by default. So the function doesn't complete until IE clears the "LOADWAIT". While the popup is presented, "LOADWAIT" is still up.

The way to handle that is use $f_wait = 0 so your script can continue, handle the popup, and just check the browser with _IELoadWait().

;)

Obviously, I tried that, but it didn't work at all(confused, yes).

I guess both your suggestions are good to go with but in this case I am dealing with _IEFormElementOptionselect($e, "100full", 1, "byText"), and $f_fireEvent is the only option to play with.

FreeFry, trying your idea. (will update on progress)

FreeFry, can you post a sample of how you solved your issue??

Other than following Dales/PsaltyDS suggestions, going by the way I did it, you have two alternatives, which is:

A: Make the script which shall handle the error popups in advance, compile it, and FileInstall, and run it when needed.

or B(the way I did it. Harder, but imo. neater):

Assemble a text string, containing the code, then filewrite that text string to a temporary file on your harddrive, and execute it through the @AutoItExe, with the special commandline parameters AutoIt has.

Unfortunately I don't have my exact code available atm, as I wrote it on my moms computer(she being the one needing the script).

Edited by FreeFry
Link to comment
Share on other sites

Obviously, I tried that, but it didn't work at all(confused, yes).

Other than following Dales/PsaltyDS suggestions, going by the way I did it, you have two alternatives, which is:

A: Make the script which shall handle the error popups in advance, compile it, and FileInstall, and run it when needed.

or B(the way I did it. Harder, but imo. neater):

Assemble a text string, containing the code, then filewrite that text string to a temporary file on your harddrive, and execute it through the @AutoItExe, with the special commandline parameters AutoIt has.

Unfortunately I don't have my exact code available atm, as I wrote it on my moms computer(she being the one needing the script).

I think you misunderstood what Dale suggested. All he changed was adding one line to the OP's script that removes the .onchange setting for that object, since it is only an informational alert that does no processing:
$dsm = _IETagNameGetCollection ($oIE, "select")
For $ds In $dsm
    If ($ds.name) = "mine" then
        $ds.onchange = ""; <------ Added this line only to remove .onchange alert message
        $dopt = _IETagNameGetCollection($ds, "OPTION")
            For $dop in $dopt
                Sleep(2000)
                $o = $dop.innerText
                _IEFormElementOptionselect($ds, $o, 1, "byText")
                
            Next
        ExitLoop
    EndIf
Next

I think you have to admit, that's neater.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...