DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Key Macros for MS WORD  (Read 10,208 times)

TWmailrec

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 130
    • Coding Snacks
Key Macros for MS WORD
« on: June 03, 2006, 01:44 AM »
In order to standardise numerous functions like 'Edit new file' or various cut/paste functions for many different applications, I tried to add key macros to  Skrommels "ShiftOff" program which is automatically run at startup

This works fine for all programs EXCEPT MSWORD! In MSWORD 2000, no programed key macros work when following code is added to CAPXShft.ahk

_______________________________________________________

CODE:

Progchk:

WinGetActiveTitle, ActiveTitle
;  MsgBox , 0, Warning, ActiveTitle is "%ActiveTitle%" /I_Editor=%I_Editor%, 5

IfInString, ActiveTitle, soft%A_Space%Word
Goto msWord
IfInString, ActiveTitle, PowerDesk
Goto PwDeskAct

IfNotInString, ActiveTitle, %I_Editor%
Return

_______________________________________________________

It works fine with powerdesk & EditPad Pro, but the macro section, when coded as a stand-alone exe also doesnt work in MSWord.
Is there some error in programming?
I have included a trimmed down version of CapXShft as a downloaded ZIP file

TWmailrec
TWmailrec@aol.com

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • Participated in NANY Challenge Twice
    • Coding Snacks
Re: Key Macros for MS WORD
« Reply #1 on: June 14, 2006, 07:24 AM »
:) Hi, TWmailrec!

Try adding SetTitleMatchMode,2 to the start of the script. Without it you can't match other than the start of a window's title.

Skrommel

TWmailrec

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 130
    • Coding Snacks
Re: Key Macros for MS WORD
« Reply #2 on: June 18, 2006, 12:43 AM »
:)Hi Skrommel

I noticed that MSWord 2000 which came with Win98, will not handle
#IfWinActive Microsoft Word
F1::
All "#IfWinActive" stats are ignored so I have just corrected problem by swapping macro program with one containing only WORD macros and ShiftOff:

; -------------------------------------------------------
; Configuration:
DetectHiddenWindows, On
SetTitleMatchMode, 2  ; In case it's 3. This setting is in effect only for this thread.
SetKeyDelay, 0
#SingleInstance force
#Persistent
Thread, interrupt, 0 ; Make all threads always-interruptible
SetTimer, Progchk, 1000
...
ShiftOff S/routine
...
; -------------------------------------------------------
Progchk:

; Active window check:  ;;

SetTitleMatchMode, 2  ; In case it's 3. This setting is in effect only
                                ;for this thread.
WinGetActiveTitle, ActiveTitle

IfInString, ActiveTitle, soft%A_Space%Word
Goto, msWord

Return

IfInString, ActiveTitle, PowerDesk
Goto, PwDeskAct
IfNotInString, ActiveTitle, %I_Editor%
Return

; -------------------------------------------------------
msWord:

run, %I_Macrerun%\CapXShft.exe    ;Macro program for WORD only &
;                                                  ShiftOff s/r
ExitApp

; ... remaining hotkeys
; -------------------------------------------------------

It now works great for WINXP, but ShiftOff wont work under WIN98 which seems to ignores all "Hotkey, Key, Label"  statements. in MSWORD, so parsing ini file to create Hotkey assignments fails.
Hotkey assignmnets work under 98 for all other programs??

Since almost nobody else uses WIN98, this shouldnt matter!

Is there a better way to clear all previous "Hotkey, Key, Label" assignmnets when swithing programs aside from my method of rerunning macro .exe (ahk) program? It seems clumsy.

Regards,
TWmailrec

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • Participated in NANY Challenge Twice
    • Coding Snacks
Re: Key Macros for MS WORD
« Reply #3 on: July 02, 2006, 12:34 PM »
:) Check out AutoHotkey's Suspend command.

Skrommel

TWmailrec

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 130
    • Coding Snacks
Re: Key Macros for MS WORD
« Reply #4 on: July 04, 2006, 02:46 PM »
So far, have only used suspend on TRAYMENU:.
I will try using it to kill previous Hotkey assignments.

Many thanks
TWmailrec

Original address: https://www.donationcoder.com/forum/index.php?topic=3884.0