• Pequeño bot para adfly en autoit

 #491276  por davinciomar
 26 Mar 2017, 19:23
Hola aqui teneis un pequeño bot en autoit para adfly, sirve como punto de partida:
#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
; Don't pause automatically when the tray icon is clicked
Opt("TrayAutoPause", 0)
; Don't show the default tray menu
Opt("TrayMenuMode", 1)
; Set on event mode for the tray menu
Opt("TrayOnEventMode",1)
; Add an Exit option to the tray menu and link it to a function
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "_Exit")
; Add an About option to the tray menu and link it to a function
TrayCreateItem("About")
TrayItemSetOnEvent(-1, "_About")
; Create varible that holds the title to all windows
Global $title = "adf.ly bot"
; Register an error handler if there are any unexpected errors
_IEErrorHandlerRegister()
; Create GUI with Internet capabilities, but dont show it!
$oIE = _IECreateEmbedded ()
GUICreate("adf.ly Autoclicker", 450, 90, "", "", $WS_EX_MDICHILD  )
GUICtrlCreateObj($oIE, 1, 1, 450, 90)
GUISetState(@SW_SHOW)
;GUICreate("adf.ly Autoclicker", 2, 2, 2, 2)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360)
; Ask the user to input there Adf.ly shortened link
While 1
    $adlink = InputBox($title, "Enter a URL from adf.ly below:")
    ; Check the URL provided is valid
    If StringInStr($adlink, "adf.ly") = 0 Then
        ; If the URL that has been provided isn't adf.ly
        If MsgBox(0x4, $title, "Error. The URL you provided doesn't seem to be from adf.ly!" & @CRLF & "Do you want to enter a new URL?") = 7 Then Exit
    Else
        ; If the URL that has been provided is adf.ly
        ExitLoop
    EndIf
WEnd
; Go to the adf.ly URL
_IENavigate($oIE, $adlink)
; Let the page load for 1 second
Sleep(1000)
; Show a ballon from the tray icon, counting down
For $i = 5 To 1 Step -1
    TrayTip($title, "Skiping the ad in: " & $i & " seconds!", 1, 1)
    Sleep(1000)
Next

Sleep(2000)
$oObject = _IEGetObjById($oIE, "skip_button")
_IEAction($oObject, "click")
Sleep(10000)

; The 'Skip Ad' link should be available to click now...
; So click the image based on it's src, and wait for the page to load
_IEImgClick($oIE, "http://adf.ly/images/skip_ad/en.png")
; Tell the user that the ad button has been clicked.
; (Also to give the page chance to load because of a bug in previous function)
TrayTip($title, "'Skip Ad' button clicked!", 1, 1)
; Get the currect URL location of the browser
$adfreeURL = _IEPropertyGet($oIE, "locationurl")
; Put the URL on the clipboard
ClipPut($adfreeURL)
; Provide the user with the URL the picture gave us.
;MsgBox(0, $title,"Congratulations! Here is your add free URL: (Which has also been copied to your clipboard)" & @CRLF &  $adfreeURL)
; Exit the program
Exit

; Function to show information about the application
Func _About()
    MsgBox(0, $title, "Autoit running" & @CRLF & @CRLF & "")
EndFunc
; Function to terminate the application
Func _Exit()
    If MsgBox(0x4, $title, "Are you sure you want to exit the application? It will exit automatically at the end of it's job.") = 6 Then Exit
    EndFunc
Bye!