How do I prevent a progress window from destroying another? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
daniel
Posts: 17
Joined: 23 May 2016, 22:41

How do I prevent a progress window from destroying another?

16 Mar 2018, 04:03

Hello, I got the following code from a fellow member of the board but I can't get it to work properly because I don't want one progress window to destroy another. If capslock is activated then I don't want the capslock progress window to disappear when I activate scroll lock or numlock. Is there any way to display three progress window running in the same script?

Thanks for any help!

Code: Select all

SetNumlockState, Off
SetCapsLockState, Off
SetScrollLockState, Off
cWidth := A_ScreenWidth - 202
cHeight := A_ScreenHeight - 35
nWidth := A_ScreenWidth - 202
nHeight := A_ScreenHeight - 80
sWidth := A_ScreenWidth - 202
sHeight := A_ScreenHeight - 125
 
~*CapsLock::
 
Sleep, 100
if GetKeyState("CapsLock", "T")
{
	Progress, B1 W200 H28 ZH0 FS11 WS900 x%cWidth% y%cHeight% CTFFFFFF CW0000FF, Capslock On
}
else
{
	Progress, off
}
return

~*NumLock::
 
Sleep, 100
if GetKeyState("Numlock", "T")
{
	Progress, B1 W200 H28 ZH0 FS11 WS900 x%nWidth% y%nHeight% CT000000 CW00FF00, Numlock On
}
else
{
	Progress, off
}
 
return

~*ScrollLock::
 
Sleep, 100
if GetKeyState("ScrollLock", "T")
{
	Progress, B1 W200 H28 ZH0 FS11 WS900 x%sWidth% y%sHeight% CTFFFFFF CWFF0000, Scroll Lock On
}
else
{
	Progress, off
}
return
Marrow
Posts: 21
Joined: 02 Oct 2017, 06:31

Re: How do I prevent a progress window from destroying another?

16 Mar 2018, 06:49

Hi,
you could create one or three GUIs instead. You can place either the three GUIs like you want to place your three progress bars or you add a progress bar when a second (or third) LockState is also true via GuiControl or Gui, Submit, NoHide.

To make a GUI not appear as a window set this options: Gui, +ToolWindow -Disabled -SysMenu -Caption +E0x20 +AlwaysOnTop
To place a text above/in a progress bar, you can add a text element with this options, e.g.: Gui, Add, Text, cBlack x%cWidth% y%cHeight% w200 h28 +0x200 +Center +BackgroundTrans, Capslock On
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How do I prevent a progress window from destroying another?

16 Mar 2018, 09:20

You could get the states of all 3, and list them in one string e.g. C N S, or Caps Num Scroll.

Also, check this:
Progress/SplashImage
https://autohotkey.com/docs/commands/Progress.htm
Each script can display up to 10 Progress windows and 10 SplashImage windows.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
daniel
Posts: 17
Joined: 23 May 2016, 22:41

Re: How do I prevent a progress window from destroying another?  Topic is solved

17 Mar 2018, 05:02

thank, guys. Turns out I just needed to name each progress window.

Code: Select all

SetCapsLockState, off
cWidth := A_ScreenWidth - 202
cHeight := A_ScreenHeight - 35
SetNumlockState, off
nWidth := A_ScreenWidth - 202
nHeight := A_ScreenHeight - 80
SetScrollLockState, off
sWidth := A_ScreenWidth - 202
sHeight := A_ScreenHeight - 125
 
~*CapsLock::
 
Sleep, 100
if GetKeyState("CapsLock", "T")
{
	Progress, 1:B1 W200 H28 ZH0 FS11 WS900 x%cWidth% y%cHeight% CTFFFFFF CW0000FF, Capslock On
}
else
{
	Progress, 1:off
}
return

 
~*NumLock::
 
Sleep, 100
if GetKeyState("Numlock", "T")
{
	Progress, 2:B1 W200 H28 ZH0 FS11 WS900 x%nWidth% y%nHeight% CT000000 CW00FF00, Numlock On
}
else
{
	Progress, 2:off
}
return

~*ScrollLock::
 
Sleep, 100
if GetKeyState("ScrollLock", "T")
{
	Progress, 3:B1 W200 H28 ZH0 FS11 WS900 x%sWidth% y%sHeight% CTFFFFFF CWFF0000, Scroll Lock On
}
else
{
	Progress, 3:off
}
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: FanaticGuru, filipemb, LRRUNB and 203 guests