I looking for any script to change font colors in Microsoft word C:\Program Files\Microsoft Office\Office16\WINWORD.EXE
like when i press ctrl+1
color is white
when i press ctrl+2
color is red
any one help pls
some thing like this i geuss
^1::
oWord := ComObjActive("Word.Application")
wdColorRed = 0
oWord.Selection.Font.Color := wdColorRed
return
^2::
oWord := ComObjActive("Word.Application")
wdColorBlack = 50
oWord.Selection.Font.Color := wdColorBlac
return
but this only 2 colors i want other colors like green
I looking for any script to change font colors in Microsoft word
-
- Posts: 92
- Joined: 23 Nov 2020, 23:05
Re: I looking for any script to change font colors in Microsoft word
@omar bishr, see the code below:
Does that address your questions?
Code: Select all
^1::
oWord := ComObjActive("Word.Application")
wdRed := 6 ; https://docs.microsoft.com/en-us/office/vba/api/word.wdcolorindex
oWord.Selection.Font.ColorIndex := wdRed
return
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)
-
- Posts: 92
- Joined: 23 Nov 2020, 23:05
Re: I looking for any script to change font colors in Microsoft word
ok i found a way to custom your keyboard shortcut from the software so i make it
shift + ctrl + w
its white color
shift + ctrl + r
its red color
and i maked this script
i wanted to if scroll lock on and i pressed r its change to red color with out write r in the word
can you edit this ?
shift + ctrl + w
its white color
shift + ctrl + r
its red color
and i maked this script
Code: Select all
#If GetKeyState("ScrollLock", "T") && WinActive("ahk_exe WINWORD.exe")
$r::
SoundBeep, 1500, 20
Send r{ctrl Down}{shift Down}
Sleep, 200
SoundBeep, 1000, 20
Send r{ctrl Up}{shift up}
Return
$w::
SoundBeep, 1500, 20
Send w{ctrl Down}{shift Down}
Sleep, 200
SoundBeep, 1000, 20
Send w{ctrl Up}{shift up}
Return
can you edit this ?
- Attachments
-
- dc2c1979-a032-427f-989e-a4dbebbdd814.png (304.66 KiB) Viewed 365 times
Re: I looking for any script to change font colors in Microsoft word
Does this do what you are asking for?
Code: Select all
#If GetKeyState("ScrollLock", "P") && WinActive("ahk_exe WINWORD.exe")
r::ChangeColor(6) ; wdRed = 6
w::ChangeColor(8) ; wdWhite = 8
#If
ChangeColor(ColorIndex) {
oWord := ComObjActive("Word.Application")
oWord.Selection.Font.ColorIndex := ColorIndex
}
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)