RegRead Problems?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Iomega0318
Posts: 83
Joined: 06 Apr 2015, 14:56
Location: Wolfforth, TX
Contact:

RegRead Problems?

12 May 2015, 12:00

So our IT has some of the people here on Office 2013 and some on Office 2010, however those with 2013 also still have 2010 installed. They just recently upgraded mine to 2013 so I figured I would uninstall 2010 since it was not needed.. However and this is where the problem comes in, I had been using the following piece of code to tell if someone was using 2013 or 2010 and it works fine on other computers with 2013 or 2010, it will also work if you have BOTH versions installed but only use 2013, however because I removed 2010 from mine it seems to throw a fit when trying to run the script as shown in the video below:

https://vid.me/D105

Code: Select all

	RegRead, OutLookVer, HKCR, Outlook.Application\CurVer
	; Required for Outlook 2013
	if OutLookVer = Outlook.Application.14
	{
		; Outlook 2010
		ControlFocus, _WwG1, Untitled - Message (HTML) ahk_class rctrl_renwnd32 ; Set focus on the email body
		SendInput, %body%
	}
	else if OutLookVer = Outlook.Application.15
	{
		; Outlook 2013
		ControlFocus, RichEdit20WPT4, Untitled - Message (HTML) ahk_class rctrl_renwnd32 ; Set focus on the subject line
		Send {Tab}
		clipboard = %body%`r`n
		Send ^v
	}
	
	; Mark email as high importance
	SendInput, {Alt}h
	SendInput, H
	
	RegRead, OutLookVer, HKCR, Outlook.Application\CurVer
	; Required for Outlook 2013
	if OutLookVer = Outlook.Application.14
	{
		; Outlook 2013
		OnMessage(0x44, "Center_MsgBox_Email_14")
		MsgBox, 4, Attachments, Would you like to add any attachments?, 25 ; 25-second timeout.
		IfMsgBox, Yes ; User pressed the "Yes" button.
		{
			Sleep, 1000
			SendInput, {Alt}n
			SendInput, AF
			WinWait, Insert File ahk_class #32770
			IfWinNotActive, Insert File ahk_class #32770
				WinActivate, Insert File ahk_class #32770
			WinWaitActive, Insert File ahk_class #32770
			Sleep, 500
			SendInput, M:\BILLING\Manual Invoices (RIMS) ; Folder to open
			SendInput, {Enter}
		}
		ExitApp
		IfMsgBox, No ; User pressed the "No" button.
			ExitApp
		IfMsgBox, Timeout ; i.e. Assume "No" if it timed out.
			ExitApp
		; Otherwise, continue:
	}
	else if OutLookVer = Outlook.Application.15
	{
		; Outlook 2013
		OnMessage(0x44, "Center_MsgBox_Email_15")
		MsgBox, 4, Attachments, Would you like to add any attachments?, 25 ; 25-second timeout.
		IfMsgBox, Yes ; User pressed the "Yes" button.
		{
			Sleep, 1000
			SendInput, {Alt}n
			SendInput, AF
			WinWait, Insert File ahk_class #32770
			IfWinNotActive, Insert File ahk_class #32770
				WinActivate, Insert File ahk_class #32770
			WinWaitActive, Insert File ahk_class #32770
			Sleep, 500
			SendInput, M:\BILLING\Manual Invoices (RIMS) ; Folder to open
			SendInput, {Enter}
		}
		ExitApp
		IfMsgBox, No ; User pressed the "No" button.
			ExitApp
		IfMsgBox, Timeout ; i.e. Assume "No" if it timed out.
			ExitApp
		; Otherwise, continue:
	}
If I remove all the parts looking for Office 2010 it works fine on my computer having removed Office 2010, but I need it to work on both versions since they work slightly differrent.. Does anyone have an ideas on this one? Or maybe a better way to code this part?
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: RegRead Problems?

12 May 2015, 12:08

?
MsgBox, % ComObjActive("Outlook.Application").Version
User avatar
Iomega0318
Posts: 83
Joined: 06 Apr 2015, 14:56
Location: Wolfforth, TX
Contact:

Re: RegRead Problems?

12 May 2015, 12:20

I get an invalid class string when trying to run that..

**EDIT**
If I change it to:
MsgBox, % ComObjActive.("Outlook.Application").Version
It will run but comes up blank..
User avatar
Iomega0318
Posts: 83
Joined: 06 Apr 2015, 14:56
Location: Wolfforth, TX
Contact:

Re: RegRead Problems?

14 May 2015, 12:26

Well until I can find a better solution I just removed it and have 2 versions of the script, one for 2010 and one for 2013..

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Joey5 and 204 guests