Jump to content

Why different syntax for ControlClick while using in c# and au3


commonjunks
 Share

Recommended Posts

Hi,

I am trying to click Save button once IE popup window to download a file

Here following code working flawless when using in au3 file

WinWaitActive("File Download")

ControlClick("File Download", "", "&Save")

But when i use same code in c#, it is not working as it suppose to

AutoItX3Class AUI = new AutoItX3Class();

AUI.WinWaitActive("File Download", "", 0);

AUI.ControlClick("File Download", "", "&Save", "left", 1, 0, 0)

Any help?

Posted Image

Link to comment
Share on other sites

Hello 'commonjunks';

Try this:

AUI.ControlClick("File Download", "", "&Save", "left", 1, -1, -1)

Zach...

Edit: What Mr. Robertson said! :P

Edited by zfisherdrums
Link to comment
Share on other sites

Well, there is the AutoItX Help File and the MSDN documentation, although I'm not sure where I read that the use of '-1' implies default parameters. Outside of that, you have us here in the forum. Good luck with whatever you're working on!

Zach...

Link to comment
Share on other sites

  • 2 weeks later...

Ok, it works once and when today i test it again it get fail :P.

I have no idea why

AutoItX3Class AUI = new AutoItX3Class();

following code is working when Save As screen appear

AUI.WinWaitActive("Save As", "",0);

AUI.ControlClick("Save As", "", "&Save", "left", 1, 0, 0);

but none of the following work for File Download screen

AUI.WinWaitActive("File Download", "",0);

AUI.ControlClick("File Download", "", "&Save", "left", 1, 0, 0);

or

AUI.WinWaitActive("File Download", "",0);

AUI.ControlClick("File Download", "", "&Save", "left", 1, -1, -1);

as you can see both button seems same

Posted Image

Posted Image

for your information when either line execute AUI.ControlClick("File Download", "", "&Save", "left", 1, -1, -1) or AUI.ControlClick("File Download", "", "&Save", "left", 1, 0, 0) focus go to save button but it don't click it.

At end i make some thing which is working but not very clean

AUI.WinActivate("File Download", "");

AUI.WinMove("File Download", "", 0, 0, 404, 273);

AUI.MouseMove(257, 158, 1);

AUI.MouseDown("left");

AUI.Sleep(250);

AUI.MouseUp("left");

AUI.Sleep(250);

AUI.WinActivate("Save As", "");

AUI.ControlClick("Save As", "", "&Save", "left", 1, 0, 0);

Hope someone can help

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...