OK, this script starts a new process for every window that is minimized,
so the initializing process can be ended.
it should be no problem to change this scripts, to be initially run from the cmd-line.
this should give you a start:
paste the code in the Min2Tray Script (new code colored red, surrounding old code black):
Code:
If ( %0% < 1 ) ; cmdline: no args -> behaviour: starter
{
;=========================================================================
; started as hotkey-launcher (starter)
Goto, h_InitStarter
Return
}
; end of auto-execution for starter here!
;============================================================================
;============================================================================
; function as tray menu for minimized window (helper) starts here
;----------------------------------------------------------------------------
;-------cmd-line part-----
if ( %1% = "hide")
{
whoami := "cmd_line_hide"
Loop, %0% ; go thru all arguments on command line
{
if (A_Index = 1)
continue
cmdLine .= A_Loopfield
if (A_Index < %0%)
cmdLine .= A_Space
}
; find AutoHotkey.exe and save its path to a variable for later use
If ( Not A_IsCompiled ) {
RegRead, h_ahkFullPath, HKLM, SOFTWARE\AutoHotkey, InstallDir
h_ahkFullPath = %h_ahkFullPath%\AutoHotkey.exe
IfNotExist, %h_ahkFullPath%
{
h_ahkFullPath := f_FindFile( "AutoHotkey.exe", A_ProgramFiles )
If ( h_ahkFullPath = "" )
{ ; search windir
StringSplit, tmparray, A_WinDir, \
h_ahkFullPath := f_FindFile( "AutoHotkey.exe", tmparray1 )
If ( h_ahkFullPath = "" )
Goto, ExitWithAHKError
}
}
}
If ( A_IsCompiled )
Run, "%A_ScriptFullPath%" %cmdLine%, , UseErrorLevel, h_newPID
Else
Run, "%h_ahkFullPath%" "%A_ScriptFullPath%" %cmdLine%, , UseErrorLevel, h_newPID
If ( ErrorLevel = "ERROR" ) ; helper could not be started
ExitApp, "ERROR"
Else
ExitApp, %h_newPID%
}
;--end--cmd-line part-----
; Helper -- init
;
whoami := "helper"
f_SetLanguage( whoami )
h_ID0 = 0
Loop, %0% ; go thru all arguments on command line
{
tmp := %A_Index%
If InStr( tmp, "0x", TRUE ) = 1
{ ; get several (at least one) window id
h_ID0++
h_ID%h_ID0% = %tmp%
}
Else If ( h_ID0 = 0 ) {
If ( tmp = "__justTriggerAction__")
h_JTA := TRUE
Else ; get title for multi window mode
h_MultiTitle = %tmp%
}
}