How to Change the Font of Hotstring Text Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
BannerStore
Posts: 87
Joined: 06 Sep 2017, 19:29

How to Change the Font of Hotstring Text

17 Dec 2020, 23:58

Is there a way to change the font for a hotstring command?

I've searched for this in the manual as well as the forum but I wierdly can't find anything. I'm sure somebody must have asked this before.

1. I want to be able to insert text in different fonts. I want to do this in all types of programs, not just Microsoft Word. I'm looking for a universal solution.

2. I want the font to revert back to the original font after the hotstring is inserted.

3. Is there also a way to control the font size?

Thanks in advance for any help. I would greatly appreciate! :D
Rohwedder
Posts: 7656
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: How to Change the Font of Hotstring Text

18 Dec 2020, 03:17

Hallo,
unfortunately, there is no generally accepted standard for encoding formatting. Microsoft in particular fights against this.
An English Ms Word even uses a different encoding than a German one!

Code: Select all

F1::Send, We want to ^bthese words bold^b ;english Ms Word  (b = bold)
F2::Send, We want to ^+fthese words bold^+f ;german Ms Word (F = Fettdruck)
F3::Send, We want to ^gthese words bold^g ;french Ms Word (g = en gras)
F4::Send, We want to ^nthese words bold^n ;spanish Ms Word (n = negrita)
; ...
BannerStore
Posts: 87
Joined: 06 Sep 2017, 19:29

Re: How to Change the Font of Hotstring Text

19 Dec 2020, 09:18

Wow, there really is no way?

For example, there is no way for me to insert the arrow symbol, 🡆 into all programs in Windows (not just Microsoft Office)?

I've created a hotstring to insert 🡆 into programs but it doesn't work for Microsoft Office. That really stinks.
Rohwedder wrote:
18 Dec 2020, 03:17
Hallo,
unfortunately, there is no generally accepted standard for encoding formatting. Microsoft in particular fights against this.
An English Ms Word even uses a different encoding than a German one!

Code: Select all

F1::Send, We want to ^bthese words bold^b ;english Ms Word  (b = bold)
F2::Send, We want to ^+fthese words bold^+f ;german Ms Word (F = Fettdruck)
F3::Send, We want to ^gthese words bold^g ;french Ms Word (g = en gras)
F4::Send, We want to ^nthese words bold^n ;spanish Ms Word (n = negrita)
; ...
User avatar
mikeyww
Posts: 26973
Joined: 09 Sep 2014, 18:38

Re: How to Change the Font of Hotstring Text

19 Dec 2020, 10:05

If the character has an ASCII or Unicode code, you can insert it universally (can also use virtual keys and scan codes). If it requires a proprietary or unique formatting step, then you can't.

https://www.autohotkey.com/docs/commands/Send.htm

If you have several programs with different formatting steps, you could write a script to accommodate all of them, as long as you know what the steps are.

The appearance of your arrow in this forum post illustrates the issue.
Rohwedder
Posts: 7656
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: How to Change the Font of Hotstring Text  Topic is solved

20 Dec 2020, 05:18

Maybe this also helps (untested):
WinClip by Deo
WinClip is a clipboard manipulation class extending AutoHotkey's clipboard capabilities including support for RTF, HTML and images.
https://autohotkey.com/board/topic/74670-class-winclip-direct-clipboard-manipulations/

Your script has a collection of text formatted with HTML.
A selection of it is written to the clipboard with WinClip.SetHTML(), which is then pasted to your application.
User avatar
mikeyww
Posts: 26973
Joined: 09 Sep 2014, 18:38

Re: How to Change the Font of Hotstring Text

20 Dec 2020, 07:17

Terrific idea! Thank you, @Rohwedder.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Rohwedder and 271 guests