View Single Post
  #2  
Old 27.09.2010, 10:11
CHRONOMASTER
Guest
 
Posts: n/a
Default

Captcha Sound Alert for JDownloader [AutoIt - Script Code] (Updated 9/20/2010)


What this script does is it creates a sound alert that repeats every 5 seconds
until the alert is canceled when a captcha window in JDownloader pops up.

Requirements:
  • AutoIt v3
  • Windows XP/Vista/7

v1.1 (9/20/2010)
  • Added $Title variable to "Settings" to help non-English JDownloader users set captcha window detection.
  • Changed the default $SoundFile variable to a audio file available to all XP/Vista/7 users.

Large script, press "show" below.
Spoiler:
Code:
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.6.1
 Author:         CRONOMASTER

 Script Function:
    Captcha Sound Alert for JDownloader

 Script Version: 1.1

 Script Date: 9/20/2010

#ce ----------------------------------------------------------------------------



; ----------- Settings ------------- ;

; Set Captcha Window Title
; English Example: "fileserve.com: Please enter" -> "Please enter"
; Italian Example: "fileserve.com: Inserire" -> "Inserire"
; Spanish Example: "fileserve.com: Por favor ingresar" -> "Por favor ingresar"
; German  Example: "fileserve.com: Bitte eingeben!" -> "Bitte eingeben!"

; Already set for English. Don't add the Colon and Space in front as it will be added automatically. 
$Title = "Please enter"  

; Set the sound intervals in milliseconds (1000 milliseconds = 1 second)
$SoundDelay = 5000

; Set path of the audio file (Example "C:\Users\USERNAME\Music\Somefile.wav")
$SoundFile = @WindowsDir & "\media\notify.wav"

; Do not change this unless needed
$DetectWindow = "[TITLE:: " & $Title & "; CLASS:SunAwtDialog]"

; When enabled it displays the current(not realtime) line number and command in the system tray icon tooltip.
$Debug = False

; -------- Settings  End ----------- ;



#include <ButtonConstants.au3>
#include <GUIButton.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

TraySetToolTip("Captcha Sound Alert for JDownloader")
If $Debug = True Then Opt("TrayIconDebug",1)
Opt("TrayAutoPause",0)
Opt("WinTitleMatchMode",2)

If Not FileExists($SoundFile) Then
    MsgBox(262144,"Script Error - Captcha Sound Alert for JDownloader", 'The file "' & $SoundFile & '" was not found.' & @CRLF & 'Please set a valid audio file in the script.')
    Exit
EndIf

While 1
    While 1
        If WinExists($DetectWindow) Then
            ExitLoop
        Else
            Sleep(250)
        EndIf
    WEnd

    $Timer = TimerInit()
    SoundPlay($SoundFile)

    $FormMain = GUICreate("Captcha Sound Alert for JDownloader", 291, 91, 367, 575, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
    $ButtonOK = GUICtrlCreateButton("OK", 96, 56, 97, 25, $WS_GROUP)
    $LabelMessage = GUICtrlCreateLabel("Press OK to stop this alert.", 24, 16, 244, 27)
    GUICtrlSetFont(-1, 15, 400, 0, "Arial")
    GUICtrlSetState($ButtonOK, $GUI_FOCUS)
    GUISetState(@SW_SHOW)

    While 1
        $Msg = GUIGetMsg()

        Switch $Msg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $ButtonOK
                ExitLoop
        EndSwitch

        If TimerDiff($Timer) >= $SoundDelay Then
            SoundPlay($SoundFile)
            $Timer = TimerInit()
        EndIf
    WEnd
    GUIDelete()
    Sleep(60000)
WEnd


Post replies here: http://board.jdownloader.org/showthread.php?t=20714

Last edited by CHRONOMASTER; 18.03.2011 at 08:44.
Reply With Quote