Rank: Newbie
Groups: Approved
Joined: 8/7/2019(UTC) Posts: 6 Thanks: 4 times
|
我想通过S+来调整系统的声音 请教下,我该如何设置,谢谢
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
How do you want to adjust the sound? The easiest and (usually) most compatible method is to send the volume key strokes (sent by keyboards with volume up/down/mute) Code:sp.SendVKey(vk.VOLUME_MUTE); //Mute
sp.SendVKey(vk.VOLUME_DOWN); //Lower volume
sp.SendVKey(vk.VOLUME_UP); //Increase volume
If you want to control the playback mixer directly, you can retrieve the object and adjust accordingly. See this repo for more details about how to use this library, as I did not create it: https://github.com/xenolightning/AudioSwitcherCode:var mixer = sp.GetPlaybackMixer(); //Can also call sp.GetCommunicationsMixer() to get the communications mixer
mixer.Volume = 37; //Set volume to 37%
|
1 user thanked Rob for this useful post.
|
|
|
Rank: Newbie
Groups: Approved
Joined: 8/7/2019(UTC) Posts: 6 Thanks: 4 times
|
|
|
|
|
Rank: Newbie
Groups: Approved
Joined: 12/16/2019(UTC) Posts: 4
|
Originally Posted by: Rob How do you want to adjust the sound? The easiest and (usually) most compatible method is to send the volume key strokes (sent by keyboards with volume up/down/mute) Code:sp.SendVKey(vk.VOLUME_MUTE); //Mute
sp.SendVKey(vk.VOLUME_DOWN); //Lower volume
sp.SendVKey(vk.VOLUME_UP); //Increase volume
If you want to control the playback mixer directly, you can retrieve the object and adjust accordingly. See this repo for more details about how to use this library, as I did not create it: https://github.com/xenolightning/AudioSwitcherCode:var mixer = sp.GetPlaybackMixer(); //Can also call sp.GetCommunicationsMixer() to get the communications mixer
mixer.Volume = 37; //Set volume to 37%
Hi Rob! How to write these scripts, do not understand programming When the mouse is moved to the left and right of the screen, the scroll wheel will increase and decrease the volume at this time. When the mouse moves to the top of the screen, it will automatically send a customized combination of global hot keys and shortcut keys, such as space + j, or when you open a program, file, folder, etc., and the mouse moves to the upper left area of the screen, it will automatically press the keys WIN + TAB for easy selection of windows.
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
For the volume, under Global Actions > Mouse Events > Mouse Wheel Script, use this code: Code://If mouse location is within 20 pixels of the left or right edge of the working area of the screen
//increase or decrease volume based on the scroll direction
if(wheel.X >= (parseInt(wheel.Window.Screen.WorkingArea.Right) - 20)
|| wheel.X <= (parseInt(wheel.Window.Screen.WorkingArea.Left) + 20)) {
if(wheel.Delta > 0) {
//mouse wheel scrolled up, increase volume
sp.SendVKey(vk.VOLUME_UP);
} else {
//mouse wheel scrolled down, decrease volume
sp.SendVKey(vk.VOLUME_DOWN);
}
} else {
sp.MouseWheel(wheel.Point, false, wheel.Delta);
}
I will make a separate post for the others, as those are a bit different since they're not triggered by a mouse button or wheel, so you have to use a timer to watch the mouse's location.
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
For the upper left corner script, you need to create a timer. Put this in your Global Actions > Load/Unload Scripts > Load Script: Code:sp.CreateTimer("Mouse Upper Left",
0, //start delay (immediate)
500, //interval, checks every 500 milliseconds
`if(sp.GetCurrentMousePoint().Equals(Screen.FromPoint(sp.GetCurrentMousePoint()).WorkingArea.Location)) {
//if the mouse is in the upper left corner of the screen
//and the upper left script is NOT currently running
if(!sp.GetStoredBool("MouseUpperLeftScript")) {
//store a value to indicate the script is running, so it doesn't keep executing
sp.StoreBool("MouseUpperLeftScript", true);
//Send WIN+TAB
sp.SendModifiedVKeys([vk.LWIN], [vk.TAB]);
}
} else {
//IF the mouse is no longer in the upper left corner, clear the value
sp.DeleteStoredBool("MouseUpperLeftScript");
}`
);
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
"When the mouse moves to the top of the screen, it will automatically send a customized combination of global hot keys and shortcut keys, such as space + j,"
Can you give some more specifics here?
Do you want it to do something per application? Other specific criteria?
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close