Belgium Posted August 24, 2013 Share Posted August 24, 2013 Hello guys, This is my first post, sorry if I'm doing something wrong. This is the code: MsgBox(32,"Information","F6 - Volume down" & @CR & "F7 - Volume up") HotKeySet("F6","volumedown") HotKeySet("F7","volumeup") $vold = -5 $volu = +5 Func volumedown() SoundSetWaveVolume($vold) EndFunc Func volumeup() SoundSetWaveVolume($volu) EndFunc The problem: When I press F6 or F7 a several times, the volume isn't in- or decreasing. What am I doing wrong? Thanks in advance. Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted August 24, 2013 Moderators Solution Share Posted August 24, 2013 Belgium, What am I doing wrong?Quite lot, unfortunately! You need to set a master value for the volume which you then change when you press the HotKeys and you need to keep the script alive by adding a loop. Take a look at this example and see if you can work out why I have changed it as I have:HotKeySet("a","volumedown") HotKeySet("b","volumeup") HotKeySet("{ESC}", "On_Exit") Global $vol = 100 ; Here is the initial setting which is used everywhere While 1 Sleep(10) WEnd Func volumedown() If $vol > 0 Then $vol -= 5 ; Decrease if we are not already at 0 EndIf SoundSetWaveVolume($vol) EndFunc Func volumeup() If $vol < 100 Then $vol += 5 ; Increase if we are not already at 100 EndIf SoundSetWaveVolume($vol) EndFunc Func On_Exit() Exit EndFuncI also changed the HotKeys so they so not conflict with SciTE and added a way of exiting. Please ask if you have any questions. And finally, if you run Vista+ than you only affect the volume of this process and not the overall volume - open the volume applet and you will see that is what is happening. M23 Belgium 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Belgium Posted August 24, 2013 Author Share Posted August 24, 2013 Oh, thank you! I'm using Windows 7 and, yeah only the AutoIT volume was in- or decreasing. But, now I learned how to keep the script alive by adding a loop. Btw, isn't there a way to adjust the overall volume? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 24, 2013 Moderators Share Posted August 24, 2013 Belgium, a way to adjust the overall volumeThis thread should do the trick. By the way, there is a forum "Search" function at top right - that is how I found this thread (even though I knew it was there somewhere). M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now