Jump to content

Nuro

Members
  • Posts

    6
  • Joined

  • Last visited

Nuro's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. I also tried WinWaitClose("Microsoft Excel") but I'll try the full name of the title.
  2. I have an automation set up for our company reports. I've been using it for nearly 2 years without any probelms. It take a total of about 2 hours for this whole thing to complete. I use Autoit to run and test 100's of queries and then at the end, it starts a VBA application in excel, which in turns takes the data from all those queries an puts it into the reports. Recently I've been ask to create a new report but I don't want the new report to interfere with the old reports. The older ones are far more important. So my thought was to have autoit run the queries for the second reports and start their VBA code after the other stuff has completed. The problem is that the script never picks back up. It stay's paused..Nothing gets run on the second part. The time it takes Excel to run its stuff, is about 15 minutes. Before the new portion, the autoit script ended once it opened excel. Now I just want it to wait until excel closes and then start the second half. I can't get it to work. I've tried using the variable name for the excel file, "Microsoft Excel", etc but it never starts up again. When I test it by manually opening the excel file, starting the new portion of the script, and then manually closing the excel file, it works but when everything is lumped into one big script, with the VBA code closing the excel file, it never starts back up. Does anyone have any ideas? The code below is the last part of the original script where it starts the excel application. This is where it orriginally ended. It's followed by the new portion. (again, the excel application closes excel once everything is completed.) ;Close out the Test Reconciliation File and open the Reports Automation Excel Application and run it. _ExcelBookClose($oExcel) ;Open the Daily Updates Excel Application. $oExcel = _ExcelBookOpen($sTestFileDir & "Daily Updates Application.xls") $oExcel.Application.Run("DailyAutomation") ;Now begins the second part of the automation for later reports. WinWaitClose ($oExcel) Sleep (15000) ;Open the CPE queries and run the test queries. Run ("C:\Program Files\CA\Forest & Trees\650\Ftw.exe " & $sQueryDir & "Daily CPE Metrics.ftv") WinWaitActive ("Forest & Trees", "Run Tests") Sleep(5000) MouseClick ("Left", 894 , 605, 1) WinWaitActive ("Forest & Trees", "CPE test files have been saved") Send ("{Enter}") ;Open the test reconciliation file and update the links to test that the CPE query data is valid. $oExcel = _ExcelBookOpen($sTestFileDir & "Test Reconciliation.xls") Sleep(5000) Global $sProceed = _ExcelReadCell($oExcel, "D2") If $sProceed = "DWH" Then ;Close out the Test Reconciliation File and open the Reports Automation Excel Application and run it. _ExcelBookClose($oExcel) ;Open the Daily Updates Excel Application and send the Test Failure e-mail. $oExcel = _ExcelBookOpen($sTestFileDir & "Daily Updates Application.xls") $oExcel.Application.Run("CpeDwhFailedEmail") Sleep(5000) WinActivate ("Forest & Trees", "Daily CPE") WinClose ("Forest & Trees", "Daily CPE") WinWaitActive ("Forest & Trees", "Should unsaved changes be written to") Send ("{Enter}") Sleep(3000) WinWaitClose ("Forest & Trees") Exit ElseIf $sProceed = "Decode" Then ;Close out the Test Reconciliation File and open the Reports Automation Excel Application and run it. _ExcelBookClose($oExcel) ;Open the Daily Updates Excel Application and send the Test Failure e-mail. $oExcel = _ExcelBookOpen($sTestFileDir & "Daily Updates Application.xls") $oExcel.Application.Run("CpeDecodeFailedEmail") Sleep(5000) WinActivate ("Forest & Trees", "Daily CPE") WinClose ("Forest & Trees", "Daily CPE") WinWaitActive ("Forest & Trees", "Should unsaved changes be written to") Send ("{Enter}") Sleep(3000) WinWaitClose ("Forest & Trees") ElseIf $sProceed = "Both" Then ;Close out the Test Reconciliation File and open the Reports Automation Excel Application and run it. _ExcelBookClose($oExcel) ;Open the Daily Updates Excel Application and send the Test Failure e-mail. $oExcel = _ExcelBookOpen($sTestFileDir & "Daily Updates Application.xls") $oExcel.Application.Run("CpeBothFailedEmail") Sleep(5000) WinActivate ("Forest & Trees", "Daily CPE") WinClose ("Forest & Trees", "Daily CPE") WinWaitActive ("Forest & Trees", "Should unsaved changes be written to") Send ("{Enter}") Sleep(3000) WinWaitClose ("Forest & Trees") Else EndIf ;Close out the Test Reconciliation File and open the Reports Automation Excel Application and run the CPE Automation. _ExcelBookClose($oExcel) Sleep (15000) ;If we are go for automation, run the Daily CPE Metrics Queries WinActivate ("Forest & Trees", "Daily CPE") WinWaitActive ("Forest & Trees", "Daily CPE") MouseClick("Left", 894, 672, 1) ;Now wait until the queries have finished running and then the F&T file. ;Close the Daily CPE Queries WinWait ("Forest & Trees", "CPE Routine Complete") WinActivate ("Forest & Trees", "CPE Routine Complete") Send ("{Enter}") Sleep(3000) WinActivate ("Forest & Trees", "Daily CPE") WinClose ("Forest & Trees", "Daily CPE") WinWaitActive ("Forest & Trees", "Should unsaved changes be written to") Send ("{Enter}") Sleep(3000) WinWaitClose ("Forest & Trees") Exit
  3. I never thought about that. I'll give winwait a try and let you know. But yes. the marco runs fine and when excel closes, thats when the error pops up. The only problem is that at the beginning, all I had was the run portion of the script at the end. I didn't have the winwaitclose or exit and it still got the error even though the script should have been over as soon as it started the macro.
  4. I have a script that runs a bunch of queries and then opens and runs an excel procedure that updates a bunch of reports based off of the query output. The whole process takes about an hour. At the end of hte excel proedure, it closes the file and leaves a blank desktop ready for the next day's run. I'm running into a problem that after excel closes, autoit gets an error. It says.... Line 378 (File "\\(network path and script name)") $oExcel.Application.Run("DailyAutomation") $oExcel.Application.Run("DailyAutomation") Error Error: The requested action with this object has fail. Here is the end of the autoit script. 377 $oExcel = _ExcelBookOpen($TestFileDir & "Daily Updates Application.xls") 378 $oExcel.Application.Run("DailyAutomation") 379 380 WinWaitClose ("Microsoft Excel - Daily Updates Application") 381 382 Exit Can someone help me? LInes 379 - 382 was my last attempt at fixing the error. I know you don't need the "exit" statement at the end of the script but I'm grasping for straws here. I could leave the file open and when the script runs the next day check to see if its open and if so, close it but I'd rather just close it without getting the error at the end.
  5. Hi, I'm new to autoit but have learned a great deal in the last week that I've used it. I have a pretty extensive Excel application that automates reporting proccess. It has a Userform that opens up as soon as you open the application and you can click on any of the buttons to do various task. I've written the autoit script to open up the query application I use to dump the info from the database. It clicks on the buttons enters the correct date sequences and then closes out the files in the order I've written. I'm having difficulty linking the two processes together. The problem I've run into is that the window info tool does not recognize the command buttons that are on the excel form. It opens the excel application fine, but stops after that. I'd considered using $oExcel.Application.Run("Macro name") but can't seem to get it working, I'm assuming because the command buttons are private procedures and because of this, they don't list themselves in the macros area. I could rework the code so that the procedures the button use is listed in one of my modules instead of on the form (thus negating the need to click a button all together) but it would take a large amount of rewrite in the excel application and I am desperately searching for an alternative. Does anyone have any advice? I've serarched all over the forums but can't quite seem to find anything related to my particular problem (Command Buttons on an excel form) Thanks
×
×
  • Create New...