Post Reply
Gijs 2016-04-18 11:13
How can I use the WndLayout2 script for an app that shows up with a title (using the WndInfoAll script), but not with a caption when using the WndLayoutAppInfo script. Thanks
|
Christian Studer 2016-04-18 12:18
Most likely the window has no caption, the WndInfoAll script first lists the caption followed by the window class name between (). Every window has a class name.
There are two solutions, you could either use the PositionWndClass or PositionApp script for the application, or I could create a modified version of WndLayout2 which supports identifying windows by class name if no caption is present. Let me know what you would prefer.
Christian Studer - www.realtimesoft.com
|
Gijsberth 2016-04-19 02:20
Christian, Thank you for the quick reply. I like Ultramon a lot. I forgot to tell you that it worked for this app under win 7 (and even when I upgraded to win 10). However, now with a clean install of win 10, just this app does not work anymore.
WndInfoAll gives the following: Optiemaat-W Netmaster (TMainForm) handle - 0x1809A4 parent = 0x0.exe ..etc.
However, the WndLayoutAppInfo does not show the window.
The app has several windows like this. What is the best solution to go?
Thanks Gijsberth
|
Christian Studer 2016-04-19 13:45
In that case the window does indeed have a caption, but it looks like UltraMon doesn't treat it as an application window, that would explain why WndLayoutAppInfo doesn't list it.
Could you post the full information for the window from WndInfoAll? That might show why the window gets ignored.
Glad to hear you like UltraMon!
Christian Studer - www.realtimesoft.com
|
Gijsberth 2016-04-19 23:46
Hi Christian, please find below the info from WndInfoAl for the windows in question:
AEX 456.458(+1.25%) Tue 19-4-16 P&L... [Depot:16-ib-rs] (TFNewPosForm) handle = 0xF0670 parent = 0x0 exe = "C:\Opmat\Opmatw.exe" pos = 860,1 (mon 1) size = 820x950 show = 2 style = 0x16CF0000 exStyle = 0x10100 (UltraMonWndExtInproc) handle = 0x180206 parent = 0x130AFE exe = "C:\Opmat\Opmatw.exe" pos = 740,86 (mon 1) size = 68x18 show = 2 style = 0x94000000 exStyle = 0x8080080 AEX 456.458(+1.25%) Tue 19-4-16 OAS... [Depot:16-ib-rs] (TGridForm) handle = 0x130AFE parent = 0x0 exe = "C:\Opmat\Opmatw.exe" pos = 142,85 (mon 1) size = 815x800 show = 2 style = 0x16CF0000 exStyle = 0x10100 (UltraMonWndExtInproc) handle = 0x6C0552 parent = 0x1D7061E exe = "C:\Opmat\Opmatw.exe" pos = 104,86 (mon 1) size = 34x18 show = 2 style = 0x94000000 exStyle = 0x8080080 Koersmonitor[102] (TForm_Monitor) handle = 0x1D7061E parent = 0x0 exe = "C:\Opmat\Opmatw.exe" pos = 1,85 (mon 1) size = 180x870 show = 2 style = 0x16CC0000 exStyle = 0x10100 (UltraMonWndExtInproc) handle = 0x1A092E parent = 0x7F051A exe = "C:\Opmat\Opmatw.exe" pos = 292,1 (mon 1) size = 34x18 show = 2 style = 0x94000000 exStyle = 0x8080080 Optiemaat-W NetMaster (TMainForm) handle = 0x7F051A parent = 0x0 exe = "C:\Opmat\Opmatw.exe" pos = 0,0 (mon 1) size = 470x87 show = 2 style = 0x16CA0000 exStyle = 0x10100 Optiemaat v1.59 (TApplication) handle = 0x620688 parent = 0x0 exe = "C:\Opmat\Opmatw.exe" pos = 840,525 (mon 1) size = 0x0 show = 2 style = 0x94CA0000 exStyle = 0x100 Optiemaat - DataServer v1.59 (TApplication) handle = 0xA70AB4 parent = 0x0 exe = "C:\Opmat\NomServ.exe" pos = -32000,-32000 (mon 0) size = 160x28 show = 1 style = 0xB4CA0000 exStyle = 0x100
When I use WWndLayoutAppInfo, I only get
Optiemaat v1.59 840,525,0,0
Thanks Gijsberth
|
Gijsberth 2016-04-20 00:58
Christian, to complete, the script below worked fine in the past on my win 7 machine and also on the win 7 upgraded to win 10. Only, on the new clean install win 10, it does not work anymore.
APPS = Array("Optiemaat-W NetMaster*", "Koersmonitor*", "*P&L curve...*", "*Optieanalysescherm...*") 'caption of the windows which should get positioned, can contain a wildcard (*)
POS = Array("1,1,470,87", "1,90,193,809", "893,10,774,902", "93,93,814,799") 'position of each window. a single number means maximized on that monitor, otherwise enter left and top position, optionally followed by width and height
Set wnd = CreateObject("UltraMon.Window")
For i = 0 To UBound(APPS)
If UBound(POS) < i Then
MsgBox "Position missing for app " & APPS(i) & ".",, WScript.ScriptName
WScript.Quit
End If
If wnd.Find(APPS(i), "", 1, 0, 0) = True Then
posVals = Split(POS(i), ",")
numPosVals = UBound(posVals) + 1
If numPosVals < 1 Then
MsgBox "Invalid position value for app " & APPS(i) & ".",, WScript.ScriptName
WScript.Quit
End If
If numPosVals = 1 Then
wnd.Monitor = CLng(posVals(0))
wnd.ShowState = 3 'maximized
Else
wnd.Left = CLng(posVals(0))
If numPosVals >= 2 Then wnd.Top = CLng(posVals(1))
If numPosVals >= 3 Then wnd.Width = CLng(posVals(2))
If numPosVals >= 4 Then wnd.Height = CLng(posVals(3))
wnd.ShowState = 2 'normal
End If
wnd.ApplyChanges 0
End If
Next
Thanks Gijsberth
|
Christian Studer 2016-04-20 14:12
I'm not sure why that wouldn't work, this is the original WndLayout script which works differently from WndLayout2.
I would first check if the script actually finds the windows, to do this insert the following below line 11 in the script:
MsgBox "Window " & APPS(i) & " found."
Christian Studer - www.realtimesoft.com
|
Gijsberth 2016-04-21 01:32
Christian, I entered the suggested line after this line:
If wnd.Find(APPS(i), "", 1, 0, 0) = True Then
All four windows result in a message box: windowname found. However, the windows are not moved/adjusted....
Could there be a UAC issue?
Gijsberth
|
Christian Studer 2016-04-21 08:37
That's possible, do the applications run with elevated privileges (as administrator)?
Christian Studer - www.realtimesoft.com
|
Gijsberth 2016-04-21 11:20
Yes, it runs as administrator.
Gijsberth
|
Christian Studer 2016-04-21 13:35
Running the script as administrator as well should fix the problem, to do this create a new shortcut and enter the following in the Location of Item field:
wscript.exe "<script>"
for example: wscript.exe "C:\Temp\WndLayout.vbs"
Then open properties for the shortcut, click on Advanced and check 'Run as administrator' there.
The problem is that applications running with elevated privileges can't be moved by applications with lower privileges, UltraMon itself gets around this by moving those applications via a separate application, UltraMonUiAcc.exe, which runs with special privileges enabling it to move those windows.
Christian Studer - www.realtimesoft.com
|
Gijsberth 2016-04-21 15:13
Christian, thanks for the support! This solves the issue. Gijsberth
|
Post Reply
|