chinese fonts in wingettext

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Jochen
Posts: 48
Joined: 17 Apr 2016, 11:25

chinese fonts in wingettext

27 Jul 2017, 01:18

If I am using wingettext I receive chinese fonts.

When I copy these chinese signs and fill them in here, they are correctly displayed.
Anyone got an idea?

Clipboard and language are correctly set to German,
Last edited by Jochen on 28 Jul 2017, 00:52, edited 1 time in total.
ahk7
Posts: 575
Joined: 06 Nov 2013, 16:35

Re: chinese fonts in getwintext

27 Jul 2017, 16:14

Sounds like a unicode issue, are you running the Ansi version? MsgBox % A_IsUnicode should display 0 if that is the case.
Try upgrading/switching to the Unicode version if not already. If you are running the unicode version be sure your script is save correctly as UTF-8
Jochen
Posts: 48
Joined: 17 Apr 2016, 11:25

Re: chinese fonts in getwintext

28 Jul 2017, 00:51

Thanks for your answer, ahk7.
MsgBox brings "1", so it is not ANSI if I understood you right.
Save was UTF-8 with signature; I changed it to only UTF-8, but had no effect.
I am using Notepad2 for editing and running the scripts.
just me
Posts: 9481
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: chinese fonts in wingettext

28 Jul 2017, 01:14

Do you get the wrong results for all windows or only for some? I noticed this behaviour with some versions of PSPad.

Which AHK / OS versions do you run?
Jochen
Posts: 48
Joined: 17 Apr 2016, 11:25

Re: chinese fonts in wingettext

28 Jul 2017, 05:44

hi just me,
- only for some windows (partially I already noticed a chinese font in a 16Bit Windows Program title)
- AHK 1.1.25.01 (regarding Windows - Programs and functions)
- Win7Pro 32 bit
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: chinese fonts in wingettext

28 Jul 2017, 06:07

Did you try an ANSI version of AutoHotkey?

You could try this in a Unicode version of AutoHotkey, in case it works:

Code: Select all

q::
WinGet, hWnd, ID, A
vChars := DllCall("GetWindowTextLength", Ptr,hWnd)+1
VarSetCapacity(vWinTitle, vChars*2, 0)
DllCall("GetWindowTextA", Ptr,hWnd, Ptr,&vWinTitle, Int,vChars)
vWinTitle := StrGet(&vWinTitle, "CP0")
MsgBox, % vWinTitle
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Jochen
Posts: 48
Joined: 17 Apr 2016, 11:25

Re: chinese fonts in wingettext

28 Jul 2017, 06:18

The script is working and I receive a MSG.
What does it mean now?....
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: chinese fonts in wingettext

28 Jul 2017, 06:23

The script attempts to get the window title, so if the MsgBox doesn't show the window title, then it suggests the script doesn't work.

You could also try AccViewer:
Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26201
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Jochen
Posts: 48
Joined: 17 Apr 2016, 11:25

Re: chinese fonts in wingettext

01 Aug 2017, 15:39

I guess this is a misunderstanding; I am receiving the MsgBox with the window title.
Got any idea?
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: chinese fonts in wingettext

01 Aug 2017, 16:56

GetWindowTextLength function (Windows)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
Retrieves the length, in characters, of the specified window's title bar text (if the window has a title bar). If the specified window is a control, the function retrieves the length of the text within the control. However, GetWindowTextLength cannot retrieve the length of the text of an edit control in another application.
So on that basis, it may be a technique that can retrieve text from your external window.

Btw did you have any luck with AccViewer? It's a window spy for getting information from windows/controls/GUI elements.

Code: Select all

q:: ;get text from Notepad's Find dialog
ControlGet, hWnd, Hwnd,, Static1, A
vChars := DllCall("GetWindowTextLength", Ptr,hWnd)+1
VarSetCapacity(vWinTitle, vChars*2, 0)
DllCall("GetWindowTextA", Ptr,hWnd, Ptr,&vWinTitle, Int,vChars)
vWinTitle := StrGet(&vWinTitle, "CP0")
MsgBox, % vWinTitle
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Jochen
Posts: 48
Joined: 17 Apr 2016, 11:25

Re: chinese fonts in wingettext

02 Aug 2017, 00:36

The subfolder C:\Program Files\AutoHotkey\Lib does not exist.
Shall I create it to copy acc.ahk and anchor.ahk?
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: chinese fonts in wingettext

02 Aug 2017, 00:52

If your AutoHotkey exe is in C:\Program Files\AutoHotkey, then I suppose so.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot] and 306 guests