by
363 8
0
3
2,290
3
Top 1% !
Famous
Specified
Popularity: 9260th place
No tags for this snippet yet.
No Properties... yet!

Boss Key Autohotkey Script - Minimize or Lock Windows with one click on tray icon

Boss Key Autohotkey Script - Minimize or Lock Windows with one click on tray icon: 
bosskey.ahk
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/868234/Boss-Key-Autohotkey-Script---Minimize-or?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Auto Execute Section Starts Here;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Allow only one instance to run #SingleInstance force #Persistent ;Set tray tip and tray menu Menu, MySubmenu, Add, Minimize Windows, setDefaultAction Menu, MySubmenu, Add, Lock Workstation, setDefaultAction Menu, Tray, NoStandard Menu, Tray, Tip, Windows Key. Menu, Tray, Add, Execute, launchDefault Menu, Tray, Add ;draw a line Menu, Tray, Add, Set Default Action, :MySubmenu Menu, Tray, Add, Run on Startup`?, startUpReg Menu, Tray, Add, Exit, exitMe Menu, Tray, Default, Execute Menu, Tray, Click, 1 defaultBossAction := 0 ; set default boss key action RegRead, setDefault, HKCU, SOFTWARE\BossKey, defaultAction if (ErrorLevel <> 1) { if (setDefault = "boss") { RegWrite, REG_SZ, HKCU, SOFTWARE\BossKey, defaultAction, boss Menu, MySubmenu, Check, Minimize Windows Menu, MySubmenu, UnCheck, Lock Workstation defaultBossAction := 0 } else if (setDefault = "lock") { RegWrite, REG_SZ, HKCU, SOFTWARE\BossKey, defaultAction, lock Menu, MySubmenu, UnCheck, Minimize Windows Menu, MySubmenu, Check, Lock Workstation defaultBossAction := 1 } } else{ RegWrite, REG_SZ, HKCU, SOFTWARE\BossKey, defaultAction, boss Menu, MySubmenu, Check, Minimize Windows Menu, MySubmenu, UnCheck, Lock Workstation } ; check menu status of start up option RegRead, startUp, HKCU, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, BossKey if (ErrorLevel <> 1) { Menu, Tray, Check, Run on Startup`? } return ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Start Scripts;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;set registry key to run at startup startUpReg: RegRead, startUp, HKCU, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, BossKey if ErrorLevel { RegWrite, REG_SZ, HKCU, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, BossKey, %A_ScriptFullPath% Menu, Tray, Check, %A_ThisMenuItem% } else{ RegDelete, HKCU, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, BossKey if errorlevel { reload } Menu, Tray, Uncheck, %A_ThisMenuItem% } setDefaultAction: intent = %A_ThisMenuItem% if(intent = "Minimize Windows"){ RegWrite, REG_SZ, HKCU, SOFTWARE\BossKey, defaultAction, boss Menu, MySubmenu, Check, Minimize Windows Menu, MySubmenu, UnCheck, Lock Workstation defaultBossAction := 0 } else if(intent = "Lock Workstation"){ RegWrite, REG_SZ, HKCU, SOFTWARE\BossKey, defaultAction, lock Menu, MySubmenu, UnCheck, Minimize Windows Menu, MySubmenu, Check, Lock Workstation defaultBossAction := 1 } return launchDefault: if(defaultBossAction = 1){ DllCall("LockWorkStation") return } else{ send, #d return } exitMe: sayBye() return sayBye(){ ExitApp } ExitApp
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus