Check status of a program with autohotkey

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
anhnha
Posts: 116
Joined: 08 Aug 2018, 02:46

Check status of a program with autohotkey

12 Aug 2018, 03:22

I am having some troublesome as switchinging to type Vietnamese, English and Korean frequently. I usually have to swich between these languages regularly.
Unfortunately, with Windows Pro 10 there is no TELEX mode for Vietnamese so I had to install Unikey to type Vietnamese in TELEX mode.

So here is what I did:
1. For Vietnamese/English use Unikey software. Press Ctrl + Shift to toggle between Vietnamese and English
2. For Korean/English I use Hangul/English toggle to toggle between Korean and English.
Please look at the attach picture to see more detail about these software.
However, these programs interfer with each other.
So to type Vietnamese I have to make sure that Hangul/English toggle is in English mode not Korean mode.
Similarly to type Korean I have to make sure that Unikey is in English mode so they do not interfere with each other.

For example, currently state for Korean typing: Unikey is set to English mode and Hangul/English toggle is in Korean mode.
Now I would like to switch to Vietnamese mode, then
I have to use at least 3 keys.
1. Ctrl + Shift to toggle Unikey to English mode
2. Press Alt to switch Hangul/English toggle to English mode

This is really annoying as I have to switching back and forth frequently.

I'd like to ask our members here if there is a method to make this simpler with Autohotkey.
I am planing to write a program as follows:

Type Vietnamese:
I just have to press Ctrl + Shift or some key then the program will check whether Hangul/English toggle is English or Korean mode. If it is in Korean mode then switch it to English mode also Unikey is switched to Vietnamese mode.
Type Korean:
I just have to press Alt then the program will check whether Unikey is English or Vietnamese mode. If it is in Vietnamese mode then switch it to English mode also Hangul/English toggle is toggled to Korean mode.

I am new to autohotkey and also I don't know how to check status of Unikey or Hangul/English toggle whether it is in Korean/English/Vietnamese mode so I can write a program.
So hope someone has some idea to do this.
https://autohotkey.com/boards/download/file.php?id=4738
uni.PNG
uni.PNG (32.07 KiB) Viewed 883 times
terraformars
Posts: 1
Joined: Today, 00:12

Re: Check status of a program with autohotkey

Today, 00:32

I use this library to detect the state of Unikey though the current tooltip of the tray icon and change it by left clicking on it.
viewtopic.php?p=9186#p9186
Press F1 to turn on EN mode, F2 to turn on VN mode.

Code: Select all

#Include D:\AutoHotkey\tray_icon.ahk

UnikeyENMode(ENModeON)
{
	DetectHiddenWindows, % (Setting_A_DetectHiddenWindows := A_DetectHiddenWindows) ? "On" :
	oIcons := {}
    oIcons := TrayIcon_GetInfo("UniKeyNT.exe")
    tooltip := oIcons[1].tooltip
	msgID  := oIcons[1].msgID
	uID    := oIcons[1].uID
	hWnd   := oIcons[1].hWnd
    IfInString, tooltip, on ;If there is "on" in tooltip, then the EN mode is on
    {
        isENMode := true
    }
    else IfInString, tooltip, off ;If there is "off" in tooltip, then the VN mode is on
    {
		isENMode := false
    }
	if (!ENModeON != !isENMode) ;Click on the icon if the current state is different from desired state
	{
		PostMessage, msgID, uID, 0x0201, , ahk_id %hWnd%
		PostMessage, msgID, uID, 0x0202, , ahk_id %hWnd%
	}
	DetectHiddenWindows, %Setting_A_DetectHiddenWindows%
}

$F1:: ;Turn on VN mode
	UnikeyENMode(true)
return

$F2:: ;Turn on EN mode
	UnikeyENMode(false)
return
The solution for detecting the current state of IME can be found here:
https://www.autohotkey.com/board/topic/7299-help-me-international-users-t-t-ime/

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: RandomBoy, scriptor2016 and 355 guests