Jump to content

DarylDixon

Members
  • Posts

    4
  • Joined

  • Last visited

DarylDixon's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks to everyone that commented. To give you an update, I realized I am looping all of my steps so that they repeat, but not looping inside of the folder so that it applies to each file. I ended up adding a script so that after the first file is complete, it is deleted. When the scripts start over, it will pick the new first file. Cheesy, I know...its working though. I would like to get it to work properly. So if anyone has a link to an example of looping through several scripts/functions, AND looping through .pdf/.xls files in a folder....that'd be grrreaaattt. If I recall correctly from all my old college courses, that would be a nested loop? I appreciate all of the suggestions. Most of the code posted before came from examples, so that would be why I used the syntax, that I did, in my code. Once I get this working on my PC, nicely, I will look to fine tune the code. My New issues are: 1. Nested Loops (Same issue as above) 2. Getting the macros and clicks to work on someone else's computer! Becaussseeee it isn't working else where.....(Window Size an issue?). What are your experiences and fixes for this issue? ControlClick vs Send the issue when running code on another pc? We both remote into a Virtual PC and we are both running this code on that virtual pc, not our own pc. Is it screen size?? 3. Reading text from a single cell in an already open excel file, and do an if statement off of the text in that one cell. If Cell A1 = "member" do this, else do this... I know, I know, post a new question. I will search the site before I start a new feed. But if someone has the answers to a nested loop, post below, or send me a message please! You would help me greatly! Thanks again!
  2. Sorry I accidentally closed that post with Ctrl + return....so I was not able to edit my grammar.... Any help is greatly appreciated!
  3. Thank you for the response! 1. An _ArrayDisplay does give me the list of the array. If I add or remove files, the array does adjust correctly. ============= This is what I currently get when using _ArrayDisplay: Row|Col 0 [0]|6 [1]|CAPT3662010.pdf [2]|CAPT3662011.pdf [3]|CAPT3662012.pdf [4]|CAPT3662013.pdf [5]|CAPT3662014.pdf [6]|CAPT3662015not.pdf ============== ****Every time I run the original code, the code always picks the CAPT3662015not.pdf file. I need it to move to the next file each time it loops. It currently loops but never moves from the last file. 2. Output to Console passes successfully. 3. The process is successful all the way through for the first file that is chosen. As you mentioned maybe the issue is with my embedded .exes. I am choosing the file with a recorded macro, called (choosepdf.exe). I just recorded myself choosing a file in C:\PDF. So I was thinking to remove that file, so the next time I loop through, it will pick the next file. I would like know how to choose the file without a recorded macro. FileOpen doesnt really double click and my most frustrating issue is that it does not change files. 4. What is a better way to choose a file and loop through that folder? I am looping through all of the processes with one file (my choosepdf.exe picks the first file in the list). But I need to loop through that folder. ****Heres the code for the choosepdf.exe file. Maybe this is the culprit. Its just a recorded macro...: AutoItSetOption("MouseCoordMode", 0) ;WinWait("Untitled") ;waits for the window to open WinActivate("Untitled") ;activates the window MouseClick("primary", 464, 524, 1, 0) ; MouseClick("primary", 363, 583, 1, 0) MouseClick("primary", 537,99, 1, 0) ;clicks on address bar Send("C:\PDF") MouseClick("Primary", 493, 191, 2, 0) ;chooses the first file in the list by double-clicking
  4. So, I haven't programmed in years. AutoIt has brought back my interest. I am working to automate many processes. The current process is opening PDFs and converting them to Excel. I don't want the Array to worry about the file name, nor the amount of files in the folder. I built many small macros with the recorder. I want to run these macros on one file, then loop and do the reset in the folder. It works to do one file, however it will not move to the next file. Ive tinkered around with $i + 1 etc, but obviously don't have it in the proper location. I have been researching this site, other sites, and the help files. I find many options, but vast the variety of options, leave me with code that does not increment to the next file. I could delete the first file so that the next file is the "new first file" when it loops, however I am not able to capture the file name so that the code knows the file to remove. Then I thought, maybe I ought to not delete anything, and just get it working so that it moves to the next file. Ive looked at FileNextFile etc, but have had a bunch of issues. So, I figured I would ask the pros. I am most likely over-complicating it, but I have learned a lot about autoit in the process. Please someone throw me a bone here..... Be nice, and thanks in advance :-) #include <file.au3> #include <array.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> ;========================================== $extension = "pdf" ;========================================== $monarch = "C:\Program Files\Datawatch Monarch 13\DPS\DWDataPrepStudio.exe" $path = "C:\PDF" $choosePDF = "C:\Macros\3_ChoosePDF.exe" $chooseColumns = "C:\Macros\4_ChooseColumns.exe" $chooseMemberColumn = "C:\Macros\5_ChooseMemberColumn.exe" $dataPrep = "C:\Macros\6_DataPrepPreviewLoadTables.exe" $nulls = "C:\Macros\7_Nulls.exe" $export = "C:\Macros\8_Export.exe" $closeMonarch = "C:\Macros\9_CloseMonarch.exe" $deleteFirstPdfFile = "C:\Macros\10_DeleteFirstPdfFile.exe" ;========================================== ; ######################################## ;~ Example() ; just trying something ;~ Func Example() ;~ ;~ While $FileArray <> 0 ;~ _ArrayPop($FileArray) ;~ _ArrayDisplay($FileArray) ;~ EndFunc ; ######################################## $FileArray = _FileListToArray($path, "*." & $extension,1) ; As long as a file exists in C:\PDF - get the list of files For $i = 1 To $FileArray[0] Run($monarch & ' "' & $path & $FileArray[$i] -1 & '"') ;Runs Monarch Sleep(8000) ProcessExists($monarch) Run($choosePDF) ;Runs $choosePDF ProcessWaitClose($choosePDF) Run($chooseColumns) Sleep(5000) ProcessWaitClose($chooseColumns) RunWait($chooseMemberColumn) Sleep(5000) ProcessWaitClose($chooseMemberColumn) RunWait($dataPrep) Sleep(5000) ProcessWaitClose($dataPrep) RunWait($nulls) Sleep(5000) ProcessWaitClose($nulls) RunWait($export) Sleep(5000) ProcessWaitClose($export) Run($closeMonarch) Sleep(5000) ProcessWaitClose($closeMonarch) RunWait($deleteFirstPdfFile) Sleep(5000) ProcessWaitClose($deleteFirstPdfFile) ProcessWaitClose($monarch) Sleep(5000) Next
×
×
  • Create New...