nbala75 Posted November 23, 2010 Share Posted November 23, 2010 Right now iam doing it like this. Is there a better way to do this? This is during a data import process. Link to comment Share on other sites More sharing options...
JohnOne Posted November 23, 2010 Share Posted November 23, 2010 It really depends what you want to do. There are many ways to select files, but I would chose how based on what I was going to do next.Perhaps you should explain a little more and post some code. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
KaFu Posted November 23, 2010 Share Posted November 23, 2010 Use ControlSend() to send Shortcut hotkeys to the target window to open the Import dialog. Use Au3Info to detect the controlID of the "File name:" input control and the "Open" button. Then use ControlSetText() to set the filenames to open and finally ControlClick() on the open button. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
nbala75 Posted November 23, 2010 Author Share Posted November 23, 2010 (edited) It really depends what you want to do. There are many ways to select files, but I would chose how based on what I was going to do next. Perhaps you should explain a little more and post some code. I do the same way as given in those pictures above. The code for it is given below. Data is getting updated in those excel/ascii files and i import it into the charting software. Since i do it quite frequently (once every 30 secs), it wud be good, if there are any quicker ways to do it. The code given below may look primitive, but it is how i do it WinActivate("Charting software","-") ;Activate charting software Sleep(200) Send("!{F}") ;Select File menu Sleep(200) Send("i") ;Select Ascii import submenu WinWaitActive("Open","Folder") ;wait for Open dialog WinMove("Open","FolderView",345,-590) Mouseclick("left",495,-330,1,1) ;Select POINTER folder MouseClick("left",865,-255,1,1) ;Click OK Sleep(200) MouseClick("right",520,-450,1,1) ;Right click in open space MouseMove(590,-415) ;Mouse hover on Arrange icons Sleep(200) Send("t") ;Select Arrange icons as per type MouseClickDrag("left",842,-436,882,-345,1) ;Left Click and drag mouse on 6 .csv files MouseClick("left",865,-255,1,1) ;Click OK Edited November 23, 2010 by nbala75 Link to comment Share on other sites More sharing options...
nbala75 Posted November 25, 2010 Author Share Posted November 25, 2010 Use ControlSend() to send Shortcut hotkeys to the target window to open the Import dialog.Use Au3Info to detect the controlID of the "File name:" input control and the "Open" button. Then use ControlSetText() to set the filenames to open and finally ControlClick() on the open button.Hi KafooI am not able to find ControlIDs for most of the items/fields. I tried using WinMenuSelectItem, even that doesnt work. How to go abt it?I tried using class or classnameNN name...but it doesnt work Link to comment Share on other sites More sharing options...
KaFu Posted November 25, 2010 Share Posted November 25, 2010 Hu, looks like the program is using some custom control types, at least for the menu itself. Stick to your code up to and including "WinWaitActive("Open","Folder")", try to find controlIDs for the "Open" dialog itself, that seems to be pretty standard, at least from the looks, then only automate that part with controlsend() and controlclick(). Hint, you can add a list of full qualified paths to the input control ('"c:\test\text1.txt" "c:\test\text2.txt" "c:\test\text3.txt"') and don't need to browse for the correct folder. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
nbala75 Posted November 25, 2010 Author Share Posted November 25, 2010 Hu, looks like the program is using some custom control types, at least for the menu itself. Stick to your code up to and including "WinWaitActive("Open","Folder")", try to find controlIDs for the "Open" dialog itself, that seems to be pretty standard, at least from the looks, then only automate that part with controlsend() and controlclick(). Hint, you can add a list of full qualified paths to the input control ('"c:\test\text1.txt" "c:\test\text2.txt" "c:\test\text3.txt"') and don't need to browse for the correct folder.thanx for explaining in very simple terms...i got itexcept that i do not know how to select (controlsend) mutliple file names in the "Open Dialog/File name" edit fieldI tried sending it with doublequotes(") OR comma(,) OR quotes(') OR Space( ) ...but nothing worksafter wandering thru net , i have come back to u Mr Kafu...plz help me out Link to comment Share on other sites More sharing options...
KaFu Posted November 25, 2010 Share Posted November 25, 2010 (edited) You nearly got it , enclose all filenames with single quotes and the single filenames with double quotes. The single quote is for autoit to recognize a string, the double quote for the open dialog to separate the single files. $sFiles = '"c:\test\text1.txt" "c:\test\text2.txt" "c:\test\text3.txt"' Edit: Btw, I'm currently tinkering on a similar program , only that I gave up the intraday approach and now I'm working on a daily basis ... Edit2: Or if you need to concatenate single strings, you'll have to consider that quotes are escaped by quotes (sounds silly, but it's a fact). $sFile1 = "c:\test\text1.txt" $sFile2 = "c:\test\text2.txt" $sFiles = '"' & $sFile1 & '" "' & $sFile2 & '"' MsgBox(0,"",$sFiles) $sFiles = """" & $sFile1 & """ """ & $sFile2 & """" MsgBox(0,"",$sFiles) Edited November 25, 2010 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
SadBunny Posted November 25, 2010 Share Posted November 25, 2010 $sFile1 = "c:\test\text1.txt" $sFile2 = "c:\test\text2.txt" $sFiles = '"' & $sFile1 & '" "' & $sFile2 & '"' MsgBox(0,"",$sFiles) $sFiles = """" & $sFile1 & """ """ & $sFile2 & """" MsgBox(0,"",$sFiles) Isn't that kind of a hard way to use doublequotes? If you want to use double quotes in the string you can put that directly between single quotes, just like the other way around... The following works just as well: $sFile1 = '"c:\test\text1.txt"' $sFile2 = '"c:\test\text2.txt"' $sFiles = $sFile1 & " " & $sFile2 MsgBox(0,"",$sFiles) Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
KaFu Posted November 25, 2010 Share Posted November 25, 2010 $sFile1 = 'c:\test\text1.txt' $sFile2 = 'c:\test\text2.txt' $sFiles = _Quote($sFile1) & " " & _Quote($sFile2) MsgBox(0,"",$sFiles) Func _Quote($s) Return '"' & $s & '"' EndFunc I guess there are some dozened more ways to do it, as long as the resulting syntax is correct ... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
nbala75 Posted November 26, 2010 Author Share Posted November 26, 2010 (edited) Sorry to come back to u Kafu...it doesnt work and i cud not find a solutionAs u had suggested in one of ur posts, that i can just give the correct path, without worrying to open the correct folder, i just gave like that enclosing the path within double quotes. The OPEN dialog doesnt give any error NOR it updates the quotes.I tried searching thru folder options, control panel etc, but, cud not get what is wrongjust have a look at the pictureswhen given like this, there is no error msg and no updation happens...When multiple files selected inside the relevant Folder, then it is getting updated Edited November 26, 2010 by nbala75 Link to comment Share on other sites More sharing options...
KaFu Posted November 26, 2010 Share Posted November 26, 2010 Cant figure it out, sorry. Has to be something program specific, it works fine in a standard 'open' dialog. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) 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