ello Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Karollll123
Posts: 9
Joined: 22 Dec 2020, 06:52

ello  Topic is solved

Post by Karollll123 » 22 Jan 2021, 06:28

hello
Last edited by Karollll123 on 23 Jan 2021, 06:58, edited 1 time in total.
User avatar
mikeyww
Posts: 5359
Joined: 09 Sep 2014, 18:38

Re: Help with running the script only in one application, and with gui appearance.

Post by mikeyww » 22 Jan 2021, 06:57

Code: Select all

menuText := "Change valid process name", keyToChange := "F2", color1 := "Yellow", color2 := "White"
Menu, Tray, NoStandard
Menu, Tray, Add, %menuText%, Change
Menu, Tray, Add
Menu, Tray, Standard
Menu, Tray, Default, %menuText%
Menu, Tray, Click, 1
Gui, Font, s12
Gui, Color, % color := color1
Gui, Add, Text,, Enter a valid process name
Gui, Add, Text, y+2, without extension (e.g., notepad).
Gui, Add, Edit, y+16 vvalidProc
Gui, Add, Button, x+m Default, OK
Hotkey, %keyToChange%, Change, On
Change: ; Change the valid process name
Gui, Show, w300, %keyToChange% = Valid process name
Send ^a
Return

F3:: ; Change the GUI color
Gui, Color, % color := color = color1 ? color2 : color1
SoundBeep, 1500, 30
Return

ButtonOK:
Gui, Submit
MsgBox, 64, Valid process name, %validProc%.exe
Return

GuiEscape:
Gui, Hide
Return

valid(proc) {
 WinGet, thisProc, ProcessName, A
 Return thisProc = proc ".exe"
}

; Main script ====================================

#If valid(validProc) ; Hotkeys and hotstrings that will work only in the valid program
F4::MsgBox, 64, Success, Success!
:T:test::OK!
#If
Post Reply

Return to “Ask For Help”