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

Notification

Icon
Error

Options
Go to last post Go to first unread
shoichit  
#1 Posted : Saturday, February 6, 2021 8:33:15 PM(UTC)
shoichit

Rank: Newbie

Reputation:

Groups: Approved
Joined: 1/31/2021(UTC)
Posts: 8
United States
Location: Liberty Lake

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Hi all,

My goal is to get SystemWindow for a running application to resize it. It works well except for VLC.exe (a media player) I couldn't get "SystemWindow " when the program is running using either "WindowFromClassOrTitle" nor "WindowsFromTitleRegex".

Initially, I tried to use WindowsFromTitleRegex to search by title like "VLC". It didn't find it so when I ran "AllApplications", the application was not listed there indeed. When I ran "AllWindows", it does show something that looks like like related as below:

Class: Qt5QWindowIcon Title: VLC media player
Class: QTrayIconMessageWindowClass Title: QTrayIconMessageWindow
Class: Static Title: VLC ghk 3.0.12

I tried "VLC media player" with "WindowFromClassOrTitle" as a title (the second argument). It failed. What do I do? BTW, I run below to find out what programs are be executed:

var wnds = sp.AllApplications();
var apps = '';
for (var i = 0, len = wnds.Length; i < len; i++) {
apps = apps + 'Class: ' + wnds[i].ClassName + ' Title: ' + wnds[i].Title + '\r\n';
}

apps = apps + "\r\n\r\nAllWindow below\r\n";
wnds = sp.AllWindows();
for (var i = 0, len = wnds.Length; i < len; i++) {
apps = apps + 'Class: ' + wnds[i].ClassName + ' Title: ' + wnds[i].Title + '\r\n';
}

clip.SetText(apps);

I know ForegroundWindow works but the idea is resizing multiple programs with one stroke without manually selecting them so I don't want to manually select it. I hope my explanation is not too confusing. Thank you in advance.
Rob  
#2 Posted : Sunday, February 7, 2021 1:06:30 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
Quote:
I tried "VLC media player" with "WindowFromClassOrTitle" as a title (the second argument). It failed

What do you mean it failed? Failed to find the window, or you got an error?

If it was an error, what did you use as the first argument? You should use an empty string, "".
Rob  
#3 Posted : Sunday, February 7, 2021 5:16:25 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
This worked fine for me, tested with VLC in the background - I activated the window just to see it change, it still maximized even if I didn't activate it first.
Code:
var vlc = sp.WindowFromClassOrTitle("", "VLC media player");
vlc.Activate();
vlc.Maximize();
thanks 1 user thanked Rob for this useful post.
shoichit on 2/8/2021(UTC)
shoichit  
#4 Posted : Monday, February 8, 2021 2:14:24 AM(UTC)
shoichit

Rank: Newbie

Reputation:

Groups: Approved
Joined: 1/31/2021(UTC)
Posts: 8
United States
Location: Liberty Lake

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Thank you! Yes, it works. I am not sure what I was doing wrong even.
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.