plutotn Posted June 9, 2014 Share Posted June 9, 2014 (edited) The first, so sorry @Melba23 because i'm chose wrong website for demo. Now, i have a website with no Pay-Per-Click . Simple i only want exit the website by click "Leave this page". I was trying to write a program to click on "Leave this page". But I was a complete failure. I hope you can help me. Demo : http://aquaponics4you.com ( It's a blog, not website with PPC ) I tried : #include <IE.au3> Local $oIE = _IECreate("aquaponics4you.com") _IEQuit($oIE) If WinExists ("Message from webpage") Then WinClose("Message from webpage") If WinExists ("Windows Internet Explorer") Then ControlClick ("Windows Internet Explorer", "", "[CLASS:Button; INSTANCE:1]") EndIf EndIf or #include <IE.au3> Local $oIE = _IECreate("aquaponics4you.com") _IEQuit($oIE) If WinExists ("Message from webpage") Then WinClose("Message from webpage") EndIf If WinExists ("Windows Internet Explorer") Then ControlClick ("Windows Internet Explorer", "", "[CLASS:Button; INSTANCE:1]") EndIf or #include <IE.au3> Local $oIE = _IECreate("aquaponics4you.com") _IEQuit($oIE) If WinExists ("Message from webpage") Then WinClose("Message from webpage") EndIf If WinExists ("Windows Internet Explorer") Then ControlClick ("Windows Internet Explorer", "", "Button1") EndIf but it's not work. Please help me Edited June 9, 2014 by plutotn Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 9, 2014 Moderators Share Posted June 9, 2014 (edited) plutotn,Much better! M23 Edited June 9, 2014 by Melba23 Fixed BB tags 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...
mikell Posted June 9, 2014 Share Posted June 9, 2014 (edited) What about some brute force ? #include <IE.au3> Local $oIE = _IECreate("aquaponics4you.com") _IEQuit($oIE) Do ; Sleep(300) Send("{ENTER}") Until not WinExists ("Aquaponics") Exit Edited June 9, 2014 by mikell Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 9, 2014 Moderators Share Posted June 9, 2014 To those members who reported this thread,Thanks for trying to help - but how about leaving the moderation decisions to the Mods? If one of them has already posted in a thread you can probably take it that they are happy with it. If anyone wants to take the matter further, please PM me and we can discuss it without further polluting this thread. M23 Draygoes 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...
jguinch Posted June 9, 2014 Share Posted June 9, 2014 (edited) And by killing the process (hard way, of course ) #include <IE.au3> Local $oIE = _IECreate("aquaponics4you.com") Local $hwnd = _IEPropertyGet($oIE, "hwnd") ProcessClose(WinGetProcess($hwnd)) Edited June 9, 2014 by jguinch Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
mikell Posted June 9, 2014 Share Posted June 9, 2014 Even more brutal Link to comment Share on other sites More sharing options...
AutID Posted June 10, 2014 Share Posted June 10, 2014 (edited) Killing the process would kill all IE process. Maybe something like this? #include <IE.au3> Local $hWindows[2] = ["Message from webpage", "Windows Internet Explorer"] Local $oIE = _IECreate("aquaponics4you.com") _IEQuit($oIE) $hTimer = TimerInit() While Not WinExists($hWindows[0]) And Not WinExists($hWindows[1]) And TimerDiff($hTimer) < 10000 ;avoid an infinity loop Sleep(250) WEnd $hTimer = TimerInit() Local $count = 0 While True If WinExists($hWindows[0]) Then WinClose($hWindows[0]) ContinueLoop EndIf If WinExists($hWindows[1]) Then ControlClick ($hWindows[1], "", "[CLASS:Button; INSTANCE:1]") ContinueLoop EndIf If TimerDiff($hTimer) > 500 Then $count += 1 $hTimer = TimerInit() EndIf If $count >= 3 Then ExitLoop WEnd Edited June 10, 2014 by AutID https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
plutotn Posted June 10, 2014 Author Share Posted June 10, 2014 What about some brute force ? #include <IE.au3> Local $oIE = _IECreate("aquaponics4you.com") _IEQuit($oIE) Do ; Sleep(300) Send("{ENTER}") Until not WinExists ("Aquaponics") Exit Thank you mikell. It's work but i want to click button "Leave this page". And i don't sure your code do it or not ( because it's only send ENTER ) And by killing the process (hard way, of course ) #include <IE.au3> Local $oIE = _IECreate("aquaponics4you.com") Local $hwnd = _IEPropertyGet($oIE, "hwnd") ProcessClose(WinGetProcess($hwnd)) thank juinch . It's work Killing the process would kill all IE process. Maybe something like this? #include <IE.au3> Local $hWindows[2] = ["Message from webpage", "Windows Internet Explorer"] Local $oIE = _IECreate("aquaponics4you.com") _IEQuit($oIE) $hTimer = TimerInit() While Not WinExists($hWindows[0]) And Not WinExists($hWindows[1]) And TimerDiff($hTimer) < 10000 ;avoid an infinity loop Sleep(250) WEnd $hTimer = TimerInit() Local $count = 0 While True If WinExists($hWindows[0]) Then WinClose($hWindows[0]) ContinueLoop EndIf If WinExists($hWindows[1]) Then ControlClick ($hWindows[1], "", "[CLASS:Button; INSTANCE:1]") ContinueLoop EndIf If TimerDiff($hTimer) > 500 Then $count += 1 $hTimer = TimerInit() EndIf If $count >= 3 Then ExitLoop WEnd wonderful, AutID . It's work very good. thank you so much. I've checked my code carefully, and I noticed I need to add the variable "SLEEP" does it work, and I was successful #include <IE.au3> Local $oIE = _IECreate("aquaponics4you.com") _IEQuit($oIE) Sleep (1000) If WinExists ("Message from webpage") Then WinClose("Message from webpage") EndIf Sleep (1000) If WinExists ("Windows Internet Explorer") Then ControlClick ("Windows Internet Explorer", "", "[CLASS:Button; INSTANCE:1]") EndIf Sleep (1000) If WinExists ("Message from webpage") Then WinClose("Message from webpage") EndIf Sleep (1000) If WinExists ("Windows Internet Explorer") Then ControlClick ("Windows Internet Explorer", "", "[CLASS:Button; INSTANCE:1]") EndIf Thank everyone, again Link to comment Share on other sites More sharing options...
AutID Posted June 10, 2014 Share Posted June 10, 2014 Yes sleep is the solution but it is not a variable in this case. It is a function Use the way in #post 7 rather than your way in #post 8. It is more reliable and faster. https://iblockify.wordpress.com/ 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