1

Тема: AHK: Соединение клавиши скрипта с Hotkey в gui

Я прошу мне помочь.
Текст скрипта:

LButton::
   While GetKeyState("LButton", "P")
   {
      SendInput, {Click}
      Sleep, 0
   }
   Return
1::Suspend

Текст GUI:

FileInstall, RJeh8poXO98.jpg, C:\Users\User\Desktop\RJeh8poXO98.jpg
Gui, Add, Picture, x-88 y-40 w600 h490 , C:\Users\User\Desktop\RJeh8poXO98.jpg
Gui, Font, S16 Cblue, Verdana
Gui, Add, Text, x142 y10 w190 h30 BackgroundTrans, Введите клавишу
Gui, Add, Hotkey, x62 y40 w300 h30 ,
Gui, Add, Button, x162 y80 w120 h30, ОК
; Generated using SmartGUI Creator for SciTE
Gui, Show, w479 h379, Зажим
return
GuiClose:
ExitApp

Я хочу сделать так что бы при запуске срипта и при смене HotKey изменял и цифра включающая Suspend и отключающая его же. Изначально стоит 1. Очень прошу помочь.

2 (изменено: serzh82saratov, 2017-08-28 14:37:27)

Re: AHK: Соединение клавиши скрипта с Hotkey в gui

PathIni = IniFile.ini
IniRead, MyGuiHotkey, % PathIni, Section, MyGuiHotkey, % A_Space
Hotkey, % PrSetSuspend := MyGuiHotkey, Suspend, UseErrorLevel

FileInstall, RJeh8poXO98.jpg, C:\Users\User\Desktop\RJeh8poXO98.jpg
Gui, Add, Picture, x-88 y-40 w600 h490 , C:\Users\User\Desktop\RJeh8poXO98.jpg
Gui, Font, S16 Cblue, Verdana
Gui, Add, Text, x142 y10 w190 h30 BackgroundTrans, Введите клавишу
Gui, Add, Hotkey, x62 y40 w300 h30 gSetSuspend vMyGuiHotkey, %MyGuiHotkey%
; Generated using SmartGUI Creator for SciTE
Gui, Show, w479 h379, Зажим
Return

SetSuspend:
	Hotkey, % PrSetSuspend, Off, UseErrorLevel
	GuiControlGet, Hotkey, %A_Gui%:, %A_GuiControl% 
	Hotkey := FormatHotkey(Hotkey)  
	Hotkey, % PrSetSuspend := Hotkey, Suspend 
	IniWrite, % Hotkey, % PathIni, Section, % A_GuiControl
	Return

Suspend:
	Suspend
	Return

LButton::
   While GetKeyState("LButton", "P")
   {
      SendInput, {Click}
      Sleep, 0
   }
   Return

FormatHotkey(Hotkey) {   ; http://forum.script-coding.com/viewtopic.php?pid=102089#p102089
	RegExMatch(Hotkey, "S)^([\^\+!]*)(.*?)$", K)
	If (StrLen(K2) = 1)
		Return K1 . Format("sc{:X}", GetKeySC(K2))
	Return Hotkey
} 
По вопросам возмездной помощи пишите на E-Mail: serzh82saratov@mail.ru Telegram: https://t.me/sergiol982
Win10x64 AhkSpy, Hotkey, ClockGui