1 (изменено: artur.petrash.98, 2018-05-12 02:05:08)

Тема: Нужно получить код клавиши и написать его вместо sc20

как сделать чтобы из хоткея G8 (файл целиком ниже) вставилось нормально клавиша вместо sc20 вот здесь: If (!GetKeyState("sc20", "P"))

IniRead, c1              , Legion Commander.ini, Go    , c1
IniRead, c2              , Legion Commander.ini, Go    , c2
IniRead, c3              , Legion Commander.ini, Go    , c3
IniRead, c4                  , Legion Commander.ini, Go        , c4
IniRead, c5                  , Legion Commander.ini, Go        , c5
IniRead, c6                  , Legion Commander.ini, Go        , c6
IniRead, c7                  , Legion Commander.ini, Go        , c7
IniRead, G1                  , Legion Commander.ini, Go        , G1
IniRead, G2                  , Legion Commander.ini, Go        , G2
IniRead, G3                  , Legion Commander.ini, Go        , G3
IniRead, G4                  , Legion Commander.ini, Go        , G4
IniRead, G5                  , Legion Commander.ini, Go        , G5
IniRead, G6                  , Legion Commander.ini, Go        , G6
IniRead, G7                  , Legion Commander.ini, Go        , G7
IniRead, G8                  , Legion Commander.ini, Go        , G8
IniRead, Vl_suspend          , Legion Commander.ini, Go        , Vl_suspend
Gui, Add, Picture, x2 y-1 w730 h430 , %a_temp%/1234.png
Gui, Font, S12
Gui, Add, Hotkey,   x13  y76  w40 h30    vG1,  %G1%
Gui, Add, CheckBox, x62  y82  w13 h13    vc1   %с1% ges,
Gui, Add, Hotkey,   x112 y76  w40 h30    vG2,  %G2%
Gui, Add, CheckBox, x162 y82  w13 h13    vc2   %с2% ges,
Gui, Add, Hotkey,   x13  y190 w40 h30    vG3,  %G3%
Gui, Add, CheckBox, x62  y199 w13 h13    vc3   %с3% ges,
Gui, Add, Hotkey,   x112 y190 w40 h30    vG4,  %G4%
Gui, Add, CheckBox, x162 y199 w13 h13    vc4   %с4% ges,
Gui, Add, Hotkey,   x13  y304 w40 h30    vG5,  %G5%
Gui, Add, CheckBox, x62  y312 w13 h13    vc5   %с5% ges,
Gui, Add, Hotkey,   x113 y304 w40 h30    vG6,  %G6%
Gui, Add, CheckBox, x162 y312 w13 h13    vc6   %с6% ges,
Gui, Add, Hotkey,   x97  y386 w40 h30    vG7,  %G7%
Gui, Add, CheckBox, x108 y362 w13 h13    vc7   %с7% ges,
Gui, Add, Hotkey,   x314 y137 w38 h23    vVl_suspend, %Vl_suspend%
Gui, Add, Hotkey,   x262 y365 w40 h30    vG8,  %G8%
Gui, Font, S15
Gui, Add, Button, x242 y239 w200 h70 gOk, Принять
Gui, Font, S9
Gui, Add, Button, x142 y389 w40 h20 gESpace, Space
Gui, Show, w736 h431, Legion Commander 1.0
GoSub, es
GoSub, Ok
return
GuiClose:
ExitApp
return
Ok:
Hotkey, $%G1%  , , off, UseErrorLevel
Hotkey, $%G2%  , , off, UseErrorLevel
Hotkey, $%G3%  , , off, UseErrorLevel
Hotkey, $%G4%  , , off, UseErrorLevel
Hotkey, $%G5%  , , off, UseErrorLevel
Hotkey, $%G6%  , , off, UseErrorLevel
Hotkey, $%G7%  , , off, UseErrorLevel
Hotkey, $%G8%  , , off, UseErrorLevel
Hotkey, $%Vl_suspend%  , , off, UseErrorLevel
Gui, Submit, NoHide
b := [G1, G2, G3, G4, G5, G6, G7, G8, Vl_suspend]
Loop % b.MaxIndex()
{
t := A_Index
a := ""
modi := ""
a := % b[t]
Loop
{
first := ""
StringLeft first, a, 1
if (first = "+" or first ="^" or first ="!")
{
modi := modi . first
StringTrimLeft a, a, 1
}
else
break
}
a := Format("sc{:x}", GetKeySC(a))
b[t] := modi . a
}
G1   := b[1]
G2   := b[2]
G3   := b[3]
G4   := b[4]
G5   := b[5]
G6   := b[6]
G7   := b[7]
G8   := b[8]
Vl_suspend   := b[9]
IniWrite, %c1%          , Legion Commander.ini, Go , c1
IniWrite, %c2%          , Legion Commander.ini, Go , c2
IniWrite, %c3%          , Legion Commander.ini, Go , c3
IniWrite, %c4%          , Legion Commander.ini, Go , c4
IniWrite, %c5%          , Legion Commander.ini, Go , c5
IniWrite, %c6%          , Legion Commander.ini, Go , c6
IniWrite, %c7%          , Legion Commander.ini, Go , c7
IniWrite, %G1%           , Legion Commander.ini, Go      , G1
IniWrite, %G2%           , Legion Commander.ini, Go      , G2
IniWrite, %G3%           , Legion Commander.ini, Go      , G3
IniWrite, %G4%           , Legion Commander.ini, Go      , G4
IniWrite, %G5%           , Legion Commander.ini, Go      , G5
IniWrite, %G6%           , Legion Commander.ini, Go      , G6
IniWrite, %G7%           , Legion Commander.ini, Go      , G7
IniWrite, %G8%           , Legion Commander.ini, Go      , G8
IniWrite, %Vl_suspend%   , Legion Commander.ini, Go      , Vl_suspend
Hotkey, $%G1%    , G1    , on, UseErrorLevel
Hotkey, $%G2%    , G2    , on, UseErrorLevel
Hotkey, $%G3%    , G3    , on, UseErrorLevel
Hotkey, $%G4%    , G4    , on, UseErrorLevel
Hotkey, $%G5%    , G5    , on, UseErrorLevel
Hotkey, $%G6%    , G6    , on, UseErrorLevel
Hotkey, $%G7%    , G7    , on, UseErrorLevel
Hotkey, $%G8%    , G8    , on, UseErrorLevel
Hotkey, $%Vl_suspend%,  , on, UseErrorLevel
return
Sus:
Suspend
return


G8:
If (c1 = 1)
{
Send, {%G1%}
}
time := A_TickCount
Loop
{
if (A_TickCount - time < 200)
{
If (c4 = 1)
{
Send, {%G4%}
}
If (c6 = 1)
{
Send, {%G6%}
}
If (c5 = 1)
{
Send, {%G5%}
}
}
else
{
If (c7 = 1)
{
Send, {%G7%}
}
If (c3 = 1)
{
Send, {%G3%}
}
If (c2 = 1)
{
Send, +{%G2%}
}
}
Sleep, 1
If (!GetKeyState("sc20", "P"))
Break
}
Return


es:
GuiControlGet, c1
GuiControlGet, c2
GuiControlGet, c3
GuiControlGet, c4
GuiControlGet, c5
GuiControlGet, c6
GuiControlGet, c7
If (c1 = 0)
{
GuiControl, disable, G1
}
If (c2 = 0)
{
GuiControl, disable, G2
}
If (c3 = 0)
{
GuiControl, disable, G3
}
If (c4 = 0)
{
GuiControl, disable, G4
}
If (c5 = 0)
{
GuiControl, disable, G5
}
If (c6 = 0)
{
GuiControl, disable, G6
}
If (c7 = 0)
{
GuiControl, disable, G7
}
If (c1 = 1)
{
GuiControl, enable, G1
}
If (c2 = 1)
{
GuiControl, enable, G2
}
If (c3 = 1)
{
GuiControl, enable, G3
}
If (c4 = 1)
{
GuiControl, enable, G4
}
If (c5 = 1)
{
GuiControl, enable, G5
}
If (c6 = 1)
{
GuiControl, enable, G6
}
If (c7 = 1)
{
GuiControl, enable, G7
}
return
ESpace:
GuiControl, , G7, sc39
return


!sc19::
Suspend
Return

+sc1C::
Suspend
Send, +{sc1C}
Return

sc1C::
Suspend
Send, {sc1C}
Return

2

Re: Нужно получить код клавиши и написать его вместо sc20

Фу как не красиво!(
Посмотри правила создания тем на форуме, а потом - справка тебе в руки...