PDA

View Full Version : porting a girder 5 lua script to girder 6 with win and monitor library calls



Stefan Ervik
November 8th, 2015, 03:15 PM
I'm trying to find information on win library in girder 6 but can't seem to find any. I have a script I'm trying to port from girder 5.
Found out that some functions like FindWindow isn't there but I can use FindWindowEx instead. But how do I get the dimensions. I used GetWindowRect previously, what is the mechanism now and also to move a window.

This is the script, as far as I have gotten.

local handle,top,left,bottom,right,width,height

handle = win.FindWindowEx(nil,nil,"MediaPlayerClassicW",nil)

top, left, bottom, right = win.GetWindowRect(handle)

width=right-left
height=bottom-top
if left < monitor.Monitors[1].Width then
left=monitor.Monitors[2].PositionX+(monitor.Monitors[2].Width-width)/2
top=monitor.Monitors[2].PositionY+(monitor.Monitors[2].Height-height)/2
else
left=monitor.Monitors[1].PositionX+(monitor.Monitors[1].Width-width)/2
top=monitor.Monitors[1].PositionY+(monitor.Monitors[1].Height-height)/2
end

win.SetWindowPos( handle, win.HWND_TOP, left, top, 0, 0, win.SWP_NOSIZE)

Sincerly Yours, Stefan

Ron
November 9th, 2015, 06:52 PM
Looks like we're missing GetWindowRect and SetWindowPos. I'll add this back in.

Ron
November 18th, 2015, 02:43 PM
I have implemented the missing functions. Screen access has changed a bit. You can find information for this in the manual under os.getScreens

I'm planning on releasing an update tomorrow.