Update msmv.ahk

This commit is contained in:
2026-08-28 12:29:53 -05:00
parent ec815b5314
commit a54571f6cd
+53 -38
View File
@@ -1,50 +1,65 @@
#Requires AutoHotkey v2.0 ; v2 only
#Requires AutoHotkey v2 ; v2 only
#SingleInstance force
CoordMode("Mouse", "Screen")
waittime := 5000
ogcStop := 13
global nogui := False
waittime := 10000
Switch A_Args
for i in A_Args
{
if (i = "on")
{
A_IconHidden := 1
Start(1,2,3)
}
else if (i = "off")
{
Case "on":
Goto(Start)
Case "off":
ExitApp()
default:
for x in A_Args {
MsgBox(x)
}
else
{
MsgBox (i)
}
}
A_TrayMenu.Delete() ; None of the standard tray buttons
A_TrayMenu.Add("Hide GUI", GuiToggle) ; Adds a button to toggle the gui
A_TrayMenu.Add("Exit", ExtMen) ; Exit button
myGui := Gui()
A_TrayMenu.Delete() ; None of the standard tray buttons
A_TrayMenu.Add("Hide GUI", GuiToggle()) ; Adds a button to toggle the gui
A_TrayMenu.Add("Exit", ExtMen) ; Exit button
myGui.Opt("+AlwaysOnTop +ToolWindow")
ogcButtonStart := myGui.Add("Button", "x3 y3 w55 h20 +Center", "Start")
ogcButtonStart.OnEvent("Click", Start.Bind("Normal"))
ogcButtonStop := myGui.Add("Button", "x3 y3 w55 h20 +Center Hidden", "Stop")
ogcButtonStop.OnEvent("Click", Stop.Bind("Normal"))
ButtonStart := myGui.Add("Button", "x3 y3 w55 h20 +Center", "Start")
ButtonStart.OnEvent("Click", Start.Bind("Normal"))
ButtonStop := myGui.Add("Button", "x3 y3 w55 h20 +Center Hidden", "Stop")
ButtonStop.OnEvent("Click", Stop.Bind("Normal"))
myGui.Title := "msmv"
If (A_IconHidden = false)
{
myGui.Show("h28 w60")
}
Start(A_GuiEvent, GuiCtrlObj, Info, *)
Start(A_GuiEvent, GuiCtrlObj, Info)
{
ogcButtonStart.Visible := false
SetTimer(Msmv,waittime) ; Checks if the has been input in the last 2 minutes every 30 secs, easier to stop a loop with SetTimer
ogcButtonStop.Visible := true
}
Stop(A_GuiEvent, GuiCtrlObj, Info, *)
If (A_IconHidden = false)
{
ogcButtonStop.Visible := false
SetTimer(Msmv,0)
ogcButtonStart.Visible := true
ButtonStart.Visible := false
ButtonStop.Visible := true
}
}
Msmv()
Stop(A_GuiEvent, GuiCtrlObj, Info)
{
SetTimer(Msmv,0)
If (A_IconHidden = false)
{
ButtonStop.Visible := false
ButtonStart.Visible := true
}
}
Msmv(*)
{
If (A_TimeIdle > waittime) ; https://www.autohotkey.com/docs/Variables.htm#User_Idle_Time
{
@@ -54,24 +69,24 @@ Msmv()
}
}
GuiToggle(){
global
If !nogui
GuiToggle(ItemName, ItemPos, MenuObj)
{
myGui.Hide()
A_TrayMenu.Check("1&")
nogui := True
global
If (WinExist("msmv"))
{
myGui.Destroy()
MenuObj.Check(ItemName)
}
Else
{
A_TrayMenu.Uncheck("1&")
nogui := False
myGui.Show()
MenuObj.Uncheck(ItemName)
myGui.Restore()
}
Return
}
; exit option from tray menu
ExtMen(A_ThisMenuItem, A_ThisMenuItemPos, MyMenu)
ExtMen(*)
{
ExitApp()
}