Jump to content
Sign in to follow this  

Outlook VBS-AU3

Recommended Posts


Hi everyone

I was wondering if someone could point me in the right direction for converting this vbs script to autoit. I'm sure there must be a way. The script will return the number of outlook unread messages.

Thanks in advance for the help.

Set otl = createobject("outlook.application")

Set session = otl.getnamespace("mapi")


Set inbox = session.getdefaultfolder(6)

c = 0

For Each m In inbox.items

If m.unread Then c = c + 1



s = "s"

If c = 1 Then s = ""

msgbox c & " unread message" & s

Share this post

Link to post
Share on other sites

I seem to have it. Sorry for the preemptive post, it was rather simple really. :)

$otl = ObjCreate("Outlook.Application")

$session = $otl.GetNameSpace("MAPI")

$inbox = $session.GetDefaultFolder(6)


For $m In $inbox.items

If $m.unread Then $c = $c + 1



$s = "s"

If $c = 1 Then $s = ""

msgbox (0,"",$c & " unread message" & $s,10)

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.