Jump to content
Sign in to follow this  
chenxu

A very simple example to show problem that the macro paused after submit clicked

Recommended Posts

chenxu

this is the code:

CODE

#include <IE.au3>

;#include <Misc.au3>

#include <GUIConstants.au3>

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()

$guiHandle = GUICreate("MyGUI", 800, 600,1,1, _

$WS_CAPTION + $WS_SYSMENU + $WS_MINIMIZEBOX + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 800, 600)

_IENavigate ($oIE, @ScriptDir & "\_IE_EXAMPLE_FORM.HTML")

GUISetState()

$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")

$oSubmit = _IEGetObjByName ($oIE, "submitExample")

;_IEAction($oSubmit, "click")

_IEAction ($oSubmit, "focus")

ControlSend($guiHandle, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")

ConsoleWrite("This is the message which will not be written to the console until the OK button is clicked")

ConsoleWrite("1")

ConsoleWrite("2")

the html file: _IE_EXAMPLE_FORM.HTML should be put in the same folder of the macro, you can just download the attachment and unzip it to a folder, help me please

Share this post


Link to post
Share on other sites
DaleHohm

Thank-you for the shortened example.

I can reproduce your trouble and unfortunately do not have a workaround for you.

There is something unexpected happening between the embedded control and the GUI stalling the script in the depths of AutoIt when the popup window appears. I say it is in the depths because code execution can actually get past the ControlSend depening on the timing of the appearance of the alert window, so it is not directly tied to your code - code execution stalls when the popup is displayed, not after a predictable line of code in the script.

Hopefully others may have some ideas. Next steps as I see them are to create an even more minimalist example with IE.au3 out of the picture and a very simple HTML page. My guess is that troubleshooting will take running AutoIt in a debugger to see where it is being waited upon.

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
chenxu

Thank-you for the shortened example.

I can reproduce your trouble and unfortunately do not have a workaround for you.

There is something unexpected happening between the embedded control and the GUI stalling the script in the depths of AutoIt when the popup window appears. I say it is in the depths because code execution can actually get past the ControlSend depening on the timing of the appearance of the alert window, so it is not directly tied to your code - code execution stalls when the popup is displayed, not after a predictable line of code in the script.

Hopefully others may have some ideas. Next steps as I see them are to create an even more minimalist example with IE.au3 out of the picture and a very simple HTML page. My guess is that troubleshooting will take running AutoIt in a debugger to see where it is being waited upon.

Dale

Since this is something unexpected happening of AutoIt itself, I will try to develop an effective way to do what i need. Actually, I can get the IE object by _IECreate() function just open the page in default web browser, but what worries me is there is to much unexpected would happen to the macro, and I am not willingly to handle this unexpected errors. So, I am gonna split the web browser created by AutoIt GUI to a standing alone macro, and it would be invoked by another macro in a right time. As far as I kown, this is the best way to finish my job, a free macro to my working mates :)

ps, I am a really newbie of AutoIt, but I am so willingly to become a experenced programmer of AutoIt, Thanks DaleHohm for your helping, thanks very much

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.