Jump to content

Volume adjust script?


Recommended Posts

I'm still really terrible at making scripts and i'd really like something to quickly change the master volume of my computer on the fly. I just got a really nice gaming headset so it would be nice to have this right now. Also I don't have a keyboard with a volume shortcut.

I want F9 to mute all, F11 to increase master volume up a tick, and F12 to decrease master volume a tick.

(i don't want to use F10 since that exits most steam games like TF2 instantly :) )

Thanks in advance.

Link to comment
Share on other sites

Link to comment
Share on other sites

Try this (NOT TESTED):

HotKeySet("{PAUSE}","Quit");Press PAUSE to quit
HotKeySet("{F9}","VolumeMute")
HotKeySet("{F11}","VolumeUp")
HotKeySet("{F12}","VolumeDown")

While 1
    Sleep(50)
WEnd

Func Quit()
    Exit
EndFunc

Func VolumeMute()
    Send("{VOLUME_MUTE}")
EndFunc

Func VolumeUp()
    Send("{VOLUME_UP}")
EndFunc

Func VolumeDown()
    Send("{VOLUME_DOWN}")
EndFunc

When the words fail... music speaks.

Link to comment
Share on other sites

from help file. I had the same issue with another app.

The following hotkeys cannot be set:

Ctrl+Alt+Delete It is reserved by Windows

F12 It is also reserved by Windows, according to its API.

NumPad's Enter Key Instead, use {Enter} which captures both Enter keys on the keyboard.

Win+B,D,E,F,L,M,R,U; and Win+Shift+M These are built-in Windows shortcuts. Note: Win+B and Win+L might only be reserved on Windows XP and above.

Alt, Ctrl, Shift, Win These are the modifier keys themselves!

Other Any global hotkeys a user has defined using third-party software, any combos of two or more "base keys" such as '{F1}{F2}', and any keys of the form '{LALT}' or '{ALTDOWN}'.

Link to comment
Share on other sites

It all worked except for F12, when I hit it it does nothing. The script looks fine to me though..

Some systems reserve the F12 key for other uses and it should not be used as a hotkey. There used to be a warning in the help file about that but I can't seem to find it now.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Thanks a lot for the help so far guys! But i'm having a little problem now.

I've changed the code to this:

HotKeySet("{SCROLLLOCK}","Quit");Press PAUSE to quit
HotKeySet("{PAUSE}","VolumeMute")
HotKeySet("{PGUP}","VolumeUp")
HotKeySet("{PGDOWN}","VolumeDown")

While 1
    Sleep(50)
WEnd

Func Quit()
    Exit
EndFunc

Func VolumeMute()
    Send("{VOLUME_MUTE}")
EndFunc

Func VolumeUp()
    Send("{VOLUME_UP}")
EndFunc

Func VolumeDown()
    Send("{VOLUME_DOWN}")
EndFunc

But for some reason when I hit page down to turn the volume down a tick it actually pans the master volume to the left a tick instead. Everything else works fine. Really strange.

Edited by blackhydra866
Link to comment
Share on other sites

Thanks a lot for the help so far guys! But i'm having a little problem now.

I've changed the code to this:

HotKeySet("{SCROLLLOCK}","Quit");Press PAUSE to quit
HotKeySet("{PAUSE}","VolumeMute")
HotKeySet("{PGUP}","VolumeUp")
HotKeySet("{PGDOWN}","VolumeDown")

While 1
    Sleep(50)
WEnd

Func Quit()
    Exit
EndFunc

Func VolumeMute()
    Send("{VOLUME_MUTE}")
EndFunc

Func VolumeUp()
    Send("{VOLUME_UP}")
EndFunc

Func VolumeDown()
    Send("{VOLUME_DOWN}")
EndFunc

But for some reason when I hit page down to turn the volume down a tick it actually pans the master volume to the left a tick instead. Everything else works fine. Really strange.

HotKeySet("{SCROLLLOCK}","Quit");Press SCROLLLOCK to quit
HotKeySet("{PAUSE}","VolumeMute")
HotKeySet("{PGUP}","VolumeUp")
HotKeySet("{PGDN}","VolumeDown")

While 1
    Sleep(20)
WEnd

Func Quit()
    Exit
EndFunc

Func VolumeMute()
    Send("{VOLUME_MUTE}")
EndFunc

Func VolumeUp()
    Send("{VOLUME_UP}")
EndFunc

Func VolumeDown()
    Send("{VOLUME_DOWN}")
EndFunc

When the words fail... music speaks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...