Jdop Posted April 25, 2014 Share Posted April 25, 2014 Maybe I'm missing something obvious, but I wanted to change the Encoding option in an embedded IE browser to Right To Left. The keystrokes are Right Click, then E, then R MouseClick("right") Sleep (200) Send("e",1) Sleep (200) Send("r",1) I get the Menu to pop up fine, but the ER is not being recognized. Typing them in by hand at that point works fine. What's the issue here, or is there a better way to select the Right To Left option in code? Link to comment Share on other sites More sharing options...
JohnOne Posted April 25, 2014 Share Posted April 25, 2014 get rid of 1 flag in send functions. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Jdop Posted April 25, 2014 Author Share Posted April 25, 2014 (edited) Nope, the ones are something I put in after I tried it without that. Doesn't work either way. Edited April 25, 2014 by Jdop Link to comment Share on other sites More sharing options...
JohnOne Posted April 25, 2014 Share Posted April 25, 2014 Okay well remove them anyway, you don't need them. Have you tried to increase sleep, try 2000 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Geethu Posted April 26, 2014 Share Posted April 26, 2014 use Keyboard shortcuts for rightclick and leftclick. Rightclick = Send("!{F10}") Leftclick = Send("{ENTER}") Link to comment Share on other sites More sharing options...
Palestinian Posted April 26, 2014 Share Posted April 26, 2014 #include <IE.au3> $oIE = _IEAttach("Health Assistance") Sleep(2000) MouseClick("right") Sleep(200) Send("e") Sleep(200) Send("{RIGHT}") Sleep(200) Send("r") The encoding options are listed in a seperated menu, you need to send right arrow keystroke to switch to the encoding menu after selecting encoding option, the code posted above works for me. Link to comment Share on other sites More sharing options...
Jdop Posted April 28, 2014 Author Share Posted April 28, 2014 #include <IE.au3> $oIE = _IEAttach("Health Assistance") Sleep(2000) MouseClick("right") Sleep(200) Send("e") Sleep(200) Send("{RIGHT}") Sleep(200) Send("r") The encoding options are listed in a seperated menu, you need to send right arrow keystroke to switch to the encoding menu after selecting encoding option, the code posted above works for me. Link to comment Share on other sites More sharing options...
Jdop Posted April 28, 2014 Author Share Posted April 28, 2014 (edited) nope, not working for me. your example doesn't work at all as you posted it. Did you try it or just write it with notepad? Nothing after the IE menu showing up after MouseClick("right") is being sent . I'm loading into a frame as in _IEBodyWriteHTML($oIE, ....... but that shouldn't have anything to do with accepting keystrokes. Edited April 28, 2014 by Jdop Link to comment Share on other sites More sharing options...
Palestinian Posted April 29, 2014 Share Posted April 29, 2014 https://www.youtube.com/watch?v=hNN3wa32OtI Link to comment Share on other sites More sharing options...
binhnx Posted April 29, 2014 Share Posted April 29, 2014 The context menu opened by the right mouse button is different from the menu opened by the ContextMenu key on the keyboard: it have not the accelerators (character shortcut). When open a context menu by press the context menu key, you may notice that some characters is underlined. If you open that menu by the right mouse, no underlined character at all, mean you cannot use character shortcut to select the item. If you want to use the right mouse button, you should use arrow keys to navigate in the menu instead. Or you can open the context menu by sending the context menu key, and use the accelerators to select the desired item 99 little bugs in the code 99 little bugs! Take one down, patch it around 117 little bugs in the code! Link to comment Share on other sites More sharing options...
Jdop Posted April 30, 2014 Author Share Posted April 30, 2014 (edited) Actually, they do have accelerators, as I said, I can manually type the letters and get a response from the menu. No idea why keystrokes are working , but Autoit is not. Edited April 30, 2014 by Jdop Link to comment Share on other sites More sharing options...
Jdop Posted April 30, 2014 Author Share Posted April 30, 2014 https://www.youtube.com/watch?v=hNN3wa32OtI Nice video, but how are you getting to a web site with only "Health Assistance". lol, not exactly a URL, is it. Link to comment Share on other sites More sharing options...
binhnx Posted April 30, 2014 Share Posted April 30, 2014 (edited) Actually, they do have accelerators, as I said, I can manually type the letters and get a response from the menu. No idea why keystrokes are working , but Autoit is not. My bad, I did't read your first post carefully. This may be a problem to you only. I did a test and it was run normally. I also test with OE run as administrator user, but it causes the context menu not showed at all. Another approach is send message directly to your IE application: ; I'm using IE9. Not sure if it works for other versions. #include <WinAPI.au3> #include <WindowsConstants.au3> $hWnd = HWnd(0x12345678) ; 0x12345678 is for example only, you should get the right IE window, which has class name "InternetExplorer_Server" Const $MENUID_LTR = 2350 Const $MENUID_RTL = 2351 ; Select Left-to-Right layout _WinAPI_PostMessage($hWnd, $WM_COMMAND, $MENUID_LTR, 0) ; Select Right-to-Left layout _WinAPI_PostMessage($hWnd, $WM_COMMAND, $MENUID_RTL, 0) Edited April 30, 2014 by binhnx 99 little bugs in the code 99 little bugs! Take one down, patch it around 117 little bugs in the code! Link to comment Share on other sites More sharing options...
Jdop Posted April 30, 2014 Author Share Posted April 30, 2014 I'm trying to get your solution to work. Any idea of how to get the handle of the window created by $oIE = ObjCreate("Shell.Explorer.2") tried class names, and $oIE.HWND but they return nothing. Link to comment Share on other sites More sharing options...
binhnx Posted April 30, 2014 Share Posted April 30, 2014 Take a look at _IEAttach function in IE UDF. It contains code to retrieve handle of browser window. 99 little bugs in the code 99 little bugs! Take one down, patch it around 117 little bugs in the code! Link to comment Share on other sites More sharing options...
Jdop Posted April 30, 2014 Author Share Posted April 30, 2014 (edited) I shut it down then had a brainstorm. Turns out that loading the web page in a FRAME was causing the _winapi method not to work. Once I removed the frame and loaded directly , the code worked. Very odd, but apparently the frame must have a different handle or just can't be tweaked in the same way. Manually changing the settings did work with the frame loaded page. I didn't bother to test if the keystrokes problem was also caused by this. Your method is much cleaner. The reason I had to even bother with this, is the website has avatars that jump around in an annoying way when loaded in autoit, while I dont see this in a normal browser. I figured out that setting Right-To-Left encoding cured the problem. Blind luck there. Edited April 30, 2014 by Jdop Link to comment Share on other sites More sharing options...
Palestinian Posted April 30, 2014 Share Posted April 30, 2014 The website with the title "Health Assistance" was already opened and I was working on a script for that website when I checked your topic, so I used the website to test the code, you don't need the _IEAttach in the code. 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