Git Product home page Git Product logo

Comments (7)

FuPeiJiang avatar FuPeiJiang commented on July 27, 2024

what do you mean ? can you write pseudocode ?
3 possibilities I can think of:
1)

if (VD.WinExistInDesktopNum(winTitle,desktopNum:=2)) {
  WinActivate(winTitle)
} else {
  Run(command)
}

2)

if (VD.WinExistInAnyDesktopNum(winTitle) {
  WinActivate(winTitle)
} else {
  Run(command)
}

3)

if (VD.WinExistInDesktopNum(winTitle,desktopNum:=2)) {
  WinActivate(winTitle)
} else {
  VD.MoveWindowToCurrentDesktop(winTitle)
  WinActivate(winTitle)
}

from vd.ahk.

Morgenkaff avatar Morgenkaff commented on July 27, 2024

Personally I would like

if (VD.WinExistInAnyDesktopNum(winTitle) {
  WinActivate(winTitle)
} else {
  Run(command)
}

and

if (VD.WinExistInNotCurrentDesktop(winTitle) {
  WinActivate(winTitle)
} else {
  Run(command)
}

Unless there is is another way to know if a given window exists, and then move it to current desktop.

from vd.ahk.

FuPeiJiang avatar FuPeiJiang commented on July 27, 2024

@Morgenkaff
WinExist with DetectHiddenWindows 1 will search in all VD

DetectHiddenWindows 1
if (WinExist(winTitle)) {
    VD.MoveWindowToCurrentDesktop(winTitle)
} else {
    Run(command)
}

getDesktopNumOfWindow probably searches in all VD too

if (VD.getDesktopNumOfWindow(winTitle)!==VD.getCurrentDesktopNum()) {
    VD.MoveWindowToCurrentDesktop(winTitle)
} else {
    Run(command)
}

from vd.ahk.

mariusmg avatar mariusmg commented on July 27, 2024

Hello,

Would it be possible to also add a version of MoveWindowToCurrentDesktop which supports PID ?
On a hotkey shortcut, i want to check if a specific process exists then move the window to current virtual desktop and then activate it :

VD.MoveWindowToCurrentDesktop("ahk_pid" PID)
WinActivate("ahk_pid" PID)

Right now this seems to only work with window titles.

from vd.ahk.

FuPeiJiang avatar FuPeiJiang commented on July 27, 2024

@mariusmg

VD.MoveWindowToCurrentDesktop("ahk_pid" PID)
WinActivate("ahk_pid" PID)

does this code work for you ? if yes, I don't know what you're asking, because this is by PID
if no, what is the program that it doesn't work for ? because it will probably work for notepad.exe

On a hotkey shortcut, i want to check if a specific process exists then move the window to current virtual desktop and then activate it :

if (VD.getDesktopNumOfWindow("ahk_exe notepad.exe")!==VD.getCurrentDesktopNum()) {
    VD.MoveWindowToCurrentDesktop("ahk_exe notepad.exe")
}

do you really need PID when you can use ahk_exe ?

from vd.ahk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.