Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

open Application directly on one virtual desktop in background #50

Open
mmaukii opened this issue Jul 17, 2023 · 2 comments
Open

open Application directly on one virtual desktop in background #50

mmaukii opened this issue Jul 17, 2023 · 2 comments

Comments

@mmaukii
Copy link

mmaukii commented Jul 17, 2023

i am using your library and i love it!!!!
I also build something, which sets up windows on the right desktops when i start up the pc. But it is not really relaiable and taks some time an i wanted to ask if there is a better possibility to for example start the notepad directly on desktop 3. At the moment i open the app and push it than to the desktop:

Run,notepad.exe , , Min, OutputVarPID WinWait ahk_pid %OutputVarPID% VD.MoveWindowToDesktopNum("A",3)

Would be happy about some help

@FuPeiJiang
Copy link
Owner

  • I don't know of a way to start a process directly on a specific VD
  • I don't know of a way to move a Hidden window to another VD, because Hidden windows don't have a pView ?

but this should be more reliable:

start notepad.ahk:

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
ListLines Off
SetBatchLines -1
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#KeyHistory 0
#WinActivateForce

Process, Priority,, H

SetWinDelay -1
SetControlDelay -1

#Include %A_LineFile%\..\..\VD.ahk

Run notepad.exe, , ,OutputVarPID
loop {
    found:=VD._tryGetValidWindow("ahk_pid " OutputVarPID)
    if (found) {
        break
    }
    Sleep 10
}
VD.MoveWindowToDesktopNum("ahk_pid " OutputVarPID, 3)

return

f3::Exitapp

@mmaukii
Copy link
Author

mmaukii commented Jul 17, 2023

Your sir, are a genius! Thanks a lot!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants