AutoHotkey Community

It is currently May 27th, 2012, 11:00 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Volume OSD for Vista
PostPosted: February 22nd, 2007, 11:14 pm 
Hi,

I'm looking for a volume osd script for vista that I can use with media keys on my laptop. If someone has made one please share with me.

Thanks.


Report this post
Top
  
Reply with quote  
 Post subject: Not great but it works
PostPosted: June 16th, 2007, 3:06 pm 
Offline

Joined: April 23rd, 2004, 4:38 am
Posts: 34
Location: Adelaide, South Australia
This is what I have done so far... it relies on the tray icon being always in the same position so perhaps could be improved with ImageSearch. I previously had the XP version working and added the Vista stuff to it.

Code:
;*******************************************************************************
; Volume up/down/mute buttons with on-screen display
;*******************************************************************************
#Up::
#WheelUp::
$Volume_Up::
  If A_OSVersion = WIN_VISTA
  {
    Loop,2
      send {Volume_Up}
    GoSub,VolumeOSDVista
  }
  Else
  {
    SoundSet,0,master,mute
    SoundSet,+5,master,volume
    GoSub,VolumeOSD
  }
Return

#Down::
#WheelDown::
$Volume_Down::
  If A_OSVersion = WIN_VISTA
  {
    Loop,2
      send {Volume_Down}
    GoSub,VolumeOSDVista
  }
  Else
  {
    SoundSet,0,master,mute
    SoundSet,-5,master,volume
    GoSub,VolumeOSD
  }
Return

#Q::
#MButton::
$Volume_Mute::
  If A_OSVersion = WIN_VISTA
  {
    send {Volume_Mute}
    GoSub,VolumeOSDVista
  }
  Else
  {
    SoundSet,+1,master,mute
    GoSub,VolumeOSD
  }
Return

VolumeOSD:
  Y := A_ScreenHeight - 100
  W := A_ScreenWidth * 0.5
  SetFormat,Float,0.0
  SoundGet,Volume,master,volume
  SoundGet,Mute,master,mute
  If mute=on
    Progress,1:P%Volume% CBred w%W% y%Y%,,,Volume %Volume%`% (muted)
  Else
    Progress,1:P%Volume% CBnavy w%W% y%Y%,,,Volume %Volume%`%
  SetTimer,RemoveOSD,1000
Return

RemoveOSD:
  Progress,1:off
  SetTimer,RemoveOSD,off
Return

VolumeOSDVista:
  If Not OSDon
  {
    CoordMode,Mouse,Screen
    MouseGetPos,mX,mY
    MouseClick,Left,1200,780,1,0 ; click the sound icon in tray
    MouseMove,%mX%,%mY%,0
    OSDon=1
  }
  SetTimer,RemoveOSDVista,1000
Return

RemoveOSDVista:
  IfWinExist,,&Main Mute
    WinClose,,&Main Mute
  OSDon=0
  SetTimer,RemoveOSDVista,off
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 13th, 2007, 8:35 pm 
Thank you so much! Finally, I could use the Win+X key combo in vista without mobility center interrupting! Thank you sooooo much!

And on top of all that, the mute function works exactly like in my old XP script! and so simple to use!

This has to be bumped for posterity!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2007, 11:59 am 
Offline

Joined: October 3rd, 2006, 5:01 pm
Posts: 6
Location: CZ
Error at line 15.
Line text: If A_OSVersion = WIN_VISTA
Error: This line does not contain a recognized action.

The program will exit.

What I do wrong?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2007, 1:39 pm 
Offline

Joined: November 6th, 2007, 12:19 pm
Posts: 47
Code:
if A_OSVersion in WIN_VISTA


?

I don't have Vista, that's from the manual. Also WIN_VISTA requires v1.0.44.13+ so not sure if that's an issue?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2007, 1:43 pm 
Offline

Joined: October 3rd, 2006, 5:01 pm
Posts: 6
Location: CZ
I have 1.0.47.05.
But when I remove this if, error still apear.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2007, 1:48 pm 
Offline

Joined: November 6th, 2007, 12:19 pm
Posts: 47
no clue, that was just a shot in the dark, sorry :(

running XP @ work still


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2007, 1:53 pm 
Offline

Joined: October 3rd, 2006, 5:01 pm
Posts: 6
Location: CZ
Sorry for my English.

I running Windows Vista and have this error, what I wrote.

I had script in Windows XP with volume control and OSD, but in Vista not work.
So now work only volume control via send {volume_up}. But OSD not.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2007, 4:49 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
Those lines look ok. Are you sure you are restarting the right file? Sometimes these stupid errors just require you to reboot so you can keep track of files.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2007, 6:04 pm 
Offline

Joined: October 3rd, 2006, 5:01 pm
Posts: 6
Location: CZ
Heh, I create new file again and copy the code into and now it works like a charm :D.
Now I have to find out coordinates of my sound tray icon :)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Edd, Exabot [Bot], HotkeyStick, Yahoo [Bot] and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group