The idea is to be able to scroll up or down in chrome (scrolling should be fast and smooth when the assigned keys are held down), then have PowerShell be the active window once I'm done scrolling so that I can type into it without having to click back and forth between the windows.
I haven't succeeded in sending the down and up keys to Chrome using ControlSend without first making it active. The scrolling is nice and smooth with my code below. As soon as I add WinActive("PowerShell"), after the line with ControlSend, the scrolling gets slow and choppy.
If I do have to activate Chrome in order to scroll, I want PowerShell to become active after I'm done scrolling, without interfering with the scrolling speed. Any feedback or help would would be appreciated, thanks!
Code: Select all
#If !WinExist("YouTube") and WinExist("Google Chrome")
; IF YOUTUBE ISNT PRESENT IN THE WINTITLE BUT GOOGLE IS (I don't want it to try and scroll if youtube is the active tab in chrome)
RAlt::
;CHECK IF GOOGLE CHROME IS ACTIVE
If WinActive("Google Chrome") {
ControlSend,, {Down}, Google Chrome ;Chrome_RenderWidgetHostHWND1
;I had WinActivate("PowerShell") here before but it made the scrolling choppy
}
;MAKE GOOGLE CHROME ACTIVE
Else {
WinActivate, Google Chrome
ControlSend,, {Down}, Google Chrome ;Chrome_RenderWidgetHostHWND1
}
;
return
AppsKey::
; CHECK IF GOOGLE CHROME IS ACTIVE, IF NOT, MAKE IT ACTIVE. THIS
; JUST MAKES THE SCROLLING FASTER.
If WinActive("Google Chrome") {
;WinActivate, Google Chrome
ControlSend,, {Up}, Google Chrome ;Chrome_RenderWidgetHostHWND1
;return
}
Else {
WinActivate, Google Chrome
ControlSend,, {Up}, Google Chrome ;Chrome_RenderWidgetHostHWND1
}
;WinActivate, PowerShell
return
#IfWinExist