|
process_name=acGetExecutableName(acGetForegroundWindow()) |
|
if process_name ~= "TurboLaunch.exe" then |
|
|
|
current_window=acGetForegroundWindow() |
|
current_window_x=acGetWindowLeft(acGetForegroundWindow(), gsx, gsy) |
|
current_window_y=acGetWindowTop(acGetForegroundWindow(), gsx, gsy) |
|
-- acMessageBox("X: "..tostring(current_window_x).." Y: ".. tostring(current_window_y), "Current Window X Y Coords Is:", nil) |
|
|
|
|
|
monitor_on_current_window=acGetMonitorFromPoint(current_window_x, current_window_y) |
|
monitor_name=acGetMonitorName(monitor_on_current_window) |
|
-- acMessageBox(monitor_name, "Current Monitor Name Is:", nil) |
|
|
|
-- according to the description in acSendWindowToMonitorByName we need to escape the \ chars |
|
left_monitor_name="\\\\.\\DISPLAY2" |
|
right_monitor_name="\\\\.\\DISPLAY1" |
|
monitor_name_to_send = left_monitor_name |
|
monitor_handle_to_send=acGetMonitorFromName(monitor_name_to_send) |
|
|
|
acDisplayText("Sending "..tostring(process_name).." Window To:\n"..tostring(monitor_name_to_send),"Helvetica",35,78, 252, 3,2000,20,1300) |
|
|
|
if monitor_name ~= left_monitor_name then |
|
acSendWindowToMonitorByName(current_window, nil, nil, monitor_name_to_send) |
|
end |
|
|
|
monitor_left=acGetMonitorLeft(monitor_handle_to_send, 1) |
|
monitor_top=acGetMonitorTop(monitor_handle_to_send, 1) |
|
monitor_right=acGetMonitorRight(monitor_handle_to_send, 1) |
|
monitor_bottom=acGetMonitorBottom(monitor_handle_to_send, 1) |
|
-- acMessageBox("Left:"..tostring(monitor_left).." Top:"..tostring(monitor_top).." Right:"..tostring(monitor_right).." Bottom:"..tostring(monitor_bottom), "Monitor Area Coords", nil) |
|
|
|
|
|
|
|
current_window_size_x=math.abs(acGetWindowLeft(acGetForegroundWindow(), nil, nil) - acGetWindowRight(acGetForegroundWindow(), nil, nil)) |
|
current_window_size_y=math.abs(acGetWindowBottom(acGetForegroundWindow(), nil, nil) - acGetWindowTop(acGetForegroundWindow(), nil, nil)) |
|
|
|
monitor_size_x = math.abs(monitor_left-monitor_right) |
|
monitor_size_y = math.abs(monitor_top-monitor_bottom) |
|
|
|
|
|
local positions = { |
|
["rustdesk.exe"] = 1920 - 690 - 850, |
|
["ApplicationFrameHost.exe"] = monitor_top, |
|
["Teams.exe"] = 1920 - 690 - 350 - 600, |
|
["msedge.exe"] = 1920 - 690 - 350- 60 , |
|
["thunderbird.exe"] = 1920 - 690 - 350 - 650 |
|
} |
|
|
|
local heights = { |
|
["ApplicationFrameHost.exe"] = 600 |
|
} |
|
|
|
local y_pos = positions[process_name] or (1920 - 690 - 350 - 850) |
|
local height=heights[process_name] or 600 |
|
|
|
acRestoreWindow(acGetForegroundWindow(), nil, nil) |
|
|
|
|
|
-- move window to the top of the monitor |
|
acMoveWindow(acGetForegroundWindow(), nil, nil, monitor_left, y_pos) |
|
-- set the window size with regarding to monitor size |
|
acSetWindowSize(acGetForegroundWindow(), nil, nil, monitor_size_x, height) |
|
end |
|
|
|
|