Mettz17 Posted October 10, 2015 Share Posted October 10, 2015 (edited) Hi guys, I'm a noob with Autoit I would to know how can I do this example replacing notepad with internet explorer.Thanks in advance!Example() Func Example() ; Run Notepad Run("notepad.exe") ; Wait 10 seconds for the Notepad window to appear. Local $hWnd = WinWait("[CLASS:Notepad]", "", 10) ; Retrieve the position as well as the height and width of the Notepad window. We will use this when we have to move the window back to the original position. Local $aPos = WinGetPos($hWnd) ; Move the Notepad to the x, y position of 0, 0 and set the height and width at 200, 200. WinMove($hWnd, "", 0, 0, 200, 200) ; Wait for 2 seconds to display the new position of the Notepad window. Sleep(2000) ; Move the Notepad window back to the original position by using the array returned by WinGetPos. WinMove($hWnd, "", $aPos[0], $aPos[1], $aPos[2], $aPos[3]) ; Wait for 2 seconds to display the original position of the Notepad window. Sleep(2000) ; Close the Notepad window using the handle returned by WinWait. WinClose($hWnd) EndFunc ;==>Example Edited October 10, 2015 by Mettz17 Link to comment Share on other sites More sharing options...
water Posted October 10, 2015 Share Posted October 10, 2015 Welcome to AutoIt and the forum!What have you tried so far and what doesn't work then?BTW: To work with IE AutoIt comes with an UDF for Internet Explorer. Mettz17 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Mettz17 Posted October 10, 2015 Author Share Posted October 10, 2015 So far everything works and I also really like the ease of the code So I have to download an UDF for Internet Explorer in order to make the program.And after that, what should I do? Thanks for your help! Link to comment Share on other sites More sharing options...
Mettz17 Posted October 10, 2015 Author Share Posted October 10, 2015 Welcome to AutoIt and the forum!What have you tried so far and what doesn't work then?BTW: To work with IE AutoIt comes with an UDF for Internet Explorer.I tried replacing notepad with iexplore in the example but that didn't work. I'd like to find the class of Internet Explorer (which I'm starting with 'run') so that I can move it with WinMove. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 10, 2015 Moderators Share Posted October 10, 2015 Mettz17,Use the AutoIt Window Info tool (...\AutoIt3\Au3Info.exe) to get the class of the IE window (probably IEFrame).M23 Mettz17 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
water Posted October 10, 2015 Share Posted October 10, 2015 What exactly do you want to do? Solve a real problem or just "play" a bit with AutoIt ? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Mettz17 Posted October 10, 2015 Author Share Posted October 10, 2015 Mettz17,Use the AutoIt Window Info tool (...\AutoIt3\Au3Info.exe) to get the class of the IE window (probably IEFrame).M23Yes, the class is IEFrame!Thanks a lot! Link to comment Share on other sites More sharing options...
Mettz17 Posted October 10, 2015 Author Share Posted October 10, 2015 What exactly do you want to do? Solve a real problem or just "play" a bit with AutoIt ?I've resolved, thank you anyway for the help Link to comment Share on other sites More sharing options...
Mettz17 Posted October 10, 2015 Author Share Posted October 10, 2015 Sorry guys, but there is another thing that i don't know how to do.This is what I want to do, 2 windows of Internet Explorer one beside the other.run('C:\Program Files\Internet Explorer\IEXPLORE.EXE "http:\\www.google.it"', "") ;WinMove ( "title", "text", x, y [, width [, height [, speed]]] ) Local $hWnd = WinWait("[CLASS:IEFrame]", "", 0) WinMove($hWnd, "", 0, 0, 0, 0) Sleep(5000) run('C:\Program Files\Internet Explorer\IEXPLORE.EXE "http:\\www.google.it"', "") Local $hWnd2 = WinWait("[CLASS:IEFrame]", "", 0) WinMove($hWnd2, "", 0, 0, 500, 500)But using this code, the program doesn't work. Can you help me? Link to comment Share on other sites More sharing options...
nitekram Posted October 10, 2015 Share Posted October 10, 2015 (edited) I would look for examples in the IE UDF, as you will not be able to get what you want with the Run() function. EDIT, sorry, I thought you wanted one window, with two instances of IE running in them.Your 0, 0 needs to be changed - to move it over use 0, 300not awake yet Edited October 10, 2015 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 10, 2015 Moderators Share Posted October 10, 2015 Mettz17,At the moment the second WinWait is probably picking up the first window. Get the 2 IE windows open and then use WinList to get the handles of them both - that way you can use these handles directly to move each window to the required position.M23 Mettz17 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
nitekram Posted October 10, 2015 Share Posted October 10, 2015 run('C:\Program Files\Internet Explorer\IEXPLORE.EXE "http:\\www.google.com"', "") ;WinMove ( "title", "text", x, y [, width [, height [, speed]]] ) ;Local $hWnd = WinWait("google - internet explorer", "", 0) WinWaitActive("Google - Windows Internet Explorer") Sleep(200) WinMove("Google - Windows Internet Explorer", "", 0, 0, 500, 500) Sleep(2000) run('C:\Program Files\Internet Explorer\IEXPLORE.EXE "http:\\www.yahoo.com"', "") WinWaitActive("Yahoo - Windows Internet Explorer") Sleep(200) WinMove("Yahoo - Windows Internet Explorer", "", 501, 0, 500, 500) Exit 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Mettz17 Posted October 10, 2015 Author Share Posted October 10, 2015 run('C:\Program Files\Internet Explorer\IEXPLORE.EXE "http:\\www.google.com"', "") ;WinMove ( "title", "text", x, y [, width [, height [, speed]]] ) ;Local $hWnd = WinWait("google - internet explorer", "", 0) WinWaitActive("Google - Windows Internet Explorer") Sleep(200) WinMove("Google - Windows Internet Explorer", "", 0, 0, 500, 500) Sleep(2000) run('C:\Program Files\Internet Explorer\IEXPLORE.EXE "http:\\www.yahoo.com"', "") WinWaitActive("Yahoo - Windows Internet Explorer") Sleep(200) WinMove("Yahoo - Windows Internet Explorer", "", 501, 0, 500, 500) Exit Thanks bro, but I don't have to change the Code Link to comment Share on other sites More sharing options...
Mettz17 Posted October 10, 2015 Author Share Posted October 10, 2015 Mettz17,At the moment the second WinWait is probably picking up the first window. Get the 2 IE windows open and then use WinList to get the handles of them both - that way you can use these handles directly to move each window to the required position.M23run('C:\Program Files\Internet Explorer\IEXPLORE.EXE "http:\\www.google.it"', "") ;WinMove ( "title", "text", x, y [, width [, height [, speed]]] ) Local $hWnd = WinWait("[CLASS:IEFrame]", "", 0) $aList[1][1] = $hWnd WinMove($aList[1][1], "", 500, 500, 500, 500) Sleep(5000) run('C:\Program Files\Internet Explorer\IEXPLORE.EXE "http:\\www.google.it"', "") Local $hWnd2 = WinWait("[CLASS:IEFrame]", "", 0) $aList[2][2] = $hWnd2 WinMove($aList[2][2], "", 500, 500, 500, 500) In this way? Link to comment Share on other sites More sharing options...
nitekram Posted October 10, 2015 Share Posted October 10, 2015 Thanks bro, but I don't have to change the Code You are going to have to change something, to get to work, so Melba23 has one way (which is not what you have), I showed you another, but, the best way is to use the IE UDF, as suggested by Water imho 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
nitekram Posted October 10, 2015 Share Posted October 10, 2015 Something like this #include <IE.au3> Local $oIE_First = _IECreate("http:\\www.google.it") Local $oIE_Second = _IECreate("http:\\www.google.it") $IE_First = _IEPropertyGet($oIE_First, "hwnd") $IE_Second = _IEPropertyGet($oIE_Second, "hwnd") WinMove($IE_First, "", 0, 0, 500, 500) WinMove($IE_Second, "", 501, 0, 500, 500) 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 10, 2015 Moderators Share Posted October 10, 2015 Mettz17,No, like this:#include <Array.au3> ; Open the IE windows Run('C:\Program Files\Internet Explorer\IEXPLORE.EXE "http://www.google.it"', "") Run('C:\Program Files\Internet Explorer\IEXPLORE.EXE "http://www.bbc.co.uk/news"', "") ; Wait until both windows are open Do $aWinList = WinList("[CLASS:IEFrame]") Until $aWinList[0][0] = 2 ; And here are the windows if you want to look ;_ArrayDisplay($aWinList, "", Default, 8) ; Now move them WinMove($aWinList[1][1], "", 100, 100, 500, 500) WinMove($aWinList[2][1], "", 600, 100, 500, 500)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Mettz17 Posted October 12, 2015 Author Share Posted October 12, 2015 Something like this #include <IE.au3> Local $oIE_First = _IECreate("http:\\www.google.it") Local $oIE_Second = _IECreate("http:\\www.google.it") $IE_First = _IEPropertyGet($oIE_First, "hwnd") $IE_Second = _IEPropertyGet($oIE_Second, "hwnd") WinMove($IE_First, "", 0, 0, 500, 500) WinMove($IE_Second, "", 501, 0, 500, 500)Thank you! This code works in the way I want Link to comment Share on other sites More sharing options...
Mettz17 Posted October 12, 2015 Author Share Posted October 12, 2015 Mettz17,No, like this:#include <Array.au3> ; Open the IE windows Run('C:\Program Files\Internet Explorer\IEXPLORE.EXE "http://www.google.it"', "") Run('C:\Program Files\Internet Explorer\IEXPLORE.EXE "http://www.bbc.co.uk/news"', "") ; Wait until both windows are open Do $aWinList = WinList("[CLASS:IEFrame]") Until $aWinList[0][0] = 2 ; And here are the windows if you want to look ;_ArrayDisplay($aWinList, "", Default, 8) ; Now move them WinMove($aWinList[1][1], "", 100, 100, 500, 500) WinMove($aWinList[2][1], "", 600, 100, 500, 500)M23Why every time I run the program windows change position? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 12, 2015 Moderators Share Posted October 12, 2015 Mettz17,Probably because you have more than those two IE windows open. nitekram's solution is the one you need.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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