How do I launch Chrome minimized? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
william_ahk
Posts: 482
Joined: 03 Dec 2018, 20:02

How do I launch Chrome minimized?

Post by william_ahk » 23 Sep 2021, 06:52

Code: Select all

Run, chrome.exe, , Min ; Has no effect
Was wondering why Chrome doesn't respond to window options. I've also looked Chrome flags but found none that could minimize the window on start.

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: How do I launch Chrome minimized?

Post by mikeyww » 23 Sep 2021, 07:09

It's because
some applications (e.g. Calc.exe) do not obey the requested startup state and thus Max/Min/Hide will have no effect.

Code: Select all

Run, chrome.exe
WinWait, ahk_class Chrome_WidgetWin_1 ahk_exe chrome.exe
WinMinimize

garry
Posts: 3740
Joined: 22 Dec 2013, 12:50

Re: How do I launch Chrome minimized?

Post by garry » 23 Sep 2021, 11:49

@mikeyww thanx , this is handy
I tried complicated to start chrome fullscreen , when started chrome.exe --new-window , it was always small , I tried then with winmove
viewtopic.php?f=76&t=94904&p=421760#p421760

Code: Select all

;- here chrome maximize
;- https://www.autohotkey.com/boards/viewtopic.php?f=76&t=94944
settitlematchmode,2
browser:="chrome.exe "
;browser:="C:\Program Files\Google\Chrome\Application\chrome.exe "
;Runwait, %browser%--start-fullscreen --new-window   ;- no success
Runwait, %browser%--new-window  ;- very small
WinWait, ahk_class Chrome_WidgetWin_1 ahk_exe chrome.exe
sleep,1000
WinMaximize      ;- maximize
return

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: How do I launch Chrome minimized?

Post by mikeyww » 23 Sep 2021, 12:42

If you want to maximize Chrome on start, you can just use the "--start-maximized" parameter. It's a bit easier.

garry
Posts: 3740
Joined: 22 Dec 2013, 12:50

Re: How do I launch Chrome minimized?

Post by garry » 23 Sep 2021, 13:03

@mikeyww thank you
I had no success , it only start maximized /fullscreen when I use URL

Code: Select all

url:="https://www.autohotkey.com/boards/viewforum.php?f=76"
Runwait,chrome.exe --start-maximized --new-window      ;- not  OK , chrome starts always with small-size 
;Runwait,chrome.exe %url%                              ;- it's OK > fullsize
;Runwait,%url%                                         ;- also OK  ( default browser is chrome )
return

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: How do I launch Chrome minimized?

Post by mikeyww » 23 Sep 2021, 13:09

The following worked at my end.

Code: Select all

Run, chrome.exe --start-maximized --new-window
I don't imagine that one would typically use RunWait here.

garry
Posts: 3740
Joined: 22 Dec 2013, 12:50

Re: How do I launch Chrome minimized?

Post by garry » 23 Sep 2021, 13:40

yes, runwait not needed here , but still starts with resized window ... (?)
I use your solution above

Code: Select all

Run, chrome.exe --new-window  ;- starts small / resized
WinWait, ahk_class Chrome_WidgetWin_1 ahk_exe chrome.exe
WinMaximize      ;- maximize

RussF
Posts: 1242
Joined: 05 Aug 2021, 06:36

Re: How do I launch Chrome minimized?

Post by RussF » 23 Sep 2021, 14:16

How about if you create a separate shortcut for Chrome - maybe call it Chrome-Min. In the properties of that shortcut, select "Run Minimized". Then run the shortcut from your ahk script. You can still pass arguments if you need to.

Russ

garry
Posts: 3740
Joined: 22 Dec 2013, 12:50

Re: How do I launch Chrome minimized?

Post by garry » 23 Sep 2021, 14:45

@RussF thank you, had no succes when start without url , but can also define with autohotkey

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: How do I launch Chrome minimized?

Post by mikeyww » 23 Sep 2021, 14:47

Nice idea about the LNK shortcut-- though did not actually work when I tried it with a previously maximized instance.

william_ahk
Posts: 482
Joined: 03 Dec 2018, 20:02

Re: How do I launch Chrome minimized?

Post by william_ahk » 23 Sep 2021, 19:52

@mikeyww This can solve the problem but there is still a tiny bit delay before AHK detects the Chrome window so it flickers. Is there a seamless way?

User avatar
emrekarahan0001
Posts: 25
Joined: 18 Jan 2021, 14:19

Re: How do I launch Chrome minimized?

Post by emrekarahan0001 » 23 Sep 2021, 20:04

Code: Select all

WinRestore, ahk_exe chrome.exe
WinMinimize, ahk_exe chrome.exe
Sleep, 500
WinMaximize, ahk_exe chrome.exe

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: How do I launch Chrome minimized?  Topic is solved

Post by mikeyww » 23 Sep 2021, 20:58

Code: Select all

WinSet, AlwaysOnTop, On, % original := "ahk_id " WinActive("A")
Run, chrome.exe
WinWait, ahk_class Chrome_WidgetWin_1 ahk_exe chrome.exe
WinMinimize
WinActivate, %original%
WinSet, AlwaysOnTop, Off, %original%

william_ahk
Posts: 482
Joined: 03 Dec 2018, 20:02

Re: How do I launch Chrome minimized?

Post by william_ahk » 23 Sep 2021, 22:23

@mikeyww Thanks! This is a great solution :thumbup:

Post Reply

Return to “Ask for Help (v1)”