I've been trying to learn macro scheduler by myself with varying degrees of success. I've created a shortcut to my volume control on my c drive and use my page up key and page down keys for a shortcut. But what i really want to do is to click page up (or down) which executes sndvol32 sends Tab (to activate slider) then "Press down"
without me releasing page up (or down) key and without generating child windows. volume window would then close on release of up or down key.
Any help would be greatly appreciated.
haxxx.
"page up" to launch & control volume
Moderators: Dorian (MJT support), JRL
Something like this? This has to run full time. Would probably be best compiled but it will work as a script. While it is running, press and hold the Page Up or Page Down keys. The volume will go up or down. Release the key and the Volume Control window will close. If you want control of the volume. Hold either Page Up or Page Down, then press the other key and the volume can be changed one notch at a time.
Press Shift+Esc to close this
Press Shift+Esc to close this
Code: Select all
//VK33 = Page up
OnEvent>Key_Down,VK33,0,Volume
//VK34 = Page down
OnEvent>Key_Down,VK34,0,Volume
SRT>Volume
//Only run this code if the flag variable value is 0
If>KeyReleaseFlag=0
//Check to see if volume control is open before running the program to open it again.
IfWindowOpen>Volume Control
Else
Let>Rp_wait=0
Run>sndvol32
WaitWindowOpen>Volume Control
EndIf
Wait>0.2
SetFocus>Volume Control
Press Tab
EndIf
//Run this line setting the flag variable value to 1 every time the subroutine is
//called... which will be continuosly as long as the pressed key is held down.
Let>KeyReleaseFlag=1
END>Volume
//You need a flag variable for detecting and controlling the release of a key
Let>KeyReleaseFlag=0
//This loop runs waiting for a usable keypress
Label>Loop
Wait>0.01
//This "If" block in conjunction with the Key_Down OnEvent allows the script to know if
//the keys are pressed and released. While the key is pressed the OnEvent keeps firing.
//In the Subroutine called by the Key_Press OnEvent> the flag variable value is set to 1.
//The Loop keeps trying to raise the value of the flag variable up to 10 but as long as the
//key is pressed the Key_Down subroutine keeps resetting the value to 1. When the key is
//finally released, the loop will raise the flag variable value to 10 and then we can
//set the flag variable value back to 0 and perform other tasks associated with the key
//release, such as closing the Volume Control window.
If>KeyReleaseFlag>0
Add>KeyReleaseFlag,1
If>KeyReleaseFlag>10
Let>KeyReleaseFlag=0
CloseWindow>Volume Control
EndIf
EndIf
Goto>Loop
warning message
I tried your script and received the error message:
Line 17 specified window volume control not present,
any subsequent keysends in script may cause exceptions.
"abort" "ignore".
??
Line 17 specified window volume control not present,
any subsequent keysends in script may cause exceptions.
"abort" "ignore".
??
Works
I apologize error was on my end.
Two Questions though, 1. Where could i put a "wait" so the window doesn't close so quickly after i release the key, in case i want to micro adjust volume. 2. I've seen somewhere a "delay" variable, could that be used to slow the actual speed of the volume change? as it is If u have heavy fingers the slider moves rapidly. 3. If i set it to run at startup, is it okay to have it waiting for the entire time the PC is on, not a problem to me (just curious).
Thanks.
Two Questions though, 1. Where could i put a "wait" so the window doesn't close so quickly after i release the key, in case i want to micro adjust volume. 2. I've seen somewhere a "delay" variable, could that be used to slow the actual speed of the volume change? as it is If u have heavy fingers the slider moves rapidly. 3. If i set it to run at startup, is it okay to have it waiting for the entire time the PC is on, not a problem to me (just curious).
Thanks.
I see you've answered your own question 1. Excellent!
For question 2. I don't know of any "delay" variables except for "SK_DELAY" which can be used to slow text input when using the SendText> function. However, as I said earlier.
For question 2. I don't know of any "delay" variables except for "SK_DELAY" which can be used to slow text input when using the SendText> function. However, as I said earlier.
Question 3. It is most likely alright to have this running 100% of the time. As long as there is a short Wait> in the "Loop". However, I could see a problem where it might interfere with using the Page up or Page down keys in other applications. A slight modification to the OnEvent> line could allow you to use a modifier key and perhaps avoid conflict. See help for OnEvent> for more detail.If you want control of the volume. Hold either Page Up or Page Down, then press the other key and the volume can be changed one notch at a time.