meisandy Posted June 21, 2013 Posted June 21, 2013 (edited) Hi all, I'm using an embedded IE object to fill in a form and submit it. The form uses the POST method and has a Javascript function which runs when the form is submitted and changes some values according to what is entered into the form and generates a nonce, etc. When the form is submitted a file download is triggered. How could I deal with this because at the minute the file download dialog is appearing? The only way I can think of is to send a keypress when the file download window becomes active but I have seen that this is not reliable. Thanks in advance Edited June 21, 2013 by meisandy
jdelaney Posted June 21, 2013 Posted June 21, 2013 (edited) send a screenshot, and the output of the autoit window info tool (if it's a popup). Control* functions and Window* functions are reliable, if it's a popup Edited June 21, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
meisandy Posted June 21, 2013 Author Posted June 21, 2013 Here is the File Download dialog that appears (left) and window information for it (right)
jdelaney Posted June 21, 2013 Posted June 21, 2013 look into ControlClick, that's a popup IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
meisandy Posted June 21, 2013 Author Posted June 21, 2013 This is the code I'm using but for some reason it only works sometimes, and the desktop opens in Windows Explorer. WinWaitActive("File Download", "", 15) If WinActive("File Download") <> 0 Then ControlClick("File Download", "", "[CLASS:Button; INSTANCE:3]") EndIf
Wombat Posted June 21, 2013 Posted June 21, 2013 (edited) Here is the File Download dialog that appears (left) and window information for it (right) Â For future reference... if you activate a window (bring it into focus) then press Ctrl+PrtScn, it will screen capture the focused window only. so you can save time from having to redact information from the screen capture. Edit: This is true for Win7, for xp the keycombo is Ctrl+Alt+PrtScn... I dont know about Vista Edited June 21, 2013 by Wombat Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us...
AdmiralAlkex Posted June 22, 2013 Posted June 22, 2013 For future reference... if you activate a window (bring it into focus) then press Ctrl+PrtScn, it will screen capture the focused window only. so you can save time from having to redact information from the screen capture. Edit:This is true for Win7, for xp the keycombo is Ctrl+Alt+PrtScn... I dont know about VistaGood suggestion, only if you hadn't completely mangled the keys It is Alt+PrtScr for all of them. Probably goes back to Win95, if not longer.Ctrl does nothing, or at least not that. Wombat 1 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
meisandy Posted June 22, 2013 Author Posted June 22, 2013 That's where I was going wrong - I knew there was a way but I thought it was Ctrl + PrtScr! Thanks So does anybody know why the code I posted isn't working properly?
AdmiralAlkex Posted June 22, 2013 Posted June 22, 2013 Can you post your code so we can see what you are doing (makes it easier to help) or is this a private website? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Wombat Posted June 23, 2013 Posted June 23, 2013 Good suggestion, only if you hadn't completely mangled the keys It is Alt+PrtScr for all of them. Probably goes back to Win95, if not longer. Ctrl does nothing, or at least not that. I meant that Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us...
NewPlaza Posted June 23, 2013 Posted June 23, 2013 Would ControlSend("File Download", "", "", "{ESC}") work?
meisandy Posted June 23, 2013 Author Posted June 23, 2013 Can you post your code so we can see what you are doing (makes it easier to help) or is this a private website? I'm very sorry and I understand that it does make it harder for you to help me but the website is private. However if there is any code you would like to see in particular I could post 'snippets'... Â Would ControlSend("File Download", "", "", "{ESC}") work? Â Pressing the Esc key when the dialog appears does work really well, when I do it manually. However for some reason the code I posted earlier it is a bit hit and miss. Even when the File Download window is clearly active the code inside the If statement doesn't execute, and when I don't have the If statement all types of random things happen.
JohnOne Posted June 23, 2013 Posted June 23, 2013 Forget winactive, use winexists, then winactivate, then Send("{SPACE}"), or enter or whatever key does what you want. AutoIt Absolute Beginners  Require a serial  Pause Script  Video Tutorials by Morthawt  ipify Monkey's are, like, natures humans.
JohnOne Posted June 23, 2013 Posted June 23, 2013 (edited) Or something like Do WinActivate("File Download", "") Until WinActive("File Download") Send("{ESC}") Edited June 23, 2013 by JohnOne AutoIt Absolute Beginners  Require a serial  Pause Script  Video Tutorials by Morthawt  ipify Monkey's are, like, natures humans.
meisandy Posted June 23, 2013 Author Posted June 23, 2013 Forget winactive, use winexists, then winactivate, then Send("{SPACE}"), or enter or whatever key does what you want. WinExists works a treat! Thank you! And I don't need to use WinActivate because ControlSend() still works perfectly. And thank you NewPlaza for indirectly informing me about the Esc key being able to close the File Download box.
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