Comments (7)
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.
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.
@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.
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.
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)
- After pinning with AH2 version, I get an error when switching desktops by number.
- Script sending "Q" to discord | Desktop switch failure. HOT 2
- getDesktopNumOfWindow sometimes returns -1 rather than the correct num HOT 4
- Error HOT 10
- open Application directly on one virtual desktop in background HOT 2
- "Error: (0x80004002) No such interface supported" after updating Windows 11 (Beta insider channel) HOT 13
- sending keypress to specified virtual desktop only.
- Ah2: Desktop Looping & Switching + Other Feature Regression from Commit ee2f54f626914273f00853306c1daaf803f756cb HOT 2
- It doesn't work on Windows 11 Build 22621.2215 (22H2) HOT 2
- A problem with the new Windows update 11 HOT 18
- Virtual desktop Tasksbar icons HOT 4
- renaming desktops HOT 1
- Switching to Relative Desktop fails initially HOT 2
- Current desktop count is always zero
- New Windows Build 23606: VD.getCurrentDesktopNum() always returns 0 HOT 4
- Windows Server 2022 version HOT 3
- It doesn't work on Windows 11 Build 22631.3085 (23H2) HOT 13
- v2_port分支没有 TogglePinApp,PinApp,UnPinApp HOT 2
- Previous Desktop HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vd.ahk.