Launch my script on startup but minimized

Get help with using AutoHotkey and its commands and hotkeys
eL Tux
Posts: 66
Joined: 06 Nov 2015, 07:52

Launch my script on startup but minimized

28 Jul 2020, 13:18

Hi, my script have a GUI and I want to launch my script on windows startup but minimized.

So I can launch my script on windows startup with this :

Code: Select all

FileCreateShortcut %A_ScriptFullPath%,%A_Startup%\%A_ScriptName%.lnk
But how to launch my script minimized in tray on startup and still launch my script not minimized when double-click on my script icon ?

Sorry for my poor english
Thanks.
need4speed
Posts: 132
Joined: 22 Apr 2016, 06:50

Re: Launch my script on startup but minimized

28 Jul 2020, 14:10

not sure what you're asking for.

you can simply create two shortcuts; then RMB select Properties, change "Run" to Minimized, the other set to "Normal Window",
drag and drop one shortcut to the startup folder and you're done.

Image
User avatar
flyingDman
Posts: 869
Joined: 29 Sep 2013, 19:01

Re: Launch my script on startup but minimized

28 Jul 2020, 14:34

Try something like this:

Code: Select all

menu, tray, add, maximize, max
menu, tray, default, maximize
gui, add, text, w100, some text
gui, show, minimize
return

max:
Gui, restore

Double click on the tray icon.
eL Tux
Posts: 66
Joined: 06 Nov 2015, 07:52

Re: Launch my script on startup but minimized

31 Jul 2020, 18:47

need4speed wrote:
28 Jul 2020, 14:10
not sure what you're asking for.

you can simply create two shortcuts; then RMB select Properties, change "Run" to Minimized, the other set to "Normal Window",
drag and drop one shortcut to the startup folder and you're done.

Image
This is what I need to do but from the script, so there is a way to set Run : Minimized from Autohotkey ?
eL Tux wrote:
28 Jul 2020, 13:18
Hi, my script have a GUI and I want to launch my script on windows startup but minimized.

So I can launch my script on windows startup with this :

Code: Select all

FileCreateShortcut %A_ScriptFullPath%,%A_Startup%\%A_ScriptName%.lnk
But how to launch my script minimized in tray on startup and still launch my script not minimized when double-click on my script icon ?

Sorry for my poor english
Thanks.
In this way my script always run minimized even when double-click on my script icon.

EDIT: Maybe I found a way to do it by creating another small script "RunMini.ahk" with this :

Code: Select all

#NoEnv
SetWorkingDir %A_ScriptDir%
SetWinDelay, -1
Run, %A_ScriptDir%\MyScript.ahk,,, pid
WinWait, ahk_pid %pid%
WinMinimize
And then in MyScript.ahk :

Code: Select all

FileCreateShortcut %A_ScriptDir%\RunMini.ahk,%A_Startup%\%A_ScriptName%.lnk

Return to “Ask For Help”

Who is online

Users browsing this forum: anv, DaveT1, LakaiHigh, mikeyww, TXShooter and 58 guests