Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
There is another tricky way to override security problems in Outlook...
Since the main problem is that there's a window that pops up and freezes the code, all we need to do is run a parallel and independent process that'll detect that pop-up window and validate it.
Now how in the world ??!??! It's all rather simple - but not very academic. All you have to do is bring that window to the foreground, activate the maximum time length during which perl code will be authorized to run (10 mns in Outlook 2002) and there you go.
Use the package Win32::GUITest to send keys to the window. By sending the sequence (tab twice then space then tab then end then enter) you're actually selecting maximum time option and validating it...
You can try it out - it works just fine. Enjoy - and there's $200 saved :
use Win32::OLE qw(in with); use Win32::GUI; use Win32::GuiTest; sub findSecurityWindow # this method detects whether a security window popped up in Outlook. +If it is # the case, it needs to be processed so that the script can be execute +d. # Else it'll pend. { my $messageClass = "#32770"; my $winName = "Microsoft Outlook"; return Win32::GUI::FindWindow($messageClass,$winName); } sub clearSecurityWindow # this method brings the security window on top of all the others, hen +ce focusing it # and sends it a series of keystrokes in order to validate it. { my $securityHandle = shift; print "shandle : $securityHandle\n"; # debug purposes while ($securityHandle!=Win32::GUI::GetForegroundWindow()) { #Win32::GUI::BringWindowToTop($securityHandle); # doesn't seem e +nough so let's focus it as well #Win32::GUI::SetFocus($securityHandle); Win32::GUI::SetForegroundWindow($securityHandle); Win32::GUI::Enable($securityHandle); } print "foreground window : Win32::GUI::GetForegroundWindow()"; # now send key sequence that will allow maximum time for code to ru +n # The sequence is as follows : initially the no button is focused.. +. # One tab brings us to cancel, another tab to the time tick box # a spacebar hit will tick the box. Then a tab will select the drop +-down # list in order for us to choose the time length. A keypress on the + End key will # select maximum time. Then a return key will validate our choice # 2 tabs - spacebar - 1 tab - one end - one return Win32::GuiTest::SendKeys("{TAB}"); Win32::GuiTest::SendKeys("{TAB}"); Win32::GuiTest::SendKeys("{SPACEBAR}"); Win32::GuiTest::SendKeys("{TAB}"); Win32::GuiTest::SendKeys("{END}"); Win32::GuiTest::SendKeys("{ENTER}"); }

Then all you need is to call
my $securityHandle = 0; while (not ($securityHandle)) # detects Outlook's popup window that as +ks whether access should be granted to { # perl code to Outlook's inner properties. $securityHandle = LTG::dialog::findSecurityWindow(); # wait for sec +urity window to pop-up... print "shandle : $securityHandle\n"; # debug purposes } # window has been found - clear it LTG::dialog::clearSecurityWindow($securityHandle);

In reply to Re: Win32::OLE Outlook and E-mail security update by Foggy Bottoms
in thread Win32::OLE Outlook and E-mail security update by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (7)
    As of 2014-07-13 09:53 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (249 votes), past polls