Тема: AHK: изменение курсора в зависимости от языка ввода
Скрипт меняет курсор в зависимости от языка ввода. Меняются 2 курсора: основной (Arrow) и выделение (Ibeam).
cursor.rar СКАЧАТЬ
Курсоры и сам скрипт есть в архиве cursor.rar.
#NoEnv
#SingleInstance force
#Persistent
LIST=32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650,32651
OCR_IBEAM := 32513, OCR_NORMAL := 32512, OCR_APPSTARTING := 32650
OnExit, Exit
SetWorkingDir, %A_ScriptDir%/cursors
Loop, parse, LIST, CSV
{
Extension := (A_LoopField=32514 or A_LoopField=32650) ? ".ani" : ".cur"
If !FileExist(A_LoopField . Extension)
{
MsgBox, 48,, Не найден следующий файл:`n%A_LoopField%%Extension%
ExitApp
}
hCur := DllCall("LoadCursorFromFile", Str, A_LoopField . Extension)
DllCall("SetSystemCursor", UInt, hCur, Int, A_LoopField)
}
SetWorkingDir, %A_ScriptDir%
If !FileExist("EN_ARROW.cur") || !FileExist("RU_ARROW.cur")
|| !FileExist("EN_IBEAM.cur") || !FileExist("RU_IBEAM.cur")
|| !FileExist("EN_APPSTARTING.ani") || !FileExist("RU_APPSTARTING.ani")
{
MsgBox, 48,, Нет соответствующих курсоров в папке скрипта!
ExitApp
}
SetTimer, LocaleWatch, 100
LocaleWatch:
MouseGetPos,,, WinID
ThreadID := DllCall("GetWindowThreadProcessId", UInt, WinID, UInt, 0)
InputLocaleID := DllCall("GetKeyboardLayout", UInt, ThreadID)
if (InputLocaleID = Prev_InputLocaleID)
Return
bool := (InputLocaleID = 0x4090409)
hArrow := DllCall("LoadCursorFromFile", Str, (bool ? "EN" : "RU") . "_ARROW.cur")
hIbeam := DllCall("LoadCursorFromFile", Str, (bool ? "EN" : "RU") . "_IBEAM.cur")
hAPPSTARTING := DllCall("LoadCursorFromFile", Str, (bool ? "EN" : "RU") . "_APPSTARTING.ani")
DllCall("SetSystemCursor", UInt, hArrow, Int, OCR_NORMAL)
DllCall("SetSystemCursor", UInt, hIbeam, Int, OCR_IBEAM)
DllCall("SetSystemCursor", UInt, hAPPSTARTING, Int, OCR_APPSTARTING)
Prev_InputLocaleID := InputLocaleID
Return
Exit:
DllCall("SystemParametersInfo", UInt, "0x57", UInt, 0, UInt, 0, UInt, 0)
ExitApp