Lucky_Luke Posted October 1, 2018 Posted October 1, 2018 Hey Guys, first of all: i'm sorry, i'm not a programmer and i'm quite new to this topic, please excuse me for asking stupid questions. I would like to automate the following scenario with autoit: Initial situation: a file collection with more than 30.000 files is in one folder. All files are numbered - example: "0014-01 this is a Testfile.png" to "0014-128 this is another Testfile.png" and "0015-01 this is another Testfile.png" to "0015-39 this is another Testfile.png" and so on... An individual selection of 50 files can be found in an Excel list - in the first column there is the number of the file, for example "0014-01" or "0015-39" and so on... Desired scenario: Autoit should automatically select the correct file based on the number and drag&drop it to an opened Google Chrome window and (after further steps) delete the row in the Excel table and continue with the next one. Unfortunately I couldn't find a reasonable way to do this yet, but I'm sure that you can automate it somehow. Thank you very much in advance for your support! Lucky_luke Translated with www.DeepL.com/Translator
Moderators JLogan3o13 Posted October 1, 2018 Moderators Posted October 1, 2018 @Lucky_Luke welcome to the forum. Please note that this forum is dedicated to helping you with your own scripts; we do not write them for you. Many people come saying "I'm not a programmer" and find they actually enjoy getting things done with such a powerful language. That said, below are some suggestions to get you started. Look in the help file for the Excel functions. You should be able to use the following to read through your excel list. This is pseudo code only, you will need to plug in all the important bits by reading the help file sections on Excel and _ArrayDisplay. But get this working, and we'll take the next step from there. $oExcel = _Excel_Open() $oWorkbook = _Excel_BookOpen($oExcel, <path to your workbook>) $oRange = _Excel_RangeRead($oWorkbook, Default, <The Column you're looking to read>) _ArrayDisplay($oRange) TheXman 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Lucky_Luke Posted October 1, 2018 Author Posted October 1, 2018 hey JLogan3o13, thank you for your answer. Please don't misunderstand my request - I've already finished a part of my script that works exclusively based on mouse actions and Excel. As I said, I have very little programming knowledge, so I have a hard time with this task and I understand the help only partly... nevertheless for the time being many thanks for the tips, i will try to familiarize myself here and see how far i can get. Can I use the function WinAPI_FindFirstFileName achieve something? Thank you for the time being. Greez Lucky_luke
Moderators JLogan3o13 Posted October 1, 2018 Moderators Posted October 1, 2018 (edited) So, a couple of additional questions; as I re-read your initial post I am a bit confused. You state you have ~30,000 files in a folder, and want to do something with them (we'll leave the actual mechanics of what you want to do until later). Then you mention you have an Excel file with about 50 folder names. So do you only want to act on those 50 files? If so, you do not need WinAPI_FindFirstFileName if you use the code I posted to pull the file names straight from the excel spreadsheet. If, however, you are trying to pull the file names from the directory where they exist, I would suggest _FileListToArray to get an array of all file names, and use that for your script. Edited October 1, 2018 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Lucky_Luke Posted October 1, 2018 Author Posted October 1, 2018 hey, thank you for your reply small correction to your post: the excel file does not contain folders but excerpts from the file name. The file itself is called "0014-001 Testfile.png" and the excel file only contains "0014-001". The script should only edit the 50 files listed in the excel file (i.e. drag&drop them into a google chrome window). The remaining files remain untouched. Then the Excel file will be filled again and the script will be executed again. big thanks for your support!
Moderators JLogan3o13 Posted October 1, 2018 Moderators Posted October 1, 2018 Sorry, that was a typo, I meant files not folders. If that is the case, all you need is the code I provided above; this will return an array of file names that you can then act on in the rest of your script. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Lucky_Luke Posted October 1, 2018 Author Posted October 1, 2018 ok perfect - so far so good. but how do i get autoit to select a specific file with the mouse and drag&drop it into a google chrome window? i simply can't find a command that fits this function.
Moderators JLogan3o13 Posted October 1, 2018 Moderators Posted October 1, 2018 Again, the help file is your friend. MouseClickDrag will grab a file and move it for you, the code below successfully moves a file from a folder onto my desktop: #include <Constants.au3> MouseClickDrag($MOUSE_CLICK_LEFT, 768, 345, 400, 345) However I would caution that this is a pretty unreliable way to do things; one bump of the mouse and your script is hosed. If at all possible I would suggest finding another way. If you are just uploading to a site, ftp or some such, there are plenty of script examples on the forum of doing that. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Lucky_Luke Posted October 1, 2018 Author Posted October 1, 2018 Thanks. Yeah, I know, but I don't think there's any other way than this one. if you really want to take your time, I would like to show you in detail what it's all about - maybe you'll find a better way. of course i would be willing to pay for a working solution as well....
faustf Posted October 1, 2018 Posted October 1, 2018 from what little I understoodyou want sincronize a upload file in excel , i think is much better if you use sqlite and after extract excel , i think is much fast . but if all file inside in folder must be uploaded , you can upload all with _ie functions and in the same time create csv
Moderators JLogan3o13 Posted October 1, 2018 Moderators Posted October 1, 2018 17 minutes ago, faustf said: from what little I understood... Use of sqlite and then out to Excel is overkill for 50 entries And as the OP states he is using Chrome, IE functions won't help much "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
MagnumXL Posted October 1, 2018 Posted October 1, 2018 (edited) As I understand it I think the question your wanting the answer to is "How do I move files, that I only have the name of, using only the mouse?" That is awkward, but if I had the same problem I would: DirCreate() a folder Open it on the desktop with ShellExecute("Explorer", "Path to Folder") WinMove() the folder to an known position (like 0,0) Then FileCopy() the file by name into the new folder Then MouseClickDrag() the file from where it appears in that folder to your chrome browser Then FileDelete() the file from the new folder Repeat Since the file will always appear in the same place this should work. Edited October 1, 2018 by MagnumXL added links JLogan3o13 1
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