I would like to make message pop-up in Autohotkey when there is new message in Outlook. I have tried to use ComObjActive("Outlook.Application") with no joy. Also documentation for COM objects is pretty vague on Autohotkey site. Message should be like msgbox New Mail Received. This is similar to default message pop-up in Outlook. I just need this in AHK.
Main reason is that I'm using Desktops from Sysinternals. This program makes 4 separated desktops. When I run outlook on one desktop, I can't see new message pop-up from outlook on the other desktop. I need a simple AHK script that will tell me when there is a new mail, when I'm on different desktop than the one that is running Outlook.
In the System-StatusBar, their is an icon of outlook, which changes\animates for sometime when a new mail is received.
We can use AutoHotKey > ImageSearch/PixelSearch for the same to find the difference.
Add a SetTimer with ImageSearch/PixelSearch.
Compare and If difference is found >> You Got A Mail.
As Simple As That. If you need futher help with Scripting, Please feel free :)
Hope this Helps :)
I'm not used to AHK but after some research I came up with the following AHK script which should do what you need:
oOutlook = ComObjActive("Outlook.Application")
ComObjConnect(oOutlook, "outlook_")
return
outlook_NewMail() ;uses the COM event NewMail
{
msgbox New Mail Received
oOutlook.Visible := 1 ;make Outlook visible
oOutlook.Activate ;and bring to front
}
To stop listening to the outlook COM events use
ComObjConnect(oOutlook)
Related
My Outlook web add-in saves emails to an external application.Upon save, it will also write some custom information to exchange server using Office.js's customProps.saveAsync();. So next time the user open the same email, the add-in will look up the properties and if it is not null will remind the user the email has been saved.
Work like a charm in web browser(Office 365).
However in Windows Outlook desktop, the function performs strangely. If I save the email and then immediately move the email to another folder. The customProps.saveAsync(); will fail(nothing saved to exchange server). However, if I re-launch the add-in on the email before moving out to another folder, the custom info will be saved successfully.
Seems to me on Outlook desktop the custom properties will not be written to the exchange server immediately, instead, it will wait until it is being triggered(re-launch add-in etc I do not know the exact mechanism). However, if the email being moved to another folder right after being saved in an add-in, the pending function will be lost.
I found this describing seemingly similar behavior. So I then turned off the "cache" mode in outlook but the problem persisted.
I also tried using EWS's API to perform the "save custom properties", but the problem still persisted.
Am I missing somethinghere or it is Outlook desktop's bug?
You are not missing something - this is definitely a bug in Outlook Desktop. Thank you for reporting the issue. We are investigating and will work on a fix as quickly as we can.
As a workaround in the interim, you can switch messages within the same folder in order to trigger a save. The workaround you found of re-opening an Add-in may also work.
I am writing VSTO Outlook add-in that needs to save some items as msg files. The problem is, each time I call MailItem.SaveAs it causes Outlook to lag slightly and show processing cursor (blue circle).
I have tried moving it int a separate thread, but that does not help.
Saving item is quite fast (less than 100 ms most of the time), but still causes this annoying behavior.
I need to save an item to read it as MSG format, so if I can do this directly this would be even better, but as I found here:
Outlook MailItem as Stream
the only solution seems to use EWS for this. Are there other alternatives?
Maybe using RDO can help in this case?
Another option, as I understand, create msg manually from mail item properties. But maybe there is an easier way?
Unlike OOM, a low level API on which Outlook is based on (Extended MAPI) supports multithreading. So, you can run the code on a secondary thread without any visible impact to the Outlook UI. See INFO: Save Message to MSG Compound File for more information.
Also you may consider using third-party wrappers around Extended MAPI such as Redemption.
Solved! See [SOLUTION]
Thanks for any help you can provide. It's much appreciated!
In a nutshell: I'm trying to send Ctrl+V to SSMS 2012 with SendKeys.Send("^{v}"), but it doesn't work. It's working fine with Notepad, UltraEdit, Word, Excel, Chrome, you name it. It even works in Microsoft Visual Studio 2010.
In details: I have an application that runs in the background. Using a keyboard shortcut, this application displays a popup window with options. Depending on the option I choose it saves what's related to it into the clipboard. I then close that popup window, get the new foreground window (which should be the one I had before displaying the popup) and try to paste what's in my clipboard with SendKeys.
It works with pretty much every application I try it with, except SSMS
If I manually press Ctrl+V it pastes what I have in my clipboard (text usually)
I've added some code to display the title of the window I got with the GetForegroundWindow and it does give me the correct SSMS window
What's sad about all this is that once in a while (very rarely), the text is correctly pasted in SSMS, but it doesn't work the second after.
I never get the MessageBox saying the SetForegroundWindow failed.
If I replace the single SendKey with 3 SendKeys to send "A", "B" and "C", B and C are sent but not A. Yes I've tried using a sleep thinking it needed time to write the first SendKey, but that didn't change anything.
I did try SendKeys.SendWait instead, but didn't get different results.
Here's the code from the moment I close the popup
this.Close();
IntPtr handle = GetForegroundWindow();
if (!handle.Equals(IntPtr.Zero))
{
if (SetForegroundWindow(handle))
{
//Optionnal just to show the window title
const int nChars = 256;
StringBuilder Buff = new StringBuilder(nChars);
if (GetWindowText(handle, Buff, nChars) > 0)
{
MessageBox.Show(Buff.ToString());
}
//[SOLUTION] Sending a useless key seems to solve my SSMS problem without affecting the other applications.
SendKeys.Send("{F14}");
//Sending Ctrl+V
SendKeys.Send("^{v}");
}
else
{
MessageBox.Show("SetForegroundWindow failed");
}
}
Hope someone can help.
Thanks in advance!
See http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx
...
The SendKeys class is susceptible to timing issues, which some developers have had to work around. The updated implementation is still susceptible to timing issues, but is slightly faster and may require changes to the workarounds. The SendKeys class tries to use the previous implementation first, and if that fails, uses the new implementation. As a result, the SendKeys class may behave differently on different operating systems. Additionally, when the SendKeys class uses the new implementation, the SendWait method will not wait for messages to be processed when they are sent to another process.
...
Is there any Applescript available that sends either an URL or array of images as attachment of the mail through Mac Office 2011?
Also see:
MS Outlook 2011 sp1 V14.1.0 changes the apple script dictionary..
http://www.officeformachelp.com/2011/04/microsoft-updates-applescript-dictionary-for-outlook-2011-sp1/
also:
run send all -- forces mail in out box to be sent right now
Seeing as how Office 2011 is very new, I'd be surprised you'll find ready-made code to use outside of an example script given with Office. This is where the Dictionary comes in; the Dictionary tells you everything that an application responds to, what objects can be manipulated, etc. When scripting an application for the first time, the Dictionary will always be the first thing you look at.
What you are asking doesn't seem like it would be too hard figure out even for someone who is new to Applescript.
UPDATE: Here is teh codez for Entourage 2008. I would imagine that v2011 wouldn't stray too much from this because it is very straightforward:
tell application "Microsoft Entourage"
set newMessage to make new outgoing message with properties {subject:"New Outgoing Message Subject", recipient:"email#domain.com", content:"Message Body", attachment:{pathToFile1, pathToFile2}}
end tell
--> RESULT: A new message appears in the Outbox with the content placed
You know the one I mean:
Is there a way to disable this?
I'm writing an application to automatically test a large number of Excel spreadsheets which are used in a critical environment. Many of these sheets do crazy things which crash Excel. When Excel crashes I want it to terminate ASAP and without user-intervention.
I definitely do not want to re-start excel.
I do not want the excel.exe process to hang-around waiting for somebody to click on "Don't Send"
And I never never want to report the details of my crash to Microsoft!
It a system service that you can easily turn off
Turn off Error Reporting in Microsoft Windows XP Professional
If that doesn't work go to Control Panel / Admin tools / Services and stop and disable the "Error Reporting Service"
Can you somehow detect that Excel has crashed? You can use TerminateProcess function after that, which removes the process for good. There's an article about it on Raymond Chen's blog.