Jump to content

IEObj Stealing Keys


Recommended Posts

I have created 2 GUIs, on one there is an IE object. When a URL is typed in a Go is clicked , when switched back to the GUI with out the objects, the Inputs nor the Edit box will allow the back button.

I've tried using $GUI_NOFOCUS but I believe this is mainly for listviews, I can't seem to figure out how to get it so the back button is no longer registered with the object.

Any help would be great. Below is an example, to recreate

On the GUI with IE, type in a URL in the input, click go.

Go to the Gui with inputs/edits, type and try and backspace.

#include <GUIConstants.au3>
#include <IE.au3>
$NavForm = GUICreate("Post Robber Navigator", 857, 608, 844, 123)
$IE3 = _IECreateEmbedded()
$Tab1 = GUICtrlCreateTab(0, 0, 881, 641)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlCreateTabItem("Search")
$Back = GUICtrlCreateButton("Back", 160, 24, 73, 25, 0)
$Label1a = GUICtrlCreateLabel("URL:", 248, 29, 29, 17)
$Alink = GUICtrlCreateInput("", 288, 24, 145, 21)
$Go = GUICtrlCreateButton("Go", 448, 24, 57, 25, 0)
$Add = GUICtrlCreateButton("Add", 560, 24, 73, 25, 0)
$Obj1 = GUICtrlCreateObj($IE3, 0, 56, 858, 530)
$2Site = GUICtrlCreateLabel('Site:', 0, 590, 150, 18)
GUISetState(@SW_SHOW)
$GUI = GUICreate("Post Robber", 590, 430, 254, 123)
$MenuItem1 = GUICtrlCreateMenu("&File")
$About = GUICtrlCreateMenuItem("About", $MenuItem1)
$MExit = GUICtrlCreateMenuItem("Exit", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenu("Tab")
$Delete = GUICtrlCreateMenuItem("Delete", $MenuItem2)
$MenuItem3 = GUICtrlCreateMenu('Instructions')
$Instructions = GUICtrlCreateMenuItem('Instructions', $MenuItem3)
$Tabs = GUICtrlCreateTab(0, 0, 633, 425)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Main = GUICtrlCreateTabItem("Main")
$Group1 = GUICtrlCreateGroup("Warez-BB Login Info", 64, 24, 209, 97)
$Label = GUICtrlCreateLabel("Username:", 72, 48, 55, 17)
$Username = GUICtrlCreateInput('', 136, 48, 121, 21)
$Label2 = GUICtrlCreateLabel("Password:", 72, 80, 53, 17)
$Password = GUICtrlCreateInput('', 137, 80, 119, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label3 = GUICtrlCreateLabel("Links:", 16, 136, 32, 17)
$Links = GUICtrlCreateEdit("", 16, 168, 569, 201)
$Start = GUICtrlCreateButton("Start", 232, 376, 75, 25, 0)
$Status = GUICtrlCreateLabel("Status: Paused", 16, 384, 190, 17)
$Group2 = GUICtrlCreateGroup("WarezRaid Login Info", 328, 24, 201, 97)
$Label4 = GUICtrlCreateLabel("Username:", 336, 48, 55, 17)
$Label5 = GUICtrlCreateLabel("Password:", 336, 80, 53, 17)
$WRUser = GUICtrlCreateInput('', 400, 48, 113, 21)
$WRPass = GUICtrlCreateInput('', 400, 80, 113, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()

While 1
    $nMsg = GUIGetMsg(1)
    If $nMsg[0] = $GUI_EVENT_CLOSE And $nMsg[1] = $NavForm Then
        GUIDelete($NavForm)
    ElseIf $nMsg[0] = $GUI_EVENT_CLOSE And $nMsg[1] = $GUI Then
        Exit
    EndIf
    Switch $nMsg[0]
        Case $Go
            _IENavigate($IE3,GUICtrlRead($Alink))
    EndSwitch
WEnd
Link to comment
Share on other sites

I have created 2 GUIs, on one there is an IE object. When a URL is typed in a Go is clicked , when switched back to the GUI with out the objects, the Inputs nor the Edit box will allow the back button.

I've tried using $GUI_NOFOCUS but I believe this is mainly for listviews, I can't seem to figure out how to get it so the back button is no longer registered with the object.

Any help would be great. Below is an example, to recreate

On the GUI with IE, type in a URL in the input, click go.

Go to the Gui with inputs/edits, type and try and backspace.

#include <GUIConstants.au3>
#include <IE.au3>
$NavForm = GUICreate("Post Robber Navigator", 857, 608, 844, 123)
$IE3 = _IECreateEmbedded()
$Tab1 = GUICtrlCreateTab(0, 0, 881, 641)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlCreateTabItem("Search")
$Back = GUICtrlCreateButton("Back", 160, 24, 73, 25, 0)
$Label1a = GUICtrlCreateLabel("URL:", 248, 29, 29, 17)
$Alink = GUICtrlCreateInput("", 288, 24, 145, 21)
$Go = GUICtrlCreateButton("Go", 448, 24, 57, 25, 0)
$Add = GUICtrlCreateButton("Add", 560, 24, 73, 25, 0)
$Obj1 = GUICtrlCreateObj($IE3, 0, 56, 858, 530)
$2Site = GUICtrlCreateLabel('Site:', 0, 590, 150, 18)
GUISetState(@SW_SHOW)
$GUI = GUICreate("Post Robber", 590, 430, 254, 123)
$MenuItem1 = GUICtrlCreateMenu("&File")
$About = GUICtrlCreateMenuItem("About", $MenuItem1)
$MExit = GUICtrlCreateMenuItem("Exit", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenu("Tab")
$Delete = GUICtrlCreateMenuItem("Delete", $MenuItem2)
$MenuItem3 = GUICtrlCreateMenu('Instructions')
$Instructions = GUICtrlCreateMenuItem('Instructions', $MenuItem3)
$Tabs = GUICtrlCreateTab(0, 0, 633, 425)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Main = GUICtrlCreateTabItem("Main")
$Group1 = GUICtrlCreateGroup("Warez-BB Login Info", 64, 24, 209, 97)
$Label = GUICtrlCreateLabel("Username:", 72, 48, 55, 17)
$Username = GUICtrlCreateInput('', 136, 48, 121, 21)
$Label2 = GUICtrlCreateLabel("Password:", 72, 80, 53, 17)
$Password = GUICtrlCreateInput('', 137, 80, 119, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label3 = GUICtrlCreateLabel("Links:", 16, 136, 32, 17)
$Links = GUICtrlCreateEdit("", 16, 168, 569, 201)
$Start = GUICtrlCreateButton("Start", 232, 376, 75, 25, 0)
$Status = GUICtrlCreateLabel("Status: Paused", 16, 384, 190, 17)
$Group2 = GUICtrlCreateGroup("WarezRaid Login Info", 328, 24, 201, 97)
$Label4 = GUICtrlCreateLabel("Username:", 336, 48, 55, 17)
$Label5 = GUICtrlCreateLabel("Password:", 336, 80, 53, 17)
$WRUser = GUICtrlCreateInput('', 400, 48, 113, 21)
$WRPass = GUICtrlCreateInput('', 400, 80, 113, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()

While 1
    $nMsg = GUIGetMsg(1)
    If $nMsg[0] = $GUI_EVENT_CLOSE And $nMsg[1] = $NavForm Then
        GUIDelete($NavForm)
    ElseIf $nMsg[0] = $GUI_EVENT_CLOSE And $nMsg[1] = $GUI Then
        Exit
    EndIf
    Switch $nMsg[0]
        Case $Go
            _IENavigate($IE3,GUICtrlRead($Alink))
    EndSwitch
WEnd

It works fine for me. I can type into any of the edit boxes after going to a web site and then I type things into the other gui. Backspace deletes the last character and I can delete all of the characters if I keep pressing BackSpace.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

@tgreat

There have been several issues raised in the past showing trouble with focus, redraws and keystroke issues in interactions between the webbrowser object and the AutoIt gui. Each time I see a report of one I urge the poster to create a small reproducer so that it can be investigated as a potential bug. People get close, but have each time backed away from doing what is necessary.

These issues don't have anything to do with IE.au3 and it is not something that have ever needed to rely on, so someone who is working on making this work needs to do the legwork and get the issues documented and reported.

So, I'll urge you to do the same. Distill your issue down to a small reproducer with clear instructions on how to cause the trouble and get it reported in the bug trac'er.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

@tgreat

There have been several issues raised in the past showing trouble with focus, redraws and keystroke issues in interactions between the webbrowser object and the AutoIt gui. Each time I see a report of one I urge the poster to create a small reproducer so that it can be investigated as a potential bug. People get close, but have each time backed away from doing what is necessary.

These issues don't have anything to do with IE.au3 and it is not something that have ever needed to rely on, so someone who is working on making this work needs to do the legwork and get the issues documented and reported.

So, I'll urge you to do the same. Distill your issue down to a small reproducer with clear instructions on how to cause the trouble and get it reported in the bug trac'er.

Dale

Thanks will do. Yeah I kind of figured it had nothing to do with IE.au3. I actually just had to do a check if the window is active. If it isn't I have to disable every single control on the GUI, then when it is active enable them all again. But it works. I'll submit a bug report and shrink the example down.

Link to comment
Share on other sites

  • 6 months later...

I ran into the same/similar issue. Here's my example code:

;an example of Backspace key and others not working properly after using _IEAction(,"focus")
;typing letters, number, symbols, up arrow, and down arrow works fine
;keys that don't work: Backpage, Home, End, left arrow, right arrow

#include <IE.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>

;create gui #1
$hGUI_main = GUICreate("Autoitscript", 900, 700, (@DesktopWidth-900)/2, ((@DesktopHeight-700)/2) - 33, $WS_OVERLAPPEDWINDOW)
$oIE = ObjCreate("Shell.Explorer.2")
GUICtrlCreateObj($oIE, 0, 0, 900, 700)
GUICtrlSetResizing (-1,$GUI_DOCKAUTO)
GUISetState(@SW_SHOW);show $hGUI_main

_IENavigate($oIE, "http://www.autoitscript.com/email_us.shtml");navigate to a web page
$oForm = _IEFormGetCollection($oIE, 0);get the object for the form
$oForm_Name = _IEFormElementGetObjByName ($oForm, "realname");get the object for the Name input
;if you remove the next line, the Backspace work properly
_IEAction($oForm_Name, "focus");can use _IEFormElementSetValue instead, but using _IEAction and Send to demonstrate the problem
Send("AutoIt User")

;create gui #2
$hGUI_Email = GUICreate("Email", 350, 150, (@DesktopWidth-500)/2, ((@DesktopHeight-450)/2) - 33)
GUICtrlCreateLabel("Press the Backspace key to see the problem." & @CRLF & @CRLF & _
                    "The Backspace gets applied to the Name input field " & @CRLF & _
                    "in the other GUI instead of the input field in this one." & @CRLF & @CRLF & _
                    "Close this window to exit.", 10, 10)
GUICtrlCreateLabel("Enter your email address", 10, 100)
$input = GUICtrlCreateInput("press_backspace@email.com", 10, 115, 200);create an input 
GUISetState(@SW_SHOW, $hGUI_Email)

Do
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
        Exit
    EndSelect
Until Not 1;don't stop until gui is closed

Edit:

AutoIt v3.2.12.1

SciTE Version 1.75

Edited by kraZcoda
Link to comment
Share on other sites

Issue already logged in Bug Trac: http://svn.autoitscript.com/trac/ticket/110

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • 4 months later...
  • 5 months later...

at first: sorry for my not perfect english, i am living in germany

i have had a similar problem:

main-GUI with one IE-embedded object (internet-livestream)

one of my gui-buttons opens a second-GUI with a forum-reply-interface.

and this only accept key-inputs, but NO backspace.

i solved it like this:

when switch to the second-GUI, delete the first IE_obj,

and tadaaa: also backspace works now on my second ie-obj.

if i close the second-GUI, i just had to re-create the first IE-embed.

maybe not the cleanest solution but it works for me.

Link to comment
Share on other sites

  • 6 months later...

Issue already logged in Bug Trac: http://svn.autoitscript.com/trac/ticket/110

Dale

Dale,

Is there any progress on this bug?

Removing the ie embed, and recreating it would look horrible, esp as i have to keep reloading my data too it. So, that's not really what i'm looking for.

I did note the following:

If the backspace key is stuck (for example, the ie embed steals focus), i can press up/down, page up/page down, mousewheel up/mousewheel down, and it interacts directly with the embeded IE object.

But, if i click on an edit control, and then focus back to my input box, boom, backspace works again.

I thought i could automate this by creating a very small edit box (hidden by another element, so that no one could see it), and then just send controlFocus() and ControlClick() commands to it between shifting between ie objects, but that only works part of the time.

In my app, i have about 5 embeded IE objects, 4 of which use the _IECreateEmbed() command, and the other is actually a com object from nbit software (html editor, it's another document object) and has the same class type as the other 4 (ie class server instance #, etc).

When switching between them it loose keys.

SO much so that i have had to code each and every single hot key, to include ctrl+v, ctrl+c, ctrl+x, Ctrl+y, just to get it to process those commands on my IE instance i need to have as an input.

Is there a fix to this bug?

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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