Author |
Topic |
|
ycomp
14 Posts |
Posted - 02/09/2016 : 08:33:11
|
sorry for the title, the Subject wouldn't allow for longer.
I have a problem with Chrome. I have a V gesture that opens a new chrome window.
Works great.
The Only problem is that it tends to open the chrome window on the monitor where the last chrome window is displayed. Since I have a chrome window sitting on my second monitor for reference purposes at all times, often I'm drawing the V on the main monitor but chrome pops up on the secondary monitor and then I have drag it to the main monitor.
here is my current code, how could I modify it to detect the mouse monitor and move the window there?
--- Chrome Launch Code ---
function chrome(reposition)
--acShellExecute("open", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", "--new-window --window-size=1300,1080 --window-position=0,0", "", 1) --sample opens the Windows folder
acShellExecute("open", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", "--new-window", "", 1) --sample opens the Windows folder
if (not reposition) then
return
end
--minimizeDashboard()
-- TRY to reposition and resize window in the first 200ms
acDelay(200)
AttemptRepositonAndResize()
-- VERIFY that it has been properly positioned,
-- if not then reposition and resize it
acDelay(200)
AttemptRepositonAndResize()
acDelay(200)
AttemptRepositonAndResize()
acDelay(200)
AttemptRepositonAndResize()
end |
|
ycomp
14 Posts |
Posted - 02/09/2016 : 08:35:37
|
function AttemptRepositonAndResize()
--h = acGetForegroundWindow()
h = acFindWindowByTitleRegex("New Tab - Google Chrome")
s = acGetWindowTitle(h, 0, 0)
--acMessageBox(s, s, 0)
if s == "New Tab - Google Chrome" then
acSetWindowSize(h, 0, 0, 1073, 1080, 0, 0)
acMoveWindow(h, 0, 0, 848, 0)
end
end
|
|
|
Rob
USA
2615 Posts |
Posted - 02/09/2016 : 22:01:56
|
This works on my machine, obviously you can tweak it accordingly:acShellExecute("open", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", "--new-window", "", 1)
acDelay(300)
h = acFindWindowByTitleRegex("New Tab - Google Chrome")
acRestoreWindow(h, nil, nil)
acSendWindowToMonitorByHandle(h, nil, nil, acGetMonitorFromPoint(gsx, gsy)) --Send it to the monitor where the gesture started
acMaximizeWindow(h, nil, nil) |
|
|
ycomp
14 Posts |
Posted - 02/11/2016 : 10:45:57
|
thanks for the help, I'll give it a go. |
|
|
|
Topic |
|
|
|