 />
 1: CMD_TRIGGER can be used as an alternative trigger  <a href="#a87f3ca86925a51224672e1526f351322">More...</a><br /></td></tr>
<tr class="separator:a87f3ca86925a51224672e1526f351322"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a21d6882eab799890d6f76fab5082af7a"><td class="memItemLeft" >&#160;&#160;&#160;uint8_t&#160;&#160;&#160;<a class="el" href="structrfc___c_m_d___f_s___p_o_w_e_r_u_p__s.html#a7768ec1fa9b2beae02a30ccbc8e7afa6">triggerNo</a>:2</td></tr>
<tr class="memdesc:a21d6882eab799890d6f76fab5082af7a"><td class="mdescLeft">&#160;</td><td class="mdescRight">The trigger number of the CMD_TRIGGER command that triggers this action.  <a href="#a21d6882eab799890d6f76fab5082af7a">More...</a><br /></td></tr>
<tr class="separator:a21d6882eab799890d6f76fab5082af7a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0fe87264a696a82436e3c555fed751a4"><td class="memItemLeft" >&#160;&#160;&#160;uint8_t&#160;&#160;&#160;<a class="el" href="structrfc___c_m_d___f_s___p_o_w_e_r_u_p__s.html#af0145fc28b7630f98c7cb7d222acc4d3">pastTrig</a>:1</td></tr>
<tr class="memdesc:a0fe87264a696a82436e3c555fed751a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">0: A trigger in the past is never triggered, or for start of commands, give an error<br />
 1: A trigger in the past is triggered as soon as possible  <a href="#a0fe87264a696a82436e3c555fed751a4">More...</a><br /></td></tr>
<tr class="separator:a0fe87264a696a82436e3c555fed751a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a52cd8c6b271e44e8133a3e2e93283356"><td class="memItemLeft" valign="top">}&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrfc___c_m_d___f_s___p_o_w_e_r_u_p__s.html#a52cd8c6b271e44e8133a3e2e93283356">startTrigger</a></td></tr>
<tr class="memdesc:a52cd8c6b271e44e8133a3e2e93283356"><td class="mdescLeft">&#160;</td><td class="mdescRight">Identification of the trigger that starts the operation.  <a href="#a52cd8c6b271e44e8133a3e2e93283356">More...</a><br /></td></tr>
<tr class="separator:a52cd8c6b271e44e8133a3e2e93283356"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeb12403b5d37bf96fa43ea6161ded673"><td class="memItemLeft" >struct {</td></tr>
<tr class="memitem:ad9c97814dd354c2f07eb5369484ac9f3"><td class="memItemLeft" >&#160;&#160;&#160;uint8_t&#160;&#160;&#160;<a class="el" href="structrfc___c_m_d___f_s___p_o_w_e_r_u_p__s.html#a3c25511c708ef21f032a80846c5b9a46">rule</a>:4</td></tr>
<tr class="memdesc:ad9c97814dd354c2f07eb5369484ac9f3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Condition for running next command: Rule for how to proceed.  <a href="#ad9c97814dd354c2f07eb5369484ac9f3">More...</a><br /></td></tr>
<tr class="separator:ad9c97814dd354c2f07eb5369484ac9f3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3e841d700e7d73713cd3aab454305b9a"><td class="memItemLeft" >&#160;&#160;&#160;uint8_t&#160;&#160;&#160;<a class="el" href="structrfc___c_m_d___f_s___p_o_w_e_r_u_p__s.html#a293# A sample originally provided by Richard Bell, and modified by Mark Hammond.

# This sample demonstrates how to use COM events in a free-threaded world.
# In this world, there is no need to marshall calls across threads, so
# no message loops are needed at all.  This means regular cross-thread 
# sychronization can be used.  In this sample we just wait on win32 event
# objects.

# See also ieEventsApartmentThreaded.py for how to do this in an
# aparment-threaded world, where thread-marshalling complicates things.

# NOTE: This example uses Internet Explorer, but it should not be considerd
# a "best-practices" for writing against IE events, but for working with
# events in general. For example:
# * The first OnDocumentComplete event is not a reliable indicator that the
#   URL has completed loading
# * As we are demonstrating the most efficient way of handling events, when
#   running this sample you will see an IE Windows briefly appear, but
#   vanish without ever being repainted.

import sys
sys.coinit_flags=0          # specify free threading

import os
import win32api
import win32event
import win32com.client
import pythoncom
import time

# The print statements indicate that COM has actually started another thread
# and will deliver the events to that thread (ie, the events do not actually
# fire on our main thread.
class ExplorerEvents:
    def __init__(self):
        # We reuse this event for all events.
        self.event = win32event.CreateEvent(None, 0, 0, None)
    def OnDocumentComplete(self,
                           pDisp=pythoncom.Empty,
                           URL=pythoncom.Empty):
        #
        # Caution:  Since the main thread and events thread(s) are different
        # it may be necessary to serialize access to shared data.  Because
        # this is a simple test case, that is not required here.  Your
        # situation may be different.   Caveat programmer.
        #
        thread = win32api.GetCurrentThreadId()
        print("OnDocumentComplete event processed on thread %d"%thread)
        # Set the event our main thread is waiting on.
        win32event.SetEvent(self.event)
    def OnQuit(self):
        thread = win32api.GetCurrentThreadId()
        print("OnQuit event processed on thread %d"%thread)
        win32event.SetEvent(self.event)

def TestExplorerEvents():
    iexplore = win32com.client.DispatchWithEvents(
        "InternetExplorer.Application", ExplorerEvents)

    thread = win32api.GetCurrentThreadId()
    print('TestExplorerEvents created IE object on thread %d'%thread)

    iexplore.Visible = 1
    try:
        iexplore.Navigate(win32api.GetFullPathName('..\\readme.htm'))
    except pythoncom.com_error as details:
        print("Warning - could not open the test HTML file", details)

    # In this free-threaded example, we can simply wait until an event has 
    # been set - we will give it 2 seconds before giving up.
    rc = win32event.WaitForSingleObject(iexplore.event, 2000)
    if rc != win32event.WAIT_OBJECT_0:
        print("Document load event FAILED to fire!!!")

    iexplore.Quit()
    # Now we can do the same thing to wait for exit!
    # Although Quit generates events, in this free-threaded world we
    # do *not* need to run any message pumps.

    rc = win32event.WaitForSingleObject(iexplore.event, 2000)
    if rc != win32event.WAIT_OBJECT_0:
        print("OnQuit event FAILED to fire!!!")

    iexplore = None
    print("Finished the IE event sample!")

if __name__=='__main__':
    TestExplorerEvents()
