MS1 Posted June 11, 2020 Posted June 11, 2020 Hi I am very new to AutoIT and just few days old... I am using this to integrate with selenium Python. I've an app and have a situation where I must select "Browse" button which opens windows file open dialog box. From there I need to select a file for use by the application. I am able to achieve this though the below code. ControlFocus("Open","","Edit1") ControlSetText("Open","","Edit1","Folder name of the CSV file") ControlClick("Open","","Button1") This perfectly selects the file name. Now everytime the file name changes, I had to re-compile the script before feeding into selenium. Instead I am thinking if this could be achieved in AutoIT. Have just only one CSV file in the folder and make autoIT select this file using automatically (Using some wildcard somthing like *.* or *.csv) Is there a way to choose the file name inside the file open dialog box so that the "file name" automatically gets carried to "File Open" text box and then the ControlClick("Open","","Button1") will do its job? Appreciate your assistance here and apologies if this is not the right area to post a tech question. Thanks -Sriram
Moderators Melba23 Posted June 11, 2020 Moderators Posted June 11, 2020 Moved to the appropriate forum. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Nine Posted June 11, 2020 Posted June 11, 2020 Look at _FileListToArray using wild card, you will get all (or single) files(s), After that it is pretty straightforward. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
Danp2 Posted June 11, 2020 Posted June 11, 2020 Selenium would generally indicate web automation. Are you automating a web browser? If so, which one? Also, can you share the website? P.S. I know that with webdriver, you can indicate the files to be uploaded without having to deal with the file open dialog. Have you looked into that? Latest Webdriver UDF Release Webdriver Wiki FAQs
MS1 Posted June 12, 2020 Author Posted June 12, 2020 2 hours ago, Nine said: Look at _FileListToArray using wild card, you will get all (or single) files(s), After that it is pretty straightforward. I tried using that but don't know how to use this exactly...Assuming there is only one file in the specified folder, would you mind sharing the code for selecting that file (without specifying the file name)? PS: I've the code to set the control to the "File name" field (where you normally type the file name), open the file (filename hard coded). Appreciate your assistance here.
MS1 Posted June 12, 2020 Author Posted June 12, 2020 1 hour ago, Danp2 said: Selenium would generally indicate web automation. Are you automating a web browser? If so, which one? Also, can you share the website? P.S. I know that with webdriver, you can indicate the files to be uploaded without having to deal with the file open dialog. Have you looked into that? Yes, it is automating of web browser. Though it can be done without having to open file dialog, I prefer opening the file dialog just to make sure that functionality works well. Thanks
Nine Posted June 12, 2020 Posted June 12, 2020 What have you tried so far ? Please provide the code you have written so far, so we can build from it. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
MS1 Posted June 12, 2020 Author Posted June 12, 2020 8 hours ago, Nine said: What have you tried so far ? Please provide the code you have written so far, so we can build from it. This is what I have so far: ControlFocus("Open","","Edit1") ControlSetText("Open","","Edit1","Folder name of the CSV file") ControlClick("Open","","Button1") After "Browse" button is clicked, I am focusing control on the "Open" dialog box, setting the file name in "File Open" text area and click the "Open" button which will paste the file name in the relevant field in the application. All I want is: Instead of hard coding the file name and send it to autOIT, once I open the File open dialog box, I must be able to select whatever file present in the folder and open it. Thanks again for your help.
Zedna Posted June 12, 2020 Posted June 12, 2020 Look at my similar example code for automatizing of dialog for selecting direcory (contain TreeView control). Your dialog for selecting of FileName contain ListView. So princip would be similar, only LisTview instead of TreeView + some differences ... Resources UDF ResourcesEx UDF AutoIt Forum Search
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