Jump to content

Recommended Posts

Posted

  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?

Posted (edited)

 Nope, the ones are something I put in after I tried it without that.  Doesn't work either way.

Edited by Jdop
Posted (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 by Jdop
Posted

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!

Posted (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 by Jdop
Posted
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.

Posted (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 by binhnx

99 little bugs in the code

99 little bugs!

Take one down, patch it around

117 little bugs in the code!

Posted

 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.

Posted

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!

Posted (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 by Jdop
Posted

 

 

 

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...