AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

OSD Mute Status Display & Toggle Mute On/Off Script!

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
DominicTFY



Joined: 05 Dec 2004
Posts: 10

PostPosted: Wed Dec 08, 2004 1:29 pm    Post subject: OSD Mute Status Display & Toggle Mute On/Off Script! Reply with quote

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. Very Happy
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
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10463

PostPosted: Wed Dec 08, 2004 1:42 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
DominicTFY



Joined: 05 Dec 2004
Posts: 10

PostPosted: Wed Dec 08, 2004 2:00 pm    Post subject: Thx again, Chris! Reply with quote

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! Very Happy
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10463

PostPosted: Wed Dec 08, 2004 2:18 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
DominicTFY



Joined: 05 Dec 2004
Posts: 10

PostPosted: Wed Dec 08, 2004 4:09 pm    Post subject: Thx Again Chris! Reply with quote

OMG~~ Exclamation
Stunningly shorter den mine...haha...thx again, chris. U never fail 2 amuse me with your computer knowledge.Haha~ Very Happy
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Wed Dec 08, 2004 4:35 pm    Post subject: Reply with quote

@ DominicTFY
where are you from ?
Back to top
DominicTFY



Joined: 05 Dec 2004
Posts: 10

PostPosted: Thu Dec 09, 2004 2:19 am    Post subject: Reply with quote

@ BoBo
I'm from Singapore. Very Happy
Wad about you guys, BoBo and Chris?
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Thu Dec 09, 2004 2:34 am    Post subject: Reply with quote

B = D!
C = FL/USA

Idea
Back to top
DominicTFY



Joined: 05 Dec 2004
Posts: 10

PostPosted: Thu Dec 09, 2004 5:32 am    Post subject: Reply with quote

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. Laughing
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group