Jump to content

Wait Statement


anixon
 Share

Recommended Posts

I am using the following code to force Outlook to perform a Send/Receive 'F9'. Outlook displays in an information panel ['information panel' may not be the description used by Microsoft for this panel] located at the bottom of the Outlook Window a 'Send/Receive Completed' message is displayed when all Email Accounts have been process. This process can take seconds or minutes determined by the volume of Emails being Sent or Received. If your account on the ISP Mail Server is busy at the time a 'Send/Receive' is processed an 'Error' message is displayed in the Outlook information panel.

Can anyone provide me with a code example as to how to pause my script until such time as the 'Send/Receive Completed' triggers the script to continue processing.

;//Process an Outlook Send and Receive [F9]
Func _sSendRecEmailClient()
    If ProcessExists($DefaultEmail & ".exe") Then
        WinActivate($DefaultEmail, "")
        WinWaitActive($DefaultEmail, "", 5)
        If WinActive($DefaultEmail) Then
            $SysMessage = "Processing Send & Receive"
            _MessageDisplay($sMsgDuration, $DStyleTip, $sMessageHeight, $sMsgTextJust, $SysMessage)
            Send("{F9}")
        EndIf
    EndIf
EndFunc   ;==>_sSendRecEmailClient

Help is always appreciated. Ant..

The following is the 'Control' Information

Class rctrl_sbpwnd32

Classname rctrl_sbpwnd321

Advance Class Class:rctrl_sbpwnd32;Instance;1

Edited by anixon
Link to comment
Share on other sites

I am using the following code to force Outlook to perform a Send/Receive 'F9'. Outlook displays in an information panel ['information panel' may not be the description used by Microsoft for this panel] located at the bottom of the Outlook Window a 'Send/Receive Completed' message is displayed when all Email Accounts have been process. This process can take seconds or minutes determined by the volume of Emails being Sent or Received. If your account on the ISP Mail Server is busy at the time a 'Send/Receive' is processed an 'Error' message is displayed in the Outlook information panel.

Can anyone provide me with a code example as to how to pause my script until such time as the 'Send/Receive Completed' triggers the script to continue processing.

;//Process an Outlook Send and Receive [F9]
Func _sSendRecEmailClient()
    If ProcessExists($DefaultEmail & ".exe") Then
        WinActivate($DefaultEmail, "")
        WinWaitActive($DefaultEmail, "", 5)
        If WinActive($DefaultEmail) Then
            $SysMessage = "Processing Send & Receive"
            _MessageDisplay($sMsgDuration, $DStyleTip, $sMessageHeight, $sMsgTextJust, $SysMessage)
            Send("{F9}")
        EndIf
    EndIf
EndFunc   ;==>_sSendRecEmailClient

Help is always appreciated. Ant..

The following is the 'Control' Information

Class rctrl_sbpwnd32

Classname rctrl_sbpwnd321

Advance Class Class:rctrl_sbpwnd32;Instance;1

This code does not work

;//Process an Outlook Send and Receive [F9]
Func _sSendRecEmailClient()
    If ProcessExists($DefaultEmail & ".exe") Then
        ;//Process a Send/Receive
        WinActivate($DefaultEmail, "")
        WinWaitActive($DefaultEmail, "", 5)
        If WinActive($DefaultEmail) Then
            $SysMessage = "Processing Send/Receive"
            _MessageDisplay($sMsgDuration, $DStyleTip, $sMessageHeight, $sMsgTextJust, $SysMessage)
            Send("{F9}")
            ;//Wait for Send Receive to Complete
            WinWaitActive("[TITLE:Inbox; CLASS:msctls_status32; INSTANCE:1]", "")
            $SysMessage = "Send/Receive Completed"
            _MessageDisplay($sMsgDuration, $DStyleTip, $sMessageHeight, $sMsgTextJust, $SysMessage)
        EndIf
    EndIf
EndFunc   ;==>_sSendRecEmailClient

It hangs on the WinWaitActive("[TITLE:Inbox; CLASS:msctls_status32; INSTANCE:1]", "")

Help would be appreciated.

Edited by anixon
Link to comment
Share on other sites

This code does not work

;//Process an Outlook Send and Receive [F9]
Func _sSendRecEmailClient()
    If ProcessExists($DefaultEmail & ".exe") Then
        ;//Process a Send/Receive
        WinActivate($DefaultEmail, "")
        WinWaitActive($DefaultEmail, "", 5)
        If WinActive($DefaultEmail) Then
            $SysMessage = "Processing Send/Receive"
            _MessageDisplay($sMsgDuration, $DStyleTip, $sMessageHeight, $sMsgTextJust, $SysMessage)
            Send("{F9}")
            ;//Wait for Send Receive to Complete
            WinWaitActive("[TITLE:Inbox; CLASS:msctls_status32; INSTANCE:1]", "")
            $SysMessage = "Send/Receive Completed"
            _MessageDisplay($sMsgDuration, $DStyleTip, $sMessageHeight, $sMsgTextJust, $SysMessage)
        EndIf
    EndIf
EndFunc   ;==>_sSendRecEmailClient

It hangs on the WinWaitActive("[TITLE:Inbox; CLASS:msctls_status32; INSTANCE:1]", "")

Help would be appreciated.

Bump.. If anyone can help me with this issue it would be very much appreciated
Link to comment
Share on other sites

Bump.. If anyone can help me with this issue it would be very much appreciated

I have resolve this issue by relocating the code within an Idle Loop which allows the F9 invoked Sen/Receive to finalise whilst the script is idling and before any other Outlook OBJ process is performed. Not the most elegant solution but it works never the less. Ant..

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...