Page 1 of 1
How do I launch Chrome minimized?
Posted: 23 Sep 2021, 06:52
by william_ahk
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.
Re: How do I launch Chrome minimized?
Posted: 23 Sep 2021, 07:09
by mikeyww
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
Re: How do I launch Chrome minimized?
Posted: 23 Sep 2021, 11:49
by garry
@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
Re: How do I launch Chrome minimized?
Posted: 23 Sep 2021, 12:42
by mikeyww
If you want to maximize Chrome on start, you can just use the "--start-maximized" parameter. It's a bit easier.
Re: How do I launch Chrome minimized?
Posted: 23 Sep 2021, 13:03
by garry
@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
Re: How do I launch Chrome minimized?
Posted: 23 Sep 2021, 13:09
by mikeyww
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.
Re: How do I launch Chrome minimized?
Posted: 23 Sep 2021, 13:40
by garry
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
Re: How do I launch Chrome minimized?
Posted: 23 Sep 2021, 14:16
by RussF
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
Re: How do I launch Chrome minimized?
Posted: 23 Sep 2021, 14:45
by garry
@RussF thank you, had no succes when start without url , but can also define with autohotkey
Re: How do I launch Chrome minimized?
Posted: 23 Sep 2021, 14:47
by mikeyww
Nice idea about the LNK shortcut-- though did not actually work when I tried it with a previously maximized instance.
Re: How do I launch Chrome minimized?
Posted: 23 Sep 2021, 19:52
by william_ahk
@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?
Re: How do I launch Chrome minimized?
Posted: 23 Sep 2021, 20:04
by emrekarahan0001
Code: Select all
WinRestore, ahk_exe chrome.exe
WinMinimize, ahk_exe chrome.exe
Sleep, 500
WinMaximize, ahk_exe chrome.exe
Re: How do I launch Chrome minimized? Topic is solved
Posted: 23 Sep 2021, 20:58
by mikeyww
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%
Re: How do I launch Chrome minimized?
Posted: 23 Sep 2021, 22:23
by william_ahk
@mikeyww Thanks! This is a great solution