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

Notification

Icon
Error

Options
Go to last post Go to first unread
randomConstant  
#1 Posted : Tuesday, February 22, 2022 12:36:39 PM(UTC)
randomConstant

Rank: Advanced Member

Reputation:

Groups: Translators, Approved
Joined: 7/17/2021(UTC)
Posts: 135

Thanks: 35 times
Was thanked: 18 time(s) in 15 post(s)
Hi all,

I was wondering if there is a way to directly change the audio levels of left and right sides of headphones(audio device) separately using S+

For example: have left side audio level 20 and right side audio level 22; it is helpful for people who have slight hearing issue on one ear.

I currently use this command to open Sound properties:
Code:
sp.RunProgram('rundll32.exe', String.raw` Shell32.dll,Control_RunDLL Mmsys.cpl,,0`, 'open', 'normal', false, false, false);


After that I have to open a sound device's properties, then go to the Levels tab, and then change levels from Balance menu.

There are some software like SimpleSndVol but it would be much better to do using S+ gestures. Also the levels get reset once volume is brought to zero so S+ is handy in changing them frequently.

Thanks
Rob  
#2 Posted : Tuesday, February 22, 2022 5:39:56 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
Managing sound in Windows is overly complicated, so there's not much built-in but what comes with CoreAudioDevice, which is a third-party library that is included with S+.

It's probably easiest to just shell out to a command line utility designed to handle it, for example:

https://www.nirsoft.net/articles/set-audio-balance-command-line.html

Edited by user Tuesday, February 22, 2022 5:40:51 PM(UTC)  | Reason: Not specified

randomConstant  
#3 Posted : Wednesday, February 23, 2022 9:10:36 AM(UTC)
randomConstant

Rank: Advanced Member

Reputation:

Groups: Translators, Approved
Joined: 7/17/2021(UTC)
Posts: 135

Thanks: 35 times
Was thanked: 18 time(s) in 15 post(s)
Thanks for the quick feedback Rob

I came across this software but I thought it would need to be closed manually every time it ran.

Now, I tried it and it seems that the program starts, does the job, and then quickly closes on its own when using command line (as observed using process explorer)

So everything is good now I guess.. but still I have a noob question, how do you kill/close a program using S+? Confused
Rob  
#4 Posted : Wednesday, February 23, 2022 2:34:01 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
Assuming S+ is allowed to access the process, here are a few examples.
Code:
// Graceful way by process ID
var proc = System.Diagnostics.Process.GetProcessById(9836);
proc.CloseMainWindow();
proc.Close();

// Force kill by process ID
var proc = System.Diagnostics.Process.GetProcessById(9836);
proc.Kill();

// Graceful way by partial window title
var wnd = sp.WindowsFromTitlePartial("Untitled - Paint").First();
wnd.Process.CloseMainWindow();
wnd.Process.Close();

// Force kill by partial window title
var wnd = sp.WindowsFromTitlePartial("Untitled - Paint").First();
wnd.Process.Kill();
thanks 1 user thanked Rob for this useful post.
randomConstant on 2/23/2022(UTC)
randomConstant  
#5 Posted : Wednesday, February 23, 2022 5:10:35 PM(UTC)
randomConstant

Rank: Advanced Member

Reputation:

Groups: Translators, Approved
Joined: 7/17/2021(UTC)
Posts: 135

Thanks: 35 times
Was thanked: 18 time(s) in 15 post(s)
Amazing!! Thanks a lot Rob Laugh
soooulp  
#6 Posted : Wednesday, February 23, 2022 7:37:25 PM(UTC)
soooulp

Rank: Advanced Member

Reputation:

Groups: Moderators, Approved
Joined: 4/23/2020(UTC)
Posts: 161
China

Thanks: 46 times
Was thanked: 23 time(s) in 17 post(s)
Does it seems different to wnd.SendClose?
Rob  
#7 Posted : Thursday, February 24, 2022 1:38:50 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
SendClose() is usually sufficient and about the same.

Kill() is when you just want to force close an app, especially a command line app that doesn't have a window.
Users browsing this topic
Guest
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.