vrocco Posted July 19, 2010 Author Share Posted July 19, 2010 [0]|1| [1]|Message Classification - PAROCCOVS11 MAC Address|0x00070E7C Got a result. Why is it always showing 2 items in the array? Shouldn't we only get the window? Link to comment Share on other sites More sharing options...
Juvigy Posted July 20, 2010 Share Posted July 20, 2010 It is an Array and the first [0] element of the array shows how many elements the array have. Link to comment Share on other sites More sharing options...
water Posted July 20, 2010 Share Posted July 20, 2010 What I don't understand is why WinList gets your Window and your script doesn't.I'm running out of ideas My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
vrocco Posted July 20, 2010 Author Share Posted July 20, 2010 yeah i am stumped too Link to comment Share on other sites More sharing options...
water Posted July 20, 2010 Share Posted July 20, 2010 How about this. I replaced WinWait with WinList and set the WinTitleMatchMode at the start of the script. Opt("WinTitleMatchMode", 2) While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $lineFinal = $lineFinal & "<BR>" & $line WEnd FileClose($file) $oOApp = ObjCreate("Outlook.Application") $oOMail = $oOApp.CreateItem($olMailItem) With $oOMail .Save .To = $address .Subject = $subject .BodyFormat = $olFormatHTML .Importance = $olImportanceNormal .HTMLBody = $lineFinal .Send EndWith Do Sleep(500) $aWindows = WinList("Message Classification") Until $aWindows[0] = 1 ConsoleWrite("Before ControlClick" & @CRLF) $iResult = ControlClick("Message Classification", "Select Classification", 1) ConsoleWrite("After ControlClick. Result = " & $iResult & @CRLF) $oOApp = 0 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
vrocco Posted July 20, 2010 Author Share Posted July 20, 2010 it still does nothing. the window just sits there until I hit cancel on it. then it gives me an error that the array subscript is out of range. so it still doesn't see that window for some reason. Link to comment Share on other sites More sharing options...
water Posted July 20, 2010 Share Posted July 20, 2010 Ok, I think something else is wrong. Could you please run this script and post the result (copy all the lines from ScITe): Opt("WinTitleMatchMode", 2) While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $lineFinal = $lineFinal & "<BR>" & $line WEnd FileClose($file) ConsoleWrite("After FileClose" & @CRLF) $oOApp = ObjCreate("Outlook.Application") ConsoleWrite("After ObjectCreate: " & @error & @CRLF) $oOMail = $oOApp.CreateItem($olMailItem) ConsoleWrite("After CreateItem: " & @error & @CRLF) With $oOMail .Save .To = $address .Subject = $subject .BodyFormat = $olFormatHTML .Importance = $olImportanceNormal .HTMLBody = $lineFinal .Send EndWith ConsoleWrite("After SendMail: " & @error & @CRLF) Do Sleep(500) $aWindows = WinList("Message Classification") Until $aWindows[0] = 1 ConsoleWrite("Before ControlClick" & @CRLF) $iResult = ControlClick("Message Classification", "Select Classification", 1) ConsoleWrite("After ControlClick. Result = " & $iResult & @CRLF) $oOApp = 0 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
vrocco Posted July 20, 2010 Author Share Posted July 20, 2010 (edited) OK here's what happens. When I run it I get this in the console (MAC and system name edited): >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "F:\New Machine Load\Scripting\Scripts\test.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>10:49:49 Starting AutoIt3Wrapper v.2.0.1.24 Environment(Language:0409 Keyboard:00000409 OS:WIN_XP/Service Pack 3 CPU:X64 OS:X86) >Running AU3Check (1.54.19.0) from:C:\Program Files\AutoIt3 +>10:49:49 AU3Check ended.rc:0 >Running:(3.3.6.1):C:\Program Files\AutoIt3\autoit3.exe "F:\New Machine Load\Scripting\Scripts\test.au3" MACAddress: 00:00:00:00:00 Name: Broadcom NetXtreme Gigabit Ethernet SystemName: PA*******11 After FileClose After ObjectCreate: 0 After CreateItem: 0 At that point the pop up window that is the problem comes up on the screen and just sits there. It won't do anything. When I hit "Cancel" on that window, then I get: After SendMail: 0 F:\New Machine Load\Scripting\Scripts\test.au3 (70) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: Until $aWindows[0] = 1 Until ^ ERROR ->10:51:20 AutoIT3.exe ended.rc:1 >Exit code: 1 Time: 92.429 Edited July 20, 2010 by vrocco Link to comment Share on other sites More sharing options...
water Posted July 20, 2010 Share Posted July 20, 2010 Now I see where the problem is! Your script hangs in the With/EndWith Statement. The window is triggered by the .send statement. But as the line after "EndWith" is never reached the line "ConsoleWrite("After SendMail: " & @error & @CRLF)" is never executed. As AutoIt does not support multitasking you have to click on the window in a second script. I would suggest to write a second (short) script that does: * Wait for the window to appear (and specify a timeout so the script will not hang around forever) * Click on the Button * Exit Start this second script after line "$oOMail = $oOApp.CreateItem($olMailItem)" in your first script. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
vrocco Posted July 20, 2010 Author Share Posted July 20, 2010 As I understand it, here is what I think is happening. When that ".Send" executes, the window pops up. However, autoit won't move on to the next line of the script until that .Send completes. And the .Send won't complete until either "Ok" or "Cancel" is clicked on that window. This is why when we looked for the window with a separate script while the main script was running, it found it. However, since the .Send never completes, it never gets to the part of the script that looks for the window. When I hit "Cancel", the window is gone and so it can't find it then either. Does this sound right? Any ideas? Link to comment Share on other sites More sharing options...
vrocco Posted July 20, 2010 Author Share Posted July 20, 2010 (edited) hahaha as soon as i submitted my post, I saw yours. That is what i will have to do. Thanks for all the help and patience Edited July 20, 2010 by vrocco Link to comment Share on other sites More sharing options...
water Posted July 20, 2010 Share Posted July 20, 2010 (edited) That's exactly how I understand it as well. Please see my previous posting for a suggestion on how to solve the problem (I hope I was able do make it understandable ) Edit: Glad to be of service! If you have further questions, just drop a note. Edited July 20, 2010 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
vrocco Posted July 20, 2010 Author Share Posted July 20, 2010 Success!! Thanks again Link to comment Share on other sites More sharing options...
water Posted July 20, 2010 Share Posted July 20, 2010 That's good news! So I will now shut down my computer and leave my office. Have a nice evening! My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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