StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Final  
#1 Posted : Sunday, September 1, 2019 7:14:18 PM(UTC)
Final

Rank: Newbie

Reputation:

Groups: Approved
Joined: 8/7/2019(UTC)
Posts: 5
China

Thanks: 4 times
我想通过S+来调整系统的声音
请教下,我该如何设置,谢谢
Rob  
#2 Posted : Monday, September 2, 2019 7:14:57 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 539
United States

Thanks: 5 times
Was thanked: 116 time(s) in 103 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/AudioSwitcher
Code:
var mixer = sp.GetPlaybackMixer();  //Can also call sp.GetCommunicationsMixer() to get the communications mixer
mixer.Volume = 37; //Set volume to 37%
thanks 1 user thanked Rob for this useful post.
Final on 9/3/2019(UTC)
Final  
#3 Posted : Tuesday, September 3, 2019 12:34:38 AM(UTC)
Final

Rank: Newbie

Reputation:

Groups: Approved
Joined: 8/7/2019(UTC)
Posts: 5
China

Thanks: 4 times
谢谢,暂时只需要微调就可以了。
chilled  
#4 Posted : Tuesday, December 17, 2019 4:16:07 PM(UTC)
chilled

Rank: Newbie

Reputation:

Groups: Approved
Joined: 12/16/2019(UTC)
Posts: 4

Originally Posted by: Rob Go to Quoted Post
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/AudioSwitcher
Code:
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.
Rob  
#5 Posted : Tuesday, December 17, 2019 5:23:51 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 539
United States

Thanks: 5 times
Was thanked: 116 time(s) in 103 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.
Rob  
#6 Posted : Tuesday, December 17, 2019 5:45:00 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 539
United States

Thanks: 5 times
Was thanked: 116 time(s) in 103 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");
                 }`
);
Rob  
#7 Posted : Tuesday, December 17, 2019 6:18:56 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 539
United States

Thanks: 5 times
Was thanked: 116 time(s) in 103 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?

Users browsing this topic
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.