VeeDub Posted December 9, 2006 Author Share Posted December 9, 2006 Edit: In having a look at your entire code on the first page of this topic (are you still using the same?)Hi Mike, Here is the code that I have been usingAdlibEnable("WhackDialog") $Message_Year = StringLeft($message.CreationTime,4) AdlibDisable() I have also tried inserting a Sleep with different delay periodsAdlibEnable("WhackDialog") $Message_Year = StringLeft($message.CreationTime,4) Sleep(1000) AdlibDisable() I noticed that you are AdlibDisabling before your functions even has a chance to run. You should probably use a timer (parameter in AdlibEnable)I have tried AdlibEnable("WhackDialog,50)AdlibEnable("WhackDialog,5000)AdlibEnable("WhackDialog,5)I have also tried moving the Adlib statements outside of the For / Next loop. In all cases the ConsoleWrite statements in the WhackDialog function are not written to the console until after I have manually clicked on the Cancel button of the PGP dialog button. Although the Status values are now all 1, given that the none of the values appear in the Console until after I have clicked on the Cancel button of the PGP dialog button, doesn't that suggest that somehow the Adlib call / WhackDialog function is "suspended" while the PGP dialog box is open? or else AdlibDisable once you have stopped the process that can cause the PGP pop-up. Eureka?I don't understand what you mean, it is the $Message_Year = StringLeft($message.CreationTime,4)that causes the PGP dialog box to be displayed when I process a message that is encrypted. I don't know what logic I can use to identify an encrypted message and not cause the PGP dialog box to appear. If I knew how to identify an encrypted message without triggering the PGP dialog box I would not need the Adlib statement / WhackDialog function - the reason I am using Adlib is to close the PGP dialog box when it appears. Do you know how I can stop the process that can cause the PGP pop-up? It seems to me that there are two possibilities: 1. For whatever reason Adlib is "incompatible" with this dialog box; OR 2. The WhackDialog function is stuffed, even though it is reporting that it is working. As a test I have written a separate scriptWhackDialog() Func WhackDialog() $WE_Status = WinExists("classname=#32770","") ConsoleWrite("WE Status: " & $WE_Status & @CRLF) If $WE_Status = 1 Then $WA_Status = WinActivate("classname=#32770","") ConsoleWrite("WA Status: " & $WA_Status & @CRLF) If $WA_Status = 1 Then $CF_Status = ControlFocus("","","Button2") $CC_Status = ControlClick("","","Button2") ConsoleWrite("CF Status: " & $CF_Status & @TAB & "CC Status: " & $CC_Status & @CRLF) EndIf Else MsgBox(0,"Window","does not exist") EndIf EndFunc I then manually opened an encrypted message in Outlook so that the PGP Dialog box appeared. Then I ran the above script, which should close the dialog button. Guess what happened when I ran the WhackDialog function stand-alone, the PGP Dialog box isn't closed, here's the output on the Console>"C:\Program Files\AutoIt3\SciTe\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "D:\Temp\Outlook\Whack_Dialog.au3" /autoit3dir "C:\Program Files\AutoIt3\Beta" /UserParams +> Starting AutoIt3Wrapper v.1.7.3 >Running AU3Check (1.54.4.0) params: from:C:\Program Files\AutoIt3\Beta +>AU3Check ended.rc:0 >Running:(3.2.1.4):C:\Program Files\AutoIt3\Beta\autoit3.exe "D:\Temp\Outlook\Whack_Dialog.au3" WE Status: 1 WA Status: 1 CF Status: 1 CC Status: 1 +>AutoIT3.exe ended.rc:0 >Exit code: 0 Time: 1.865So the AutoIt functions report that they're working, but they're not. So the conclusion is: 1. I'm still not convinced that Adlib is not somehow being "paused" 2. But regardless of whether there is a problem with Adlib, either the logic of my WhackDialog function is flawed, or there is a bug in AutoIt. I need an independent review of my WhackDialog function and if the conclusion is that the logic is sound (i.e. that WhackDialog should close the dialog box) then there is a bug in one of the AutoIt functions that I am using. Once I can get WhackDialog to close the dialog box as a stand-alone script, then I can test whether WhackDialog will work in the Outlook script using Adlib VW Link to comment Share on other sites More sharing options...
VeeDub Posted December 12, 2006 Author Share Posted December 12, 2006 Well for anyone who is working with Outlook in the future and has to deal with the Outlook dialog button I finally have a solution. @PaulIa kindly offered to review my WhackDialog code and he reached the same conclusion that Adlib wasn't working in this particular scenario. What I didn't appreciate, and which PaulIa explained (a big thankyou to PaulIa ), is that as the Adlib function runs in the same thread as my original Outlook script, when the Outlook script makes the COM calls to retrieve info from Outlook, the Adlib function is effectively "frozen" until after I manually clicked on the Outlook dialog box and Outlook returns control to my script. The solution is to write a separate script that watches for the Outlook dialog boxwhile 1 if WinExists("Microsoft Office Outlook", "&Allow access for") then WinActivate("Microsoft Office Outlook", "&Allow access for") Send("{TAB 2}{SPACE}"); Allow access Send("{TAB}{DOWN 3}"); for 10 mins Send("{TAB}{SPACE}"); Click Yes endif Sleep(10000); Wait 10 seconds wendand call that "Dialog box Thumper" from the original script so that the "thumper" runs in a separate thread - and because the logic here is pretty simple it's quite easy to implement. So place this call just before the loop where I retrieve info from OutlookRun(@ScriptDir & "\Thump_Outlook_Dialog.exe") and then close the "thumper" after all the info has been retrieved from OutlookWhile ProcessExists("Thump_Outlook_Dialog.exe") ProcessClose("Thump_Outlook_Dialog.exe") WEnd Fun & games ... I ended up spending as much time on the silly dialog box as I did finding the Outlook VBA Reference and getting to grips with accessing the Outlook properties that I needed. VW 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