Jump to content

Recommended Posts

Posted

Hello,

I'm new to Autoit and I need some advices. I'm trying to simulate an user choosing a file and clicking at the "Open" button on a "Choose file" window on Windows XP.

I made this code, but I don't know how to include a file path into the text box and click Open.

WinWait("Choose file");

WinActivate("Choose file");

Could you help me plz? By the way, is the default "Choose file" window to upload to a website. I will call this script from java code to test an application.

Cya! Thx!

Posted

One way to do it: Use these two functions, FileOpenDialog & GUICtrlSetData, which are explained in the help file. The AutoIt Window Info tool will probably be of some help too.

Close, GUICtrlSetData() is only for native AutoIt GUIs. Use ControlSend() or ControlSetText() to apply the string to an outside GUI.

:)

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
Posted

Close, GUICtrlSetData() is only for native AutoIt GUIs. Use ControlSend() or ControlSetText() to apply the string to an outside GUI.

:)

Ok, thanks PsaltyDS I will try that!

Posted (edited)

Close, GUICtrlSetData() is only for native AutoIt GUIs. Use ControlSend() or ControlSetText() to apply the string to an outside GUI.

:)

It works! But now I have another problem. Autoit is not clicking on the Open button! Thats my code:

WinWait("Choose file");

WinActivate("Choose file");

ControlSetText("Choose file","",1148,"C:\nnn\nnn");

ControlClick("Choose file","&Open",1,"primary",1);

If I change to "right", Autoit shows the Menu, what's normal. But when I change to "left" or "primary" nothing happens! It doesn't make the upload!

I've tried HotKeySet("{ENTER}") too!

Anything wrong with my code?

Thanks for the help!

UPDATED: I used the function Send() and it works! Thx for the help!! This post is closed!

Edited by rafaeltech

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