rogerd2u Posted November 24, 2008 Share Posted November 24, 2008 (edited) Has anyone created a script (or would be willing to help me create a script) to check if Outlook is offline? I want to have a script that will check to see if Outlook (2003/2007) is offline. If it is, I want the script to set Outlook online.Any help will be GREATLY appreciated.When doing a search through the forum, I found the following code snipet, but I'm having trouble getting it to work:Const $PR_STORE_OFFLINE = 0x6632000BConsoleWrite(IsOutlookOnline() & @CR);MsgBox(0, "Outlook Offline?", IsOutlookOnline())$outlookstatus = IsOutlookOnline()$on = "online"$off = "offline"if $outlookstatus = 0 then msgbox(0, "", $off)if $outlookstatus = 1 then msgbox(0, "", $on) Func IsOutlookOnline() Local $oSession, $oInfoStore, $bOffline $oSession = ObjCreate("MAPI.Session") ; Use the existing Outlook session $oSession.Logon ("", "", False, False) $oInfostore = $oSession.GetInfoStore($oSession.Inbox.StoreID) ; Check if it's offline $bOffline = $oInfostore.Fields($PR_STORE_OFFLINE) ;PR_STORE_OFFLINE $oInfoStore = 0 $oSession = 0 If $bOffline Then Return 0 $OutlookOffline = "Yes" Else Return 1 $OutlookOffline = "No" EndIfEndFunc Edited November 24, 2008 by rogerd2u Roger O."When people show you who they are, believe them. --Mark Twain Link to comment Share on other sites More sharing options...
Bert Posted November 24, 2008 Share Posted November 24, 2008 When you run the script, you need to give IsOutlookOnline() a variable name. example: $outlookstatus = IsOutlookOnline() $on = "online" $off = "offline" if $outlookstatus = 0 then msgbox(0, "", $off) if $outlookstatus = 1 then msgbox(0, "", $on) The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
rogerd2u Posted November 24, 2008 Author Share Posted November 24, 2008 (edited) Thanks for the assistance! When I run the script, it always says Outlook is online, even when I manually set Outlook to "Work Offline." I'm currently using Outlook 2003.BTW: I have updated my script in my original post.When you run the script, you need to give IsOutlookOnline() a variable name. example:$outlookstatus = IsOutlookOnline()$on = "online"$off = "offline"if $outlookstatus = 0 then msgbox(0, "", $off)if $outlookstatus = 1 then msgbox(0, "", $on) Edited November 24, 2008 by rogerd2u Roger O."When people show you who they are, believe them. --Mark Twain Link to comment Share on other sites More sharing options...
Bert Posted November 24, 2008 Share Posted November 24, 2008 hmmm, I wonder if it is checking to see if the server is available or not. You may want to check MSDN to see what the object model is of Outlook. http://msdn.microsoft.com/en-us/library/aa221870.aspx The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
rogerd2u Posted November 24, 2008 Author Share Posted November 24, 2008 I have looked through the link you provided but came up empty-handed. Is it possible to just create a script that will switch to Outlook and then read the status in the lower right-hand corner; or possibly one that could check for the presence of a checkmark next to "Work Offline" (Open Outlook --> Alt-F --> Look for checkmark on "Work Offline")?hmmm, I wonder if it is checking to see if the server is available or not. You may want to check MSDN to see what the object model is of Outlook. http://msdn.microsoft.com/en-us/library/aa221870.aspx Roger O."When people show you who they are, believe them. --Mark Twain Link to comment Share on other sites More sharing options...
rogerd2u Posted November 25, 2008 Author Share Posted November 25, 2008 No one has any thoughts or suggestions on how to get this done?!? Roger O."When people show you who they are, believe them. --Mark Twain 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