Wednesday, October 31, 2018

windows 10 - AUTOHOTKEY | WinMove | Virtual Desktop of choice


UPDATED-STATEMENT: 20181118@205016@SUN A suggestion was made to manually focus the Virtual Desktop of my choice, but this eliminates me from doing other tasks on another Virtual Desktop. Still waiting for a valid take-care-ofitself solution.
UPDATED-STATEMENT: 20181118@210851@SUN There is no way autohotkey can work with moving apps to a specific Virtual Desktop on it's own without dll-calls (*see below*). In other words, the use of dll-files is required for the time being that is Windows language and not as convenient as an ahk-statement. Who knows, maybe ahk can implement this function someday to keep it lightweight and add it to their statement-library.
UPDATED-TATEMENT: 20190509@212923@THU @Shayan suggested sdias-win10virtualdesktopenhancer as a way to manage windows and virtual desktops.


SPECIFICATION:
win10_1803_17134.407
autohotkeyahk_1.1.30.00_20180822


After the 5-month idle time for this topic i've now stopped using virtual desktops.


Virtual Desktops doesn't make navigation any easier, perhaps the clear view of the wallpaper will be enjoyed by some, but not me.



WHY I USE AHK


Using Autohotkey in Windows 10 to open up frequently used apps which will not duplicate opening up a program if it has already launched (IfWinNotExist). Then, move them to where I prefer each app to be (WinMove). I have set a timer (Sleep) because some apps open up slower than others (I would be interested to know if there is a better way to do this). I like ahk for how lightweight it is, but there's Windows 10 related functions that aren't documented from them like Virtual Desktop involvement.


PROBLEM


Problem is that there isn't a way to use WinMove for specifying a Virtual Desktop for win10 to launch an application in. So I struggle running my frequentlyusedapps-script and going into another Virtual Desktop to open up other apps simultaneously. This is because what ever Virtual Desktop i'm focusing on is what my frequentlyusedapps-script will move the window to.


QUESTION


How to have autohotkey move an application to a Virtual Desktop of my choice? I don't think it's possible with ahk-WinMove If the virtualdesktop-number isn't created then the script will obviously fail to move the app, but this isn't my focus just yet. I could otherwise create the appropriate number of Virtual Desktops prior to launching my frequentlyusedapps-script. What I mean by having a way for ahk to achieve this is to be pure ahk code and not fork/branch that will probably be not updated for the unfortunate reasons. If it does have to come from a branched project then let's discuss what ahk elements they're using to involve Virtual Desktop to move windows to a specific one.



!^+o::
IfWinNotExist, ahk_exe program1.exe
Run "C:\Dir\program1.exe"
WinWait, ahk_exe program1.exe
WinMove, ahk_exe program1.exe,, 953, 61, 967, 1019
TrayTip, openfrequentlyusedapps, ok, 1,
IfWinNotExist, ahk_exe program2.exe
Run "C:\Dir\program2.exe"
WinWait, ahk_exe program2.exe
WinMove, ahk_exe program2.exe,, -7, 61, 813, 516
TrayTip, openfrequentlyusedapps, ok, 1,

SOLUTION



  • As per @miroxlav, "there is no way Autohotkey can do this with their current statements." Although not impossible, but requires more effort as it's now Windows language is using ahk w/ dll-calls.

    • It would help a lot of someone is able to show how this even works



NOTE

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...