Slow Text in MS Outlook

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Hutch

Slow Text in MS Outlook

09 Jun 2017, 07:10

Good morning, Gurus. I'm having problems with the scripts I use to send quick replies in emails. They used to work quickly, but they recently installed Office 365 Pro on my work computer, and I have noticed a HUGE difference in the speed at which my scripts send the text to the open Outlook message. I start all my scripts with the following code:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
And here is an example of the script that is running so slowly:

Code: Select all

::trgtreply::
InputBox, Name#, Enter a First Name.
InputBox, Vendor#, Enter the Vendor Name.
WinWait, ahk_class rctrl_renwnd32, 
IfWinNotActive, ahk_class rctrl_renwnd32, , WinActivate, ahk_class rctrl_renwnd32, 
WinWaitActive, ahk_class rctrl_renwnd32,
Send, Thanks, %Name#%.{ENTER}{ENTER}Your price has been updated, and %Vendor#% will remain PV.  Please note that these prices will take effect this coming Monday.  Any orders already in the system should be filled at the existing price, and any orders placed beginning this coming Monday will reflect these new prices.{ENTER}{ENTER}Have a good one.
Exit
Thanks in advance for any help you can offer. Have a good one.
Still Hutch

Re: Slow Text in MS Outlook

09 Jun 2017, 09:55

Bump please. I didn't find any help in my search. Thanks.
Hutch
Posts: 3
Joined: 09 Jun 2017, 07:33

Re: Slow Text in MS Outlook

12 Jun 2017, 07:56

Is there a workaround or a fix for the slow text when using hotstrings? Any help GREATLY appreciated. Have a good one.
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Slow Text in MS Outlook

12 Jun 2017, 16:04

Hutch wrote:Is there a workaround or a fix for the slow text when using hotstrings? Any help GREATLY appreciated. Have a good one.
You might try putting the text on the clipboard and then pasting it.

Code: Select all

Clipboard := "Thanks, " Name# ".`n`nYour price has been updated, and " Vendor# " will remain PV.  Please note that these prices will take effect this coming Monday.  Any orders already in the system should be filled at the existing price, and any orders placed beginning this coming Monday will reflect these new prices.`n`nHave a good one."
Send ^v
New Office software has an animated typing thing that is supposed to be fancier but I hate it. In Excel the text slides in to place when updating and all typing is buffered and then revealed in an animated way.

You can turn off these annoying animations in a Windows settings but then it also turns off useful animations like the marching ants outline when you are coping cells in Excel.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Slow Text in MS Outlook

12 Jun 2017, 16:31

Check out if its still possible to open Outlook with a predefined template (that contains your text above).
http://it.peikkoluola.net/2013/12/19/cr ... -line-bat/
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Slow Text in MS Outlook

12 Jun 2017, 19:25

BoBo wrote:Check out if its still possible to open Outlook with a predefined template (that contains your text above).
http://it.peikkoluola.net/2013/12/19/cr ... -line-bat/
Before I went the route of command line bat, I would just use COM.

COM is really the way to go when dealing with Outlook or any MS Office program.

Code: Select all

#F11::
	MailItem := ComObjActive("Outlook.Application").ActiveWindow.CurrentItem	; Expects an Email to be open
	MailItem.Body := "This is a test."	; Make the body of the email this
return

#F12::
	MailItem := ComObjActive("Outlook.Application").ActiveWindow.CurrentItem	; Expects an Email to be open
	MailItem.Body := MailItem.Body "More Stuff"	; Add stuff to the body of email
return
There are a ton of useful things you can do with Outlook through COM.

Stuff like save attachments to certain folders based on properties of the attachment. Highlight a hundred emails, hit one key and all the attachments from all the emails are saved to certain folders. I use this primarily not to really save all attachments but just look for image attachments and save them to folders based on emails' subject.

When composing an email, list all attachments at the end of an email in a nice table.

Create a link to a Dropbox folder and list a tree of all files and subfolders files while also highlighting recently added files. Been meaning to add that all the files in the tree list are created as links so that any individual file in the list can be downloaded individually but never got around to adding that.

I use several scripts every day that control Outlook through COM.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Slow Text in MS Outlook

13 Jun 2017, 02:11

@ FG
Stuff like save attachments to certain folders based on properties of the attachment. Highlight a hundred emails, hit one key and all the attachments from all the emails are saved to certain folders. I use this primarily not to really save all attachments but just look for image attachments and save them to folders based on emails' subject.

When composing an email, list all attachments at the end of an email in a nice table.

Create a link to a Dropbox folder and list a tree of all files and subfolders files while also highlighting recently added files. Been meaning to add that all the files in the tree list are created as links so that any individual file in the list can be downloaded individually but never got around to adding that.
I use several scripts every day that control Outlook through COM.
Can we/nnobs find some/all of these here at the forum? Might come handy to absorb the concept of COM ! :)
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Slow Text in MS Outlook

13 Jun 2017, 12:53

BoBo wrote:Can we/nnobs find some/all of these here at the forum? Might come handy to absorb the concept of COM ! :)
There are lots of examples of COM use with Outlook and Excel on the forums.

Here are a few examples to get started:

Loop through selected emails.

Code: Select all

F12::
    Emails := ComObjActive("Outlook.Application").ActiveExplorer.Selection
    For Email in Emails
		MsgBox % Email.Subject
return
Loop through selected emails and save attachments and then open/run attachments. (warning: only use on trusted attachments)

Code: Select all

F12::
    Emails := ComObjActive("Outlook.Application").ActiveExplorer.Selection
    for Email in Emails
		for Attachment in Email.Attachments
			 if !(Attachment.FileName ~= "^image\d+") ; exlude image files often created by embedded images in email signatures
			{
				Attachment.SaveAsFile(A_Temp "\" Attachment.FileName)
				Run, % A_Temp "\" Attachment.FileName
			}
return
Save selected attachments and put list of saved file names on clipboard.

Code: Select all

F12::
    Attachments := ComObjActive("Outlook.Application").ActiveExplorer.AttachmentSelection
    Loop % Attachments.Count
    {
        FileName := Attachments.Item(A_Index).FileName
        FileName_List .= FileName "`n"
        Attachments.Item(A_Index).SaveAsFile(A_Desktop "\Temp\" FileName)
    }
    Clipboard := Trim(FileName_List, "`n ")
return
Create HTML format email with an embedded picture and url links.

Code: Select all

Recipient := "Them <[email protected]>"
Subject := "Reports"
Body = 
(Join
<a href="http://www.ahkscript.org/">http://www.ahkscript.org/</a><br>
<img src="%A_Desktop%\Temp\PictureTest.gif" />
)

if Recipient ~= "Them" ; Compose email differently depending on Recipient
	{
		Body = 
		(Join
		%Body%
		<br><a href="http://www.ahkscript.org/them">http://www.ahkscript.org/them</a>
		)
	}

;example of creating a MailItem and setting it's format to HTML
olMailItem := 0
MailItem := ComObjActive("Outlook.Application").CreateItem(olMailItem)
olFormatHTML := 2
MailItem.BodyFormat := olFormatHTML
MailItem.Subject := Subject
MailItem.HTMLBody := Body
Recipient := MailItem.Recipients.Add(Recipient)
Recipient.Type := 1 ; To: CC: = 2 BCC: = 3

MailItem.Display
FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
Hutch
Posts: 3
Joined: 09 Jun 2017, 07:33

Re: Slow Text in MS Outlook

19 Jun 2017, 13:32

Fanatic Guru - Sorry a little slow to respond. I had sort of given up but decided to check once more and see if anyone had responded. You solution worked great! While I was searching I had seen other suggestions to place the text on the clipboard first, but none of the directions were clear enough for me to follow. I appreciate your help, and I will mark this thread as "SOLVED". Have a good one.
Hutch
Posts: 3
Joined: 09 Jun 2017, 07:33

Re: Slow Text in MS Outlook

19 Jun 2017, 13:35

I am requesting a moderator mark this thread as solved. I couldn't find where to do it. Sorry.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, Google [Bot], RickC and 150 guests