Pottery Posted July 23, 2010 Share Posted July 23, 2010 I have this in my script: $zObject = ObjCreate("Shell.Explorer.2") $zObject_Ctrl = GUICtrlCreateObj($zobject, 0, 120, 993, 577) And when I go to a page with .rtf or .doc it prompts me to open or save, how can I bypass this? Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 23, 2010 Share Posted July 23, 2010 You can't "bypass" it, but you can handle it. The popup might be an ordinary window you can automate with standard AutoIt functions like ControlClick(). If it's another embedded IE form, then use _IEAttach() and the other _IE* functions on it. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Pottery Posted July 23, 2010 Author Share Posted July 23, 2010 I already tried controlclick, it didn't work :/ Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 23, 2010 Share Posted July 23, 2010 Examine the popup with the AutoIt Window Info tool (AU3Info.exe). That will tell you what you're dealing with. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Pottery Posted July 23, 2010 Author Share Posted July 23, 2010 GAH. This still isn't working.. If WinActive('File Download') Then MsgBox(0, '', 'l') Why doesn't it register that the window exists :| Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 23, 2010 Share Posted July 23, 2010 Why doesn't it register that the window exists :|Did you examine the popup with AU3Info.exe? What's on the summary tab? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Pottery Posted July 23, 2010 Author Share Posted July 23, 2010 expandcollapse popup>>>> Window <<<< Title: File Download Class: #32770 Position: 498, 370 Size: 404, 282 Style: 0x94C80AC4 ExStyle: 0x00010101 Handle: 0x004E0668 >>>> Control <<<< Class: Button Instance: 2 ClassnameNN: Button2 Name: Advanced (Class): [CLASS:Button; INSTANCE:2] ID: 4427 Text: &Save Position: 216, 121 Size: 78, 23 ControlClick Coords: 55, 12 Style: 0x50010000 ExStyle: 0x00000004 Handle: 0x0025058E >>>> Mouse <<<< Position: 772, 525 Cursor ID: 0 Color: 0xD4D0C8 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Do you want to open or save this file? Name: file.rtf Type: Microsoft Word Document, 1.90KB From: ********* <- website url &Open &Save Cancel Al&ways ask before opening this type of file While files from the Internet can be useful, some files can potentially harm your computer. If you do not trust the source, do not open or save this file. <A>What’s the risk?</A> >>>> Hidden Text <<<< Publisher: Link to comment Share on other sites More sharing options...
DaleHohm Posted July 23, 2010 Share Posted July 23, 2010 I'm guess that line of code never gets executed... 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 More sharing options...
PsaltyDS Posted July 23, 2010 Share Posted July 23, 2010 Try this: $hPopup = WinGetHandle("[CLASS:#32770; TITLE:File Download]", "") If $hPopup Then $hButton = ControlGetHandle($hPopup, "", "[CLASS:Button; INSTANCE:2]") If $hButton Then ControlClick($hPopup, "", $hButton) Sleep(1000) MsgBox(64, "Click", "Clicked button...", 3) Else MsgBox(16, "Error", "Failed to get button handle.") EndIf Else MsgBox(16, "Error", "Failed to get popup window handle.") EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Pottery Posted July 23, 2010 Author Share Posted July 23, 2010 Try this: $hPopup = WinGetHandle("[CLASS:#32770; TITLE:File Download]", "") If $hPopup Then $hButton = ControlGetHandle($hPopup, "", "[CLASS:Button; INSTANCE:2]") If $hButton Then ControlClick($hPopup, "", $hButton) Sleep(1000) MsgBox(64, "Click", "Clicked button...", 3) Else MsgBox(16, "Error", "Failed to get button handle.") EndIf Else MsgBox(16, "Error", "Failed to get popup window handle.") EndIf Eactly what I needed, thanks. Link to comment Share on other sites More sharing options...
Pottery Posted July 23, 2010 Author Share Posted July 23, 2010 BAH. It registers the window now but for some reason the ControlClick isn't working. Link to comment Share on other sites More sharing options...
Pottery Posted July 23, 2010 Author Share Posted July 23, 2010 Problem solved. I used the MacroGenerator and got this: #region --- AutoIt Macro Generator V 0.21 beta --- WinWait("File Download","Do you want to open or save th") ControlClick("File Download","Do you want to open or save th","Button2") WinWait("Save As","Save &in:") ControlClick("Save As","Save &in:","Button2") WinWait("Save As","C:\Documents and Settings\Admi") ControlClick("Save As","C:\Documents and Settings\Admi","Button1") WinWait("Download complete","Download Complete") ControlClick("Download complete","Download Complete","Button2") #endregion --- End --- Link to comment Share on other sites More sharing options...
Pottery Posted July 23, 2010 Author Share Posted July 23, 2010 Thanks for the help salty Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 23, 2010 Share Posted July 23, 2010 You might get the control coordinates and try ControlClick() with the coordinates, and without the control ID. Or maybe ControlFocus() and then ControlSend() "{ENTER}". Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Pottery Posted July 23, 2010 Author Share Posted July 23, 2010 You might get the control coordinates and try ControlClick() with the coordinates, and without the control ID. Or maybe ControlFocus() and then ControlSend() "{ENTER}".I'll try that, the MacroGen code bugs out :\ Link to comment Share on other sites More sharing options...
Pottery Posted July 23, 2010 Author Share Posted July 23, 2010 Is there a special function for getting a control's coords? Link to comment Share on other sites More sharing options...
Pottery Posted July 23, 2010 Author Share Posted July 23, 2010 Ok, I'm starting to doubt if it's the code that's wrong... The ControlClick highlights the button... then I did a Send('{ENTER}') and nothing.. so I make a new au3 file and did: WinActivate('File Download') ; <- worked ControlClick('File Download', '', 'Button2') ; <- button higlights Send('{ENTER}') ; <- button pushes down but nothing happens Then the script ends and I pressed enter myself, what do you know; it works :| So I'm confused :\ Link to comment Share on other sites More sharing options...
Pottery Posted July 23, 2010 Author Share Posted July 23, 2010 I did: WinWait('File Download') WinActivate('File Download') ; just to make sure $Pos = ControlGetPos('File Download', '', 'Button2') MouseMove($Pos[0], $Pos[1], 0) And it's moving my mouse to the completely wrong spot.. It moving it near the top of the edit control on my child GUI in the program :\ Link to comment Share on other sites More sharing options...
JohnOne Posted July 23, 2010 Share Posted July 23, 2010 Try adding this to the top of your code Opt("MouseCoordMode", 2) 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...
Pottery Posted July 23, 2010 Author Share Posted July 23, 2010 Ok now it moves to the right spot. The MouseClick won't push the button thought.. I don't get it :\ The button pushes down but nothing happens, then when I do it myself it works.. 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