Page 1 of 1

running outlook from whereever it is (32bit or 64)

Posted: 26 Dec 2019, 09:29
by PENpal
I have been using AHK to send an email to a specific email set which should not change. It works perfectly on my machine but I want to share it with my coworkers. The trouble I am having is that the Outlook.exe is located in a different area in their computers. Is there a way to make it so I can use command line switches with this and still run outlook from wherever it is?

Here is the code I have, I have to change the file path each time but I am hoping with your help I can change that, thanks,

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
CoordMode, Mouse, Screen

if 0 != 1  ; The left side of a non-expression if-statement is always the name of a variable.
    MsgBox This script requires you to drop a file on it to activate.
GivenPath = %1%  ; Fetch the contents of the variable whose name is contained in A_Index.
    Loop %GivenPath%, 1
        LongPath = %A_LoopFileLongPath%
FACID := SubStr(LongPath, -12 , 9)
MouseGetPos, OutputVarX, OutputVarY
InputBox, refno, Reference Number, Please Enter the Reference Number from the CO,,200,150, OutputVarX, OutputVarY 
if ErrorLevel
;msgbox, %FACID%

Run %comspec% /C ""C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE"/c ipm.note /m "[email protected] &[email protected]`; [email protected] &subject=%FACID% - %refno% - Date Extension Only" /a "%LongPath%"",,Hide
WinWait, %FACID% - %refno% - Date Extension Only
WinActivate, %FACID% - %refno% - Date Extension Only
Send,{Enter} Please see the attached Date Extension Only CO for the above referenced site

Re: running outlook from whereever it is (32bit or 64)

Posted: 26 Dec 2019, 10:42
by TheDewd
Try removing the path C:\Program Files (x86)\Microsoft Office\root\Office16\, and only use Outlook.exe.

This works on my computer.

Re: running outlook from whereever it is (32bit or 64)

Posted: 27 Dec 2019, 15:53
by PENpal
That doesn't work for me. I also tried C:\Outlook.exe and that didn't work either.