Jump to content

Recommended Posts

Posted
  On 3/16/2016 at 12:21 AM, Dgameman1 said:

 

_IEAction($TrashCan, "click")
ConsoleWrite("DONE")

Is my code, ConsoleWrite never happens until I manually click the close button

Expand  

this is an equivalent:

$TrashCan.click()
ConsoleWrite("DONE")

Try it and say whats happend next (after click).

Then I thin I can answer further.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
  On 3/17/2016 at 8:18 AM, JohnOne said:

By the way, if anyone knows exactly why these dialogs can block your script, I'd sure love to hear it.

Expand  

So AutoIt is using ActiveX method click() on object $TrashCan
AutoIt waiting for ActiveX object return with success or error.
And this for me seams to be natural behavior of each other Develpment Environment (just my feeling not tested).

What I can think is:
I do not know how exactly  AdLibRegister works, but for me it seams in this case  AdLibRegister do not works.
It is only so my thinking, not proven, and not confirmed by AutoIt DEV.

To proove or negate it I'lltry to do some testing, when I come back home from my work.

Edited by mLipok
typo

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 3/17/2016 at 7:43 AM, Dgameman1 said:
  • AdlibRegister
  • Example 2 under _IEAction in the Help file
  • Second script
  • Use Winactivate on IE and then the Dialog box.
Expand  

AdlibRegister works also:

; Open a browser with the basic example page, insert an
; event script into the head of the document that creates
; a JavaScript alert when someone clicks on the document

#include <IE.au3>

Local $oIE = _IE_Example("basic")
_IEHeadInsertEventScript($oIE, "document", "onclick", "alert('Someone clicked the document!');")
AdlibRegister('CloseAlert',1000)
$tdStart=TimerInit()
While TimerDiff($tdStart)<60000
    Sleep   (1000)
WEnd
_IEQuit($oIE)

Func CloseAlert()
    ControlClick('Meldung von Webseite','Someone clicked the document!',2)
EndFunc

you have to change 'Meldung von Webseite' to title used in your language.

Posted

Indeed....

Here is little impoved example:

; Open a browser with the basic example page, insert an
; event script into the head of the document that creates
; a JavaScript alert when someone clicks on the document

#include <IE.au3>

Local $oIE = _IE_Example("basic")
_IEHeadInsertEventScript($oIE, "document", "onclick", "alert('Someone clicked the document!');")
AdlibRegister('CloseAlert', 1000)
$tdStart = TimerInit()
While TimerDiff($tdStart) < 60000
    Sleep(1000)
WEnd
_IEQuit($oIE)

Func CloseAlert()
    Sleep(3000)
    ControlClick('[CLASS:#32770]', 'Someone clicked the document!', 2)
EndFunc   ;==>CloseAlert

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

But we are talking about this kind of issue:

  Reveal hidden contents

 

 

some better example:

; Open a browser with the basic example page, insert an
; event script into the head of the document that creates
; a JavaScript alert when someone clicks on the document

#include <IE.au3>

Local $oIE = _IE_Example("basic")
_IEHeadInsertEventScript($oIE, "document", "onclick", "alert('Someone clicked the document!');")
AdlibRegister('CloseAlert', 1000)
$tdStart = TimerInit()

; _IELinkClickByIndex($oIE, 0) - replacement
$oIE.document.links.item(0).click()

MsgBox(0, 'Test', 'Why this is not PopUp ? Because AdlibResister not working ? Maybe AutoIt still waiting for return from Click ?')

While TimerDiff($tdStart) < 60000
    Sleep(10)
WEnd
_IEQuit($oIE)

Func CloseAlert()
    Sleep(3000)
    ControlClick('[CLASS:#32770]', 'Someone clicked the document!', 2)
EndFunc   ;==>CloseAlert

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 3/17/2016 at 7:43 AM, Dgameman1 said:

It doesn't matter what page URL. Any page that has autoit click the javascript

  1. AdlibRegister
  2. Example 2 under _IEAction in the Help file
  3. Second script
  4. Use Winactivate on IE and then the Dialog box.

The only thing that has worked is using a second script, which I don't want to do.

Expand  

Dude, I asked you to do a forum search for "deadlock", and use one of THOSE solutions...

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Posted (edited)

I had a similar problem time ago, here some links of possible solutions and a possible explanation of what's causing the problem: (thanks to jdelaney :))

 

 

 

 

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted
  On 3/18/2016 at 12:14 AM, Chimp said:

I had a similar problem time ago, here some links of possible solutions and a possible explanation of what's causing the problem: (thanks to jdelaney :))

 

 

 

Expand  

The first link requires another script to run. I don't want that.

Thanks for the links tho!

I see that using focus instead of click and then sending enter worked for you, but for some reason it doesn't work here.

But I can like the idea of running the exe to click the ok button right before the dialog is clicked. So I'll just use that. Thanks :)

 

Posted
  On 3/18/2016 at 2:47 AM, Dgameman1 said:

.....

I see that using focus instead of click and then sending enter worked for you, but for some reason it doesn't work here.

.....

Expand  

in some cases I had to ControlSend {TAB}{ENTER} instead of juast one {ENTER}
try like this:

ControlSend($hwnd, "", "", "{TAB}{Enter}")

p.s. don't ask me why this appens...

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted
  On 3/18/2016 at 10:18 AM, Chimp said:

in some cases I had to ControlSend {TAB}{ENTER} instead of juast one {ENTER}
try like this:

ControlSend($hwnd, "", "", "{TAB}{Enter}")

p.s. don't ask me why this appens...

Expand  

When I set it to that, it just ended up click the next item in the IE Window

Posted
  On 3/18/2016 at 7:19 PM, junkew said:

Try iuiautomation thread in examples section. It will not block your script.

Expand  

Not sure how to go about using that =/ I don't see where it would be applicable to my script, but that's just cause I don't think I understand it

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...