Sign in to follow this  
Followers 0
plutotn

Help me Click "Leave this page"

9 posts in this topic

#1 ·  Posted (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 by plutotn

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

plutotn,

Much better! :thumbsup:

M23

Edited 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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by jguinch

Share this post


Link to post
Share on other sites

Even more brutal  :D

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by AutID

Share this post


Link to post
Share on other sites

 

What about some brute force ?  :D

#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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0