Thanks (really - thank you!) to Lexikos' Vista Audio Control functions @ <!-- m -->http://www.autohotke...topic23792.html<!-- m --> I've managed to adapt Volume On-Screen-Display (OSD) by Rajat for Vista.
I have just a few questions to try and refine it. Here's my code:
; Make customisation only in this area or hotkey area only!! ; The percentage by which to raise or lower the volume each time: vol_Step = 4 ; How long to display the volume level bar graphs: vol_DisplayTime = 2000 ; Master Volume Bar color (see the help file to use more ; precise shades): vol_CBM = Lime ; Background color; for transparent, set to 111111 vol_CW = 111111 ; Bar's screen position. Use -1 to center the bar in that dimension: vol_PosX = -1 vol_PosY = 600 vol_Width = 1024 ; width of bar vol_Thick = 50 ; thickness of bar ; If your keyboard has multimedia buttons for Volume, you can ; try changing the below hotkeys to use them by specifying ; Volume_Up, ^Volume_Up, Volume_Down, and ^Volume_Down: HotKey, Volume_Up, vol_MasterUp HotKey, Volume_Down, vol_MasterDown ;___________________________________________ ;_____Auto Execute Section__________________ ; DON'T CHANGE ANYTHING HERE (unless you know what you're doing). COM_Init() vol_BarOptionsMaster = 1 ZH%vol_Thick% ZX0 ZY0 W%vol_Width% CB%vol_CBM% CW%vol_CW% ;vol_BarOptionsMaster = 1 ZH%vol_Thick% ZX0 ZY0 W%vol_Width% ; If the X position has been specified, add it to the options. ; Otherwise, omit it to center the bar horizontally: if vol_PosX >= 0 { vol_BarOptionsMaster = %vol_BarOptionsMaster% X%vol_PosX% } ; If the Y position has been specified, add it to the options. ; Otherwise, omit it to have it calculated later: if vol_PosY >= 0 { vol_BarOptionsMaster = %vol_BarOptionsMaster% Y%vol_PosY% } #SingleInstance SetBatchLines, 10ms Return ;___________________________________________ vol_MasterUp: vol_tmp := VA_GetMasterVolume() vol_Master := (vol_tmp + vol_Step) VA_SetMasterVolume(vol_Master) Gosub, vol_ShowBars return vol_MasterDown: vol_tmp := VA_GetMasterVolume() vol_Master := (vol_tmp - vol_Step) VA_SetMasterVolume(vol_Master) Gosub, vol_ShowBars return vol_ShowBars: ; To prevent the "flashing" effect, only create the bar window if it ; doesn't already exist: IfWinNotExist, vol_Progress { ; Calculate position here in case screen resolution changes while ; the script is running: Progress, %vol_BarOptionsMaster%, , , vol_Progress WinSet, TransColor, 111111, vol_Progress ; WinSetTitle, vol_Progress,,Volume ; WinSet, Style, -0xC00000, vol_Progress } ; Get the volume in case the user or an external program changed them: Progress, 1:%vol_Master% SetTimer, vol_BarOff, %vol_DisplayTime% return vol_BarOff: SetTimer, vol_BarOff, off Progress, 1:Off return
My questions concern the following bits:
vol_BarOptionsMaster = 1 ZH%vol_Thick% ZX0 ZY0 W%vol_Width% CB%vol_CBM% CW%vol_CW% ;vol_BarOptionsMaster = 1 ZH%vol_Thick% ZX0 ZY0 W%vol_Width%
Here I have removed the colour settings for the bar and the background so that Vista will display the progress bar in its own style. It works, but Vista insists on making the bar move slowly, which means that it lags slightly behind where the volume level is actually at.
Is there a way of getting rid of the lag that anybody knows about?
; WinSetTitle, vol_Progress,,Volume ; WinSet, Style, -0xC00000, vol_Progress
I'd like to do one or both of these.
I like the border that appears around a regular window, but I want the title bar to either say "Volume" or not be there at all.
Currently when I disable the title bar most of the border disappears as well. I'm familiar with the B2 option for progress, but I want the proper Vista glass border.
If I change the window title from vol_Progress to Volume, I have to change it everywhere, and Volume ends up not being very unique - for example, things break if the windows Volume Mixer is open.
Is there,
a) an alternative way to reference the window, or
A way to change the displayed window title but leave the reference intact?
Thanks guys!