AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need help in this error

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Elaine
Guest





PostPosted: Wed Mar 03, 2010 1:36 am    Post subject: Need help in this error Reply with quote

Hi.
I have encounter a small problem in my program which i don't know how to solve. below is my program

Code:
retrievename()
{
   ;msgbox hi
   COM_Init()
   ol:=COM_GetActiveObject("Outlook.Application")
From:=COM_Invoke(ol,"ActiveInspector.CurrentItem.SenderName")
Subject:=COM_Invoke(ol,"ActiveInspector.CurrentItem.Subject")    Email:=COM_Invoke(ol,"ActiveInspector.CurrentItem.SenderEmailAddress")
}


This program retrieve the information of the sender in outlook. This program will run well if i uncomment the msgbox hi for the first time. After running the program with the uncomment msgbox. I comment the msgbox and it run successfully throughout.

Until i restart my computer, i run the program again and it shows an error again. The error is

Quote:
Function name: "Active Inspector"
Error: The COM object may not be a valid Dispatch object!
First ensure that COM library has been initialized through COM_INIT


After I click Yes, the function name will change to currentItem then sendername. I need to click yes until it shows me all the COM_invoke function error. After I click yes throughout, the program will work successfully throughout the time until i restart the computer and I need to do the same thing over again.

Is there a way i can solve this problem? right now is either i put a msgbox for the first time or i click yes throughout in order for it to work.

Your help is appreciated.
Thank you.
Back to top
Andi



Joined: 11 Feb 2005
Posts: 173
Location: Germany

PostPosted: Fri Mar 05, 2010 12:08 pm    Post subject: Reply with quote

Try to release COM.

Has someone perhaps a solution for ahk to avoid the Outlook security check?

See also here Rolling Eyes
http://msdn.microsoft.com/de-de/library/aa168346(en-us,office.11).aspx

Code:

retrievename()
{
   ;msgbox hi
   COM_Init()
   ol:=COM_GetActiveObject("Outlook.Application")
   From:=COM_Invoke(ol,"ActiveInspector.CurrentItem.SenderName")
   Subject:=COM_Invoke(ol,"ActiveInspector.CurrentItem.Subject")
    Email:=COM_Invokeol,"ActiveInspector.CurrentItem.SenderEmailAddress")
   COM_Release(ol)
   COM_Term()
}
Back to top
View user's profile Send private message
marmar63



Joined: 15 Apr 2010
Posts: 22

PostPosted: Fri Jul 02, 2010 7:01 pm    Post subject: fun with Outlook and AHK Reply with quote

Where can I find a nice, handy list of objects that ActiveInspector can hit? Can I generate one?

I tried googling it, but to be honest I really don't know what the proper name of the "list of objects hat ActiveInspector can hit", so as to be able to generate a good search.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group