#41
|
|||
|
|||
Hello, I'm Italian and I apologize for my poor English.
I have rewritten the code CHRONOMASTER making it a bit more streamlined and simple. Now the script simply emits a sound with a delay of 3 seconds and no window will appear Below I will carry the full code: Code:
cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: Brunano21 Script Function: Captcha Sound Alert for JDownloader Script Version: 1.0 Script Date: 12/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 = "Inserire" ; Set the sound intervals in milliseconds (1000 milliseconds = 1 second) $SoundDelay = 3000 ; 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 ----------- ; TraySetToolTip("Captcha Sound Alert") 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 Sleep(1000) If (WinExists($DetectWindow))then SoundPlay($SoundFile) Sleep($SoundDelay) EndIf WEnd |
#42
|
|||
|
|||
i have downloaded autoit and copy paste the script into it.
afterwords i have started my pc again. i click on run the script and start jdownloader but when the field comes to put in the captcha no sounds are displayed... why can this happen? what i am doing wrong? edit: i am a fool >-< Last edited by freigeistlein; 16.02.2011 at 18:54. |
#43
|
|||
|
|||
|
#44
|
|||
|
|||
overkill
I'd have expected a plugin/setting to be able to do that... but good idea to just watch for the window.
But the length of the scripts is a bit excessive... if you have wmctrl installed, this one-liner will do the same: Code:
while true; do sleep 10; if wmctrl -l |grep 'Please enter' ; then beep -f 880 ; fi; done Cheers, I. |
#45
|
|||
|
|||
A multi languages solution
Code:
#Include <WinAPI.au3> #include <Array.au3> While 1 $_WinList = WinList ( "[REGEXPCLASS:SunAwt]" ) For $_I = 1 To UBound ( $_WinList ) - 1 If WinGetHandle ( "JDownloader" ) = _WinAPI_GetParent ( $_WinList[$_I][1] ) And _ _WinAPI_GetClassName ( $_WinList[$_I][1] ) = 'SunAwtDialog' Then SoundPlay ( @WindowsDir & '\media\notify.wav' ) Next Sleep ( 2000 ) WEnd |
#46
|
|||
|
|||
Can you please explain how this should be installed and run?
Does it work for all pop-up windows of jD? |
#47
|
|||
|
|||
Install AutoIt as usual, save the script as .au3 and start it.
|
#48
|
|||
|
|||
|
#49
|
|||
|
|||
Hi,
Without installing xdotools, you can create a script like this: Code:
#!/bin/sh while [ true ]; do WIN=`xwininfo -root -children -all | grep -i "Please enter"` if [ -n "$WIN" ]; then echo "Capcha Windows detected!" aplay /usr/share/sounds/speech-dispatcher/test.wav fi sleep 5 done bye |
#50
|
|||
|
|||
Quote:
SoundPlay ( @WindowsDir & '\media\notify.wav' ) with Beep(500,500) Beep(x,y) where x is the frequency pitch of the beep and y the duration. It should be possibile use multiple beep to reproduce a multitone siren. If the case speaker doesn't beep remove/disable the sound card. I'm not so happy to have this thing work every 2 seconds, I beg developers to reintroduce an option in jdownloader. Last edited by Dumah Brazorf; 06.09.2011 at 12:49. |
#51
|
|||
|
|||
Quote:
Code:
#!/usr/bin/python from Xlib import display, X import re import time import os display = display.Display() while 1: win_list = display.screen().root.query_tree().children for win in win_list: try: name = win.get_wm_name() if name is not None and name.find("Please enter") >= 0: os.system("aplay /myspecialpath/sounds/error.wav") except Exception as e: print e print time.sleep(5) |
#52
|
|||
|
|||
Thanks. I use Mac OS X 10.6.8. Any solution for Mac?
|
#53
|
|||
|
|||
Most Linux scripting solutions should work on the Mac as well.
|
#54
|
|||
|
|||
Thanks. How to use it on Mac? A step-by-step procedure will be most appreciated. Please, note that I am not a programmer but a simple plain Mac user.
|
#55
|
|||
|
|||
All you need is your preferred text editor and the Terminal application.
1) Copy the script in post #49 from this thread and paste it in your text editor window; 2) Replace the "#!/bin/sh" with "#!/bin/bash"; 3) Save the file as "captchalert.sh". 4) Make the file executable with the command "chmod +x captchalert.sh" instruction. You can do that with the Terminal application. The script should work without installing additional programs. In other threads of this forum there are other shell scripts you can try. I've seen one written in one line. This script searches for a window containing "Please enter" in its title. This might change in future versions of the program. In my .ahk script for Windoze I use the string ": Please enter" which is more precise. |
#56
|
|||
|
|||
A small improvement :
For avoid to play wav sound for all pop-up windows of jD, script ask for the Window size as additional condition. The use of _DateDiff permit the use of a sleep with a little value who doesn't "slows" the loop, then you can add anything else in the loop. If you are interested by this powerfull and free scripting language, take a look to autoitscript.com and his forums. Code:
#Include <Date.au3> Global $_ITimer = _NowCalc ( ) While 1 $_NowCalc = _NowCalc ( ) If _DateDiff ( "s", $_ITimer, $_NowCalc ) >= 2 And ProcessExists ( 'javaw.exe' ) Then _CheckCaptchaDialog ( ) ; check every 2 sec Sleep ( 30 ) WEnd Func _CheckCaptchaDialog ( ) $_ITimer = $_NowCalc $_WinList = WinList ( "[REGEXPCLASS:SunAwt]" ) For $_I = 1 To UBound ( $_WinList ) - 1 If WinGetHandle ( "JDownloader" ) = _WinAPI_GetParent ( $_WinList[$_I][1] ) And _ _WinAPI_GetClassName ( $_WinList[$_I][1] ) = 'SunAwtDialog' Then $_WinPos = WinGetPos ( $_WinList[$_I][1] ) If Not @error And $_WinPos[2] = 320 And $_WinPos[3] = 150 Then SoundPlay ( @WindowsDir & '\media\notify.wav' ) EndIf Next EndFunc ;==> _CheckCaptchaDialog ( ) |
|
|