 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
DominicTFY
Joined: 05 Dec 2004 Posts: 10
|
Posted: Wed Dec 08, 2004 1:29 pm Post subject: OSD Mute Status Display & Toggle Mute On/Off Script! |
|
|
Hey guys, this is the OSD Mute script i came up with. It turns on/off master mute and displays the mute status at the bottom left of the screen through OSD.
Special thanks to Chris & Tekl for their help.
Press Control + Windows Key + m to try...hehe...
Feel free to post any errors faced and suggestions. Cheers, mate(s)!
| Code: |
;By Dominic Tay
;Master Mute
^#m::
Gui,Destroy
SoundSet, +1,, mute
SoundGet, Master_mute,, mute
if Master_mute = On
{
Gui, Color, 000080
Gui, font, s20 bold cYellow, Tahoma
Gui, Add, text,x0 y0, Mute On
DetectHiddenWindows on
WinWait, %A_ScriptName% ; Set the "last found" window to GUI window.
WinSet, TransColor,000080 %transparent%
WinSet, AlwaysOnTop, On
Gui, -Caption
Gui, Show, w200 h50 x10 y705
setenv, presstime, %A_MDay%%A_hour%%A_Min%%A_Sec%
envadd, presstime, 2
SetTimer, RemoveGui, On
return
RemoveGui:
setenv, presstime2, %A_MDay%%A_hour%%A_Min%%A_Sec%
ifgreaterorequal, presstime2, %presstime%
{
Gui, Destroy
SetTimer, RemoveGui, off
}
return
}
else
{
Gui, Color, 000080
Gui, font, s20 bold cYellow, Tahoma
Gui, Add, text,x0 y0 vMyText, Mute Off
DetectHiddenWindows on
WinWait, %A_ScriptName% ; Set the "last found" window to GUI window.
WinSet, TransColor,000080 %transparent%
WinSet, AlwaysOnTop, On
Gui, -Caption
Gui, Show, w200 h50 x10 y705
setenv, presstime, %A_MDay%%A_hour%%A_Min%%A_Sec%
envadd, presstime, 2
SetTimer, RemoveGui, On
return
}
return
|
Last edited by DominicTFY on Wed Dec 08, 2004 1:47 pm; edited 1 time in total |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10463
|
Posted: Wed Dec 08, 2004 1:42 pm Post subject: |
|
|
| Quote: | | However, if i turn mute off to on, the OSD display shows "On", but with a trace of the last letter of "F" from "OFF". | That happens because you were adding the text controls one on top of the other (with overlap). Here is a simplified version that seems to work okay: | Code: | ^#m::
SoundSet, +1,, mute
SoundGet, Master_mute,, mute
Gui, Color, 000080
Gui, font, s20 bold cYellow, Tahoma
Gui, Add, text,x0 y0 vGuiText, Mute %Master_mute%
DetectHiddenWindows on
WinWait, %A_ScriptName%
WinSet, TransColor, 000080 150
WinSet, AlwaysOnTop, On
Gui, -Caption
Gui, Show, w200 h50 x10 y705
Sleep, 600
Gui, Destroy
return |
|
|
| Back to top |
|
 |
DominicTFY
Joined: 05 Dec 2004 Posts: 10
|
Posted: Wed Dec 08, 2004 2:00 pm Post subject: Thx again, Chris! |
|
|
Thx again, Chris! I tot of that simplified script before. However, if i wan to toggle between on/off with that simplified script, I kind of like had to wait for 600 ms between the toggle.
| Quote: | Gui, Show, w200 h50 x10 y705
Sleep, 600 ;---------------> Wait for 600ms
Gui, Destroy |
But i made a change and edited my code above by just adding a "Gui,Destroy" right at the front of the script. So it eradicates the prob. hehe...
and now, u can toggle between mute on/off anytime, even before the 600 ms wait. But hey Chris, u roX! Cheers, mate! And please please, let me noe if u haf a simplified version of the new code above. I will really appreciate that! thx!  |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10463
|
Posted: Wed Dec 08, 2004 2:18 pm Post subject: |
|
|
| Quote: | | let me noe if u haf a simplified version of the new code above | Here's a revised one that allows the hotkey to work even when the window is already displayed:
^#m::
SoundSet, +1,, mute
SoundGet, Master_mute,, mute
SetTimer, GuiDestroy, off ; This avoids a rare split-second timing issue.
Gui, Destroy ; Make sure it's destroyed when starting out in case timer hasn't fired yet.
Gui, Color, 000080
Gui, font, s20 bold cYellow, Tahoma
Gui, Add, text,x0 y0 vGuiText, Mute %Master_mute%
DetectHiddenWindows on
WinWait, %A_ScriptName%
WinSet, TransColor, 000080 150
WinSet, AlwaysOnTop, On
Gui, -Caption
Gui, Show, w200 h50 x10 y705
SetTimer, GuiDestroy, 600
return
GuiDestroy:
SetTimer, GuiDestroy, off
Gui, Destroy
return |
|
| Back to top |
|
 |
DominicTFY
Joined: 05 Dec 2004 Posts: 10
|
Posted: Wed Dec 08, 2004 4:09 pm Post subject: Thx Again Chris! |
|
|
OMG~~
Stunningly shorter den mine...haha...thx again, chris. U never fail 2 amuse me with your computer knowledge.Haha~  |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Wed Dec 08, 2004 4:35 pm Post subject: |
|
|
@ DominicTFY
where are you from ? |
|
| Back to top |
|
 |
DominicTFY
Joined: 05 Dec 2004 Posts: 10
|
Posted: Thu Dec 09, 2004 2:19 am Post subject: |
|
|
@ BoBo
I'm from Singapore.
Wad about you guys, BoBo and Chris? |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Thu Dec 09, 2004 2:34 am Post subject: |
|
|
B = D!
C = FL/USA
 |
|
| Back to top |
|
 |
DominicTFY
Joined: 05 Dec 2004 Posts: 10
|
Posted: Thu Dec 09, 2004 5:32 am Post subject: |
|
|
Haha...icic..Right now i trying 2 make my own volume OSD script using Gui's Text and Progress Bar together..Haha. Will post questions if i m not sure.  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|