Jump to content

ControlSend to Form File Input - garbled data results...


plastix
 Share

Recommended Posts

Hi all

Following on from entering data into a form 'file' field (with IE hidden) I stumbled on an odd issue. On the original PC (XPHomeSP2 IE6SP2) things were working well... today, on an XPProSP2 IE6sp2 system when using ControlSend i find that the data is warped (almost identically each time) by the effect of pressing the SHIFT key. When typing in SciTe, notepad, IE etc otherwise, I don't get this effect - so I assume the SHIFT key / pad is OK etc - it only occurs with this function...

$oIE = _IECreate ("http://thesite.info/form.html",0,1,1,0) ;not real URI
$hwnd = _IEPropertyGet($oIE, "hwnd")
$oForm = _IEFormGetObjByName($oIE,"upload") ;the form

$up = _IEFormElementGetObjByName ($oForm, "file") ;the file attach field
_IEAction($up, "focus")
ControlSend($hwnd, "", "Internet Explorer_Server1",@ScriptDir & "" & $thefile & ".txt") ;$thefile = filename
While 1
 _IEAction($up, "focus")
 $info = _IEFormElementGetValue ($up)
  If $info == @ScriptDir & "" & $thefile & ".txt") Then ExitLoop
   Sleep(100)
WEnd
;continue now as correct data entered / validated

So, instead of "C:Folder86008_file.txt" i get "C;FoLdER8600*_file.txT" for example.

Any guidance appreciated as ever... ;)

PS - i have tried sending Raw characters also.

Edited by plastix
Link to comment
Share on other sites

Not sure what the Shift key would have to do with it, but I'd suggest putting in an _IELoadWait($oIE) after the ControlSend. Also, setting focus back to the field 10 times per second doesn't seem like a good idea when you are trying to type to it (but the LoadWait should avoid any issues with that).

Dale

Edit: Typo

Edited by DaleHohm

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

Many thanks

I had already noticed and removed the 'focus' calls... but even with _IELoadWait it is still acting as if the shift key is being depressed at times while it is sending the string - this is fine for text, but destroys file links if it affects stop,backslash etc... I'll use the same method to populate standard boxes etc and see if it recurs...

TesTS (couldn't resist....)

Using ControlSend on edit control produces the same result in browser...

Using ContorlSend with notepad does not reproduce this issue.

=> so it appears to be some quirk with IE here... IE6sp2 on XPpro, Google Toolbar is only BHO. Agnitum Firewall does watch processes etc, but AutoIt is trusted at the moment. Have run Spywareblaster - but hard to see how these are responsible...

Edited by plastix
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...