-One button edits THIS ahk script (update with full path of editor and ahk script)
-Six configurable buttons.
Code: Select all
; Program Name: CoolTermMacros.ahk
; Author: J.Muhammad
; Date: 20220818-1239
;------------------------------------------------------------------------------
; Revision(s): 1.00
;------------------------------------------------------------------------------
; Purpose: CoolTerm helper
; Note(s): https://forums.the-meiers.org/viewtopic.php?f=4&t=541#
; https://www.autohotkey.com/board/topic/84055-reopen-gui-at-position-it-was-last-closed/
;
; Hotkeys (Mouse, Joystick and Keyboard Shortcuts)
; https://autohotkey.com/docs/Hotkeys.htm
; ! Alt Key
; ^ Control Key (Ctrl)
; + Shift Key
; # WinKey (Windows logo key)
;==============================================================================
; Always run your script as admin
if not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
ExitApp
}
#SingleInstance force ; Skips the dialog box and replaces the old instance
; Automatically, which is similar in effect to the Reload command.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetBatchLines, 10ms
; read the saved positions / center if not previously saved
IniRead, gui_position, settings_cooltermmacros.ini, window position, gui_position, Center
Gui, New, +AlwaysOnTop, CoolTerm Macros 1.00
; get window ID
Gui, +Hwndgui_id
Gui, Font, s12, Consolas ; Set 12-point Consolas
Gui, Add, Button, x6 y10 w100 h25 gH1, Edit AHK ;H1
Gui, Add, Button, x112 y10 w100 h25 gH2, CT On Top ;H2
Gui, Add, Button, x218 y10 w100 h25 gH3, - - - - - ;H3
;------------------------------------------------
Gui, Add, Button, x8 y50 w150 h25 gM1, M1: - - - - - ;M1
Gui, Add, Button, x8 y80 w150 h25 gM2, M2: - - - - - ;M2
Gui, Add, Button, x8 y110 w150 h25 gM3, M3: - - - - - ;M3
Gui, Add, Button, x166 y50 w150 h25 gM4, M4: - - - - - ;M4
Gui, Add, Button, x166 y80 w150 h25 gM5, M5: - - - - - ;M5
Gui, Add, Button, x166 y110 w150 h25 gM6, M6: - - - - - ;M6
; Show window at saved position
Gui, Show, %gui_position% w324, CoolTerm Macros 1.00
return
H1:
;Header Macro 1
;Edit THIS script
Run, "{YourEditorHere.exe}" "{path}\cooltermmacros.ahk"
return
H2:
;Header Macro 2
;Always On Top
WinActivate, ahk_exe CoolTerm.exe
Winset, Alwaysontop, , A
return
H3:
;Header Macro 3
return
M1:
WinActivate, ahk_exe CoolTerm.exe
;Macro 1
return
M2:
WinActivate, ahk_exe CoolTerm.exe
;Macro 2
return
M3:
WinActivate, ahk_exe CoolTerm.exe
;Macro 3
return
M4:
WinActivate, ahk_exe CoolTerm.exe
;Macro 4
return
M5:
WinActivate, ahk_exe CoolTerm.exe
;Macro 5
return
M6:
WinActivate, ahk_exe CoolTerm.exe
;Macro 6
return
;Close the window acquire and save position.
GuiClose:
WinGetPos, gui_x, gui_y,,, ahk_id %gui_id%
IniWrite, x%gui_x% y%gui_y%, settings_cooltermmacros.ini, window position, gui_position
ExitApp