Hi
How can I open a window from the beginning under the rest of active windows.
I used like this:
Run, Notepad
WinSet, Bottom, , test for bottom - Notepad
But When the notepad opens, it will first open as active window and then goes below.
Can we write two commands in a row?
Launch an application under all available apps
Launch an application under all available apps
;I am a beginner in
Autokey?
{
HotKey??
AutoHotKey
}
return
Autokey?
{
HotKey??
AutoHotKey
}
return
Re: Launch an application under all available apps
This works for notepad:
But:
Code: Select all
Run, Notepad, , min
https://autohotkey.com/docs/commands/Run.htm wrote:Note: Some applications (e.g. Calc.exe) do not obey the requested startup state and thus Max/Min/Hide will have no effect.
Re: Launch an application under all available apps
Hi zortanmax,
The note quoted by gregster applies with this version too.
Code: Select all
SW_SHOWNOACTIVATE := 4 ; Displays a window in its most recent size and position. This value is similar to SW_SHOWNORMAL, except that the window is not activated.
; https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-showwindow
!n::
DetectHiddenWindows, On
Run, notepad,, Hide, PID ; run notepad initially hidden and stores the program's unique Process ID (PID) in the variable 'PID'
WinWait, ahk_pid %PID% ; waits until the specified window exists (here we use the PID as matching criterion)
; If a matching window comes into existence, the command 'WinWait' will update the 'Last Found Window' - that is, teh window to operate on by default when all four window parameters of window commands and functions are omitted - like below:
WinSet, Bottom
lastFoundWindow := WinExist()
; WinExist checks if a matching window exists. If it is, WinExist() returns the Unique ID (HWND) of the first matching window
; since we've omitted all four parameters it will return the ID of the 'Last Found Window', yet we need the window ID for the 'ShowWindow' API function above
DllCall("ShowWindow", "Ptr", lastFoundWindow, "Int", SW_SHOWNOACTIVATE)
return
The note quoted by gregster applies with this version too.
Re: Launch an application under all available apps
Thanks gregstergregster wrote: ↑31 Jan 2019, 19:43This works for notepad:But:Code: Select all
Run, Notepad, , min
https://autohotkey.com/docs/commands/Run.htm wrote:Note: Some applications (e.g. Calc.exe) do not obey the requested startup state and thus Max/Min/Hide will have no effect.
It works fine for Notepad, but what to do for other programs like Firefox ?
I didn't get anything from your link
;I am a beginner in
Autokey?
{
HotKey??
AutoHotKey
}
return
Autokey?
{
HotKey??
AutoHotKey
}
return
Re: Launch an application under all available apps
Thank you too A_AhkUserA_AhkUser wrote: ↑31 Jan 2019, 20:20Hi zortanmax,Code: Select all
SW_SHOWNOACTIVATE := 4 ; Displays a window in its most recent size and position. This value is similar to SW_SHOWNORMAL, except that the window is not activated. ; https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-showwindow !n:: DetectHiddenWindows, On Run, notepad,, Hide, PID ; run notepad initially hidden and stores the program's unique Process ID (PID) in the variable 'PID' WinWait, ahk_pid %PID% ; waits until the specified window exists (here we use the PID as matching criterion) ; If a matching window comes into existence, the command 'WinWait' will update the 'Last Found Window' - that is, teh window to operate on by default when all four window parameters of window commands and functions are omitted - like below: WinSet, Bottom lastFoundWindow := WinExist() ; WinExist checks if a matching window exists. If it is, WinExist() returns the Unique ID (HWND) of the first matching window ; since we've omitted all four parameters it will return the ID of the 'Last Found Window', yet we need the window ID for the 'ShowWindow' API function above DllCall("ShowWindow", "Ptr", lastFoundWindow, "Int", SW_SHOWNOACTIVATE) return
The note quoted by gregster applies with this version too.
But your code will not run for a program like Firefox.
;I am a beginner in
Autokey?
{
HotKey??
AutoHotKey
}
return
Autokey?
{
HotKey??
AutoHotKey
}
return
Re: Launch an application under all available apps
Depends on the program - some just won't obey...
Some programs have command line options for starting minimized, but for Firefox it doesn't look good with this option, it seems. What I find on the internet, doesn't seem to work either (at least not anymore - it might have worked with older versions).
So this might be a good question for the Mozilla Firefox forums...
Some programs have command line options for starting minimized, but for Firefox it doesn't look good with this option, it seems. What I find on the internet, doesn't seem to work either (at least not anymore - it might have worked with older versions).
So this might be a good question for the Mozilla Firefox forums...
Re: Launch an application under all available apps
Thank you for your time gregster
;I am a beginner in
Autokey?
{
HotKey??
AutoHotKey
}
return
Autokey?
{
HotKey??
AutoHotKey
}
return