StrokesPlus.net Forum
»
General Discussion
»
Scripts
»
Can't grab SystemWindow using "WindowFromClassOrTitle" or "WindowsFromTitleRegex"
Rank: Newbie
Groups: Approved
Joined: 1/31/2021(UTC) Posts: 8 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.
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 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, "".
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 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();
|
1 user thanked Rob for this useful post.
|
|
|
Rank: Newbie
Groups: Approved
Joined: 1/31/2021(UTC) Posts: 8 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.
|
|
|
|
StrokesPlus.net Forum
»
General Discussion
»
Scripts
»
Can't grab SystemWindow using "WindowFromClassOrTitle" or "WindowsFromTitleRegex"
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