Move active window full screen on left of three monitors

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
2Took
Posts: 24
Joined: 12 Aug 2022, 12:25

Move active window full screen on left of three monitors

Post by 2Took » 12 Aug 2022, 12:34

Hi,

How do I Move active window full screen on left of three monitors -- by AHK code?

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Move active window full screen on left of three monitors

Post by BoBo » 12 Aug 2022, 13:16

Welcome to this AHK forum.
Click :arrow: WinMove

2Took
Posts: 24
Joined: 12 Aug 2022, 12:25

Re: Move active window full screen on left of three monitors

Post by 2Took » 12 Aug 2022, 13:47

I put together a line below, saved and reloaded script. Tried with a calculator, notepad windows, by Ctrl Shift L, but nothing happens?

Code: Select all

^+l::WinMove, -1920,0 ;Ctrl Shift L - moves active window to left monitor

wetware05
Posts: 750
Joined: 04 Dec 2020, 16:09

Re: Move active window full screen on left of three monitors

Post by wetware05 » 12 Aug 2022, 15:56

"Groundhog Day", jejeje.

Visit this thread viewtopic.php?f=76&t=100651, or make use of the search. There is usually a response of all kinds and for all tastes. :thumbup:

wetware05
Posts: 750
Joined: 04 Dec 2020, 16:09

Re: Move active window full screen on left of three monitors

Post by wetware05 » 12 Aug 2022, 17:33

Hi, 2Took

What was said in the other thread. Microsoft Windows have by default a keyboard shortcut to change the screen of the application under the mouse, it is Windows key+Shift+right or left key, depending on the relative position of the application (if you only have two monitors, pressing the key to the right already works).

2Took
Posts: 24
Joined: 12 Aug 2022, 12:25

Re: Move active window full screen on left of three monitors

Post by 2Took » 17 Aug 2022, 14:14

Here's a one liner that works in moving active window to the left monitor, full screen (used Window Spy for coordinates):

Code: Select all

^+l::WinMove, A,, -1920,0 ;Ctrl Shift L - moves active window to left monitor

User avatar
Justin-TestBot101a
Posts: 33
Joined: 04 Aug 2022, 20:00

Re: Move active window full screen on left of three monitors

Post by Justin-TestBot101a » 18 Aug 2022, 23:39

Sorry to bother, but I am unable to get this window to move.. Could you tell me what is wrong?

Everything else works, but the window never moves or minimizes..

Code: Select all

Pause::
launchLuaMacros:
Process, Exist, LuaMacros.exe
if (ErrorLevel)
{
  ;Process, Close, %ErrorLevel% ; originally let you toggle LuaMacros on/off. Disabled now.
}
else
{
  MsgBox, 4,, Would you like to start LuaMacros?
  IfMsgBox, Yes
  {
    Run *RunAs LuaMacros.exe MacroBoard-Jt.lua -r ; admin-runs LuaMacros, loads the correct lua script
    WinWait, LuaMacros - MacroBoard-Jt.lua ahk_class Window ; Wait for window to open
    WinMove, LuaMacros - MacroBoard-Jt.lua ahk_class Window, , 595, -777 ; Moves class to location
    WinMinimize, LuaMacros - MacroBoard-Jt.lua ahk_class Window ; Minimize the window
    Sleep 2000
  }
}
return
Last edited by Justin-TestBot101a on 19 Aug 2022, 01:09, edited 2 times in total.

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Move active window full screen on left of three monitors

Post by BoBo » 18 Aug 2022, 23:50

WinWait, WinMove, WinMinimize,…
A window title or other criteria identifying the target window. See WinTitle.

User avatar
Justin-TestBot101a
Posts: 33
Joined: 04 Aug 2022, 20:00

Re: Move active window full screen on left of three monitors

Post by Justin-TestBot101a » 18 Aug 2022, 23:53

BoBo wrote:
18 Aug 2022, 23:50
WinWait, WinMove, WinMinimize,…
A window title or other criteria identifying the target window. See WinTitle.
I have that in my code......

Did you not look at it?

User avatar
Justin-TestBot101a
Posts: 33
Joined: 04 Aug 2022, 20:00

Re: Move active window full screen on left of three monitors

Post by Justin-TestBot101a » 19 Aug 2022, 00:18

BoBo wrote:
18 Aug 2022, 23:50
WinWait, WinMove, WinMinimize,…
A window title or other criteria identifying the target window. See WinTitle.
WinTitle is not working for LuaMacros window...

Is there anything else?

P.S.
This is what Window Spy for AHKv2 tells me about the LuaMacros window.
The PID and ID change every time I reopen the program.Image
Attachments
image.png
image.png (9.33 KiB) Viewed 1112 times

gregster
Posts: 8990
Joined: 30 Sep 2013, 06:48

Re: Move active window full screen on left of three monitors

Post by gregster » 19 Aug 2022, 04:17

Afaics, you start the Lua program elevated. Then your script needs to run elevated as well.
https://www.autohotkey.com/docs/FAQ.htm#uac

User avatar
Justin-TestBot101a
Posts: 33
Joined: 04 Aug 2022, 20:00

Re: Move active window full screen on left of three monitors

Post by Justin-TestBot101a » 20 Aug 2022, 16:43

gregster wrote:
19 Aug 2022, 04:17
Afaics, you start the Lua program elevated. Then your script needs to run elevated as well.
https://www.autohotkey.com/docs/FAQ.htm#uac
I was thinking that, but did not add it.. Thank you! It works great now!

Code: Select all

full_command_line := DllCall("GetCommandLine", "str")

if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
{
    try
    {
        if A_IsCompiled
            Run *RunAs "%A_ScriptFullPath%" /restart
        else
            Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
    }
    ExitApp
}

;MsgBox A_IsAdmin: %A_IsAdmin%`nCommand line: %full_command_line%
I added this code at the start and everything is working great!

Post Reply

Return to “Ask for Help (v1)”