Sign in to follow this  
Followers 0
rafaeltech

Paste a file path in a form on the Choose file... window

5 posts in this topic

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!

Share this post


Link to post
Share on other sites



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.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

#5 ·  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

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  
Followers 0