rafaeltech Posted October 28, 2009 Share Posted October 28, 2009 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! Link to comment Share on other sites More sharing options...
somdcomputerguy Posted October 28, 2009 Share Posted October 28, 2009 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. Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 28, 2009 Share Posted October 28, 2009 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 Link to comment Share on other sites More sharing options...
rafaeltech Posted October 29, 2009 Author Share Posted October 29, 2009 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! Link to comment Share on other sites More sharing options...
rafaeltech Posted October 29, 2009 Author Share Posted October 29, 2009 (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 October 29, 2009 by rafaeltech Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now