topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday April 18, 2024, 10:59 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Key Macros for MS WORD  (Read 7503 times)

TWmailrec

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 130
    • View Profile
    • Donate to Member
Key Macros for MS WORD
« on: June 02, 2006, 08:44 PM »
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
[email protected]

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: Key Macros for MS WORD
« Reply #1 on: June 14, 2006, 02: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
    • View Profile
    • Donate to Member
Re: Key Macros for MS WORD
« Reply #2 on: June 17, 2006, 07:43 PM »
 :)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
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: Key Macros for MS WORD
« Reply #3 on: July 02, 2006, 07:34 AM »
 :) Check out AutoHotkey's Suspend command.

Skrommel

TWmailrec

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

Many thanks
TWmailrec