MrSugarChill Posted November 9, 2016 Share Posted November 9, 2016 Hello, new user here. I've searched the forums but could not find a similar post. In the Firefox browser, if you've surfed several web addresses in the same tab, you could go to a previous webpage by holding down the shift key + scrolling down with the mouse wheel button to jump to a previous page. You could then, jump back to the next page by holding down the shift key + scrolling up with the mouse wheel button. I've tried setting a hotkey to do this with no luck. I'm currently on a Vista 64bit PC. HotKeySet("!a","Test") While 1 Sleep(100) WEnd Func Test() Send("{SHIFTDOWN}") MouseWheel("down",1) Send("{SHIFTUP}") EndFunc Can anyone confirm shiftdown + mousewheel down doesn't work? Link to comment Share on other sites More sharing options...
Jfish Posted November 9, 2016 Share Posted November 9, 2016 Hello and welcome. I would suggest that you don't use shift in your hotkey and then again in the function that is called by the hotkey - or perhaps add a sleep beforehand in the Test function. What do you mean by "no luck" what is happening exactly? You may also want to add some debugging to capture the results of each and write them to the console. Have you tried in different programs with different scrollable windows to try and see what is working / not? Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 9, 2016 Moderators Share Posted November 9, 2016 While I hate using Send on anything, Firefox is a notorious butt to automate. This, however, works just fine for me navigating back and forth between pages, and does not require the mouse wheel: WinActivate("[CLASS:MozillaWindowClass]", "") Sleep(1000) Send("!{LEFT}") Sleep(1000) Send("!{RIGHT}") "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
MrSugarChill Posted November 9, 2016 Author Share Posted November 9, 2016 @Jfish I'm not using the shift key when I'm registering a hotkey. I know Windows reserves the shift key for many of its programs. In the example code I registered "!a" alt + a to simulate the keys : shift + mouse-wheel scroll down, and by "no luck" I meant that it did not work in Firefox i.e., I coulnd't jump back to a previously visited page. I don't understand how a sleep command in the Test() function might solve this issue. @JLogan3o13 Thanks for the solution. You are absolutely right! Firefox is the culprit here. This code works flawlessly in Internet Explorer (which also allows you to jump to previous webpages using the shift + mouse-wheel scroll shortcut : HotKeySet("!a","Test") While 1 Sleep(100) WEnd Func Test() Send("{SHIFTDOWN}") MouseWheel("down",1) Send("{SHIFTUP}") EndFunc This works for both Firefox and IE : HotKeySet("!a","Test") While 1 Sleep(100) WEnd Func Test() ;resize / scale down webpage Send("{CTRLDOWN}") MouseWheel("down",1) Send("{CTRLUP}") EndFunc Thanks for all the help. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 10, 2016 Moderators Share Posted November 10, 2016 The code I posted worked just fine for me in the latest version of Firefox "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
MrSugarChill Posted November 10, 2016 Author Share Posted November 10, 2016 Don't want to bump a solved topic but couldn't edit my previous reply. Thought other members might find this useful, it seems Jfish was right about needing to add a Sleep(x) command. This code actually works in Firefox (might also work on other apps if your problem is similar) : HotKeySet("!a","Test") While 1 Sleep(100) WEnd Func Test() Sleep(100) Send("{SHIFTDOWN}") Sleep(100) MouseWheel("up",1) Sleep(100) Send("{SHIFTUP}") EndFunc So bizarre! @ JLogan I know I should not rely on simulating the mousewheel but there might be other applications that rely solely on a mousewheel shortcut with no keyboard equivalent. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now