HyperWindowSnap
HyperWindowSnap copied to clipboard
SplitSnapActiveWindow & MS Edge (chromium)
In MS Edge (chromium) latest version for me the new code is not working
Send ^l^c
SetKeyDelay, 100
Send ^w^n^v{enter}
SetKeyDelay, -1
sleep 500
SnapActiveWindow(winPlaceVertical, winPlaceHorizontal, winSizeHeight)
It seems the key-point is the delay between ^l and ^c. For me the following works
Send ^l
Send ^c
Send ^w^n^v{enter}
sleep 500
SnapActiveWindow(winPlaceVertical, winPlaceHorizontal, winSizeHeight)
Can you first try moving the SetKeyDelay to the top and decreasing it to 75ms, re-combine the Send command (no need to separate them) and report back? My guess is that this will be nondeterministic and we should delay most of the keypresses besides the ^c and ^v.
On Sat, Aug 1, 2020 at 12:53 PM digitalAssetStore [email protected] wrote:
In MS Edge (chromium) latest version for me the new code is not working
Send ^l^c
SetKeyDelay, 100 Send ^w^n^v{enter} SetKeyDelay, -1 sleep 500 SnapActiveWindow(winPlaceVertical, winPlaceHorizontal, winSizeHeight)
It seems the key-point is the delay between ^l and ^c. For me the following works
Send ^l Send ^c Send ^w^n^v{enter}
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/glenviewjeff/HyperWindowSnap/issues/7, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACRYQUNXYIFT77LH6F4D4DR6RJCDANCNFSM4PR5PR5A .
Variant1: Not working
SetKeyDelay, 75
Send ^l^c^w^n^v{enter}
SetKeyDelay, -1
sleep 500
SnapActiveWindow(winPlaceVertical, winPlaceHorizontal, winSizeHeight)
Variant2: Not working
SetKeyDelay, 75
Send ^l^c
Send ^w^n^v{enter}
SetKeyDelay, -1
sleep 500
SnapActiveWindow(winPlaceVertical, winPlaceHorizontal, winSizeHeight)
Variant3: Working
Send ^l
Send ^c
Send ^w^n^v{enter}
sleep 500
SnapActiveWindow(winPlaceVertical, winPlaceHorizontal, winSizeHeight)
This is certainly a PC/memory/resource issue. I just tested the existing code on Edge on my PC and it worked fine. Try increasing the SetKeyDelay
until you get it to work. This is one of the idiosyncrasies in using a tool like AHK, it's often a tradeoff of execution speed vs. moving slowly to accommodate burdened PCs. For example, this guy waits an entire second before pasting the URL.
Ideally I'd be able to monitor what's going on through WinWait, but I'm not confident I could come up with a reliable algorithm to do so. For example, I could watch for a window title change after closing the tab, but that would only work if there weren't tabs with identical titles. This really should be a feature in Chrome, to split off tabs via keyboard control. This kludge doesn't maintain the history of the tab. The Vimium extension apparently offers true keyboard support for splitting off a tab.
Understand and agree.
But I tried "SetKeyDelay, 5000" in first line, still not working. The result is that the clipboard from last ctrl+c gets pasted to the browser address bar and "^c" is not considered.
The most compact working version is Send ^l Send ^c^w^n^v{enter} sleep 500 SnapActiveWindow(winPlaceVertical, winPlaceHorizontal, winSizeHeight)
It seems to be that "Send Ctrl+L" takes to much time to be screwed through the cpu/memory/resource/storage... Or "Send" has some issues, or, or, or...
Pragmatically: If this is the working code for most browsers in the world, I could (would have to) live with it.
There's also this Chrome plugin.
Ugh, what a pain in the butt. I think I have something that should be totally reliable and much faster. No delays from keyboard input or anything, either. Just the natural processing delay from opening a new browser window, etc. I also added a feature to backup and restore the clipboard, which previously was overwritten with the tab's URL. Let me know if this works.
SplitSnapActiveWindow(winPlaceVertical, winPlaceHorizontal, winSizeHeight) {
oldClipboard = clipboardAll
clipboard =
while(clipboard == "") {
SendInput ^l^c
}
SendInput ^w^n
WinWaitNotActive
SendInput %clipboard%{enter}
clipboard = %oldClipboard%
SnapActiveWindow(winPlaceVertical, winPlaceHorizontal, winSizeHeight)
}
:heavy_check_mark: WORKS!
PS: Really appreciate your clever solution. Compact, impact-free to clipboard and effective!
One more thing.
Please change first line
FROM
oldClipboard = clipboardAll
TO
oldClipboard := clipboardAll
else you have in the clipboard the word "clipboardAll" afterwards.
Ah, thanks; didn't realize ahk has that goofy distinction of :=
and =
. I am pretty sure I tested it and must have thought that clipboardAll was previously on my clipboard from some edits to the source :)
Incidentally, would you find it useful to maintain focus on the original browser window so that you can rapid fire split off tabs into quadrants? Besides that, one other neat hotkey might be to with one keystroke, move four tabs to respective quadrants. Not sure if I'd ever use this in practice though.
Q: Incidentally, would you find it useful to maintain focus on the original browser window so that you can rapid fire split off tabs into quadrants? A: Absolutely YES (currently the focus is nowhere).
Q: Besides that, one other neat hotkey might be to with one keystroke, move four tabs to respective quadrants. Not sure if I'd ever use this in practice though. A: See no practical usage. Have first to sort the tabs in order 1,2,3,4. In the time doing so I opened them already with Ctrl+Alt+Win+NumPad AND did control exactly where to but them (e.g. order 2,4,3,1 or 4,2,3,1, etc.).
Try this and let me know what happens. My PC was acting very strangely after I tried it.
oldClipboard = clipboardAll
prevWin := WinActive("A")
clipboard =
while(clipboard == "") {
SendInput ^l^c
}
SendInput ^w^n
WinWaitNotActive
SendPlay %clipboard%{enter}
clipboard := %oldClipboard%
SnapActiveWindow(winPlaceVertical, winPlaceHorizontal, winSizeHeight)
if prevWin
WinActivate, ahk_id %prevWin%
- First line: Please add ":=" as proposed before already (yes ahk assignment syntax is rather crazy)
- Use SendInput as in previous code not SendPlay (= older version with side effects)
- As soon as I uncomment 2nd and last line --> Not working (Likely opening new webbrowser not finished, but next/last line already triggers. No workaround so far)
prevClipboard := clipboardAll
;// WinGet, prevWinId, ID, A
clipboard := ""
while(clipboard == "") {
SendInput ^l^c
}
SendInput ^w^n
WinWaitNotActive
SendInput %clipboard%{enter}
clipboard = %prevClipboard%
SnapActiveWindow(winPlaceVertical, winPlaceHorizontal, winSizeHeight)
;// WinActivate, ahk_id %prevWinId%