#1
|
|||
|
|||
Captcha Sound Alert for JDownloader [AutoIt - Script Code] (Updated 9/20/2010)
Hello Everyone,
Today I'm bringing you a useful AutoIt script that should help out a few JDownloader users. 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:
v1.1 (9/20/2010)
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 Last edited by CHRONOMASTER; 02.12.2010 at 16:51. Reason: Updated Script to v1.1 |
#2
|
|||
|
|||
i only know autohotkey script, you detect a foreground windows change ?
|
#3
|
|||
|
|||
It will look for a window with the title "[somesite]: Please enter" with the class "SunAwtDialog" every 250ms, once the criteria is met weather in foreground or background the alert will trigger.
|
#4
|
|||
|
|||
ok tks
|
#5
|
|||
|
|||
First i wanted to say:Great Work CHRONOMASTER !
But i have question - is there somewhere same program for linux ? i'm using puppy linux and jdownloader and i wanted to have same sound notification on linux - is there any chance for that ? or is there any trick for linux that it can play sound after popup of window ? Thx for any answer and sorry for my poor English george2002 |
#6
|
|||
|
|||
@george2002
I don't know of any, but you should be able to run JDownloader(Windows), Java, AutoIt and this script under Wine to get it working on your Linux box. This is only a guess as I have not tried this combo before. |
#7
|
||||
|
||||
For Linux, I would suggest checking the PS output for something with the specified name. You can even use wildcards.
I think there is a beep command in Linux. |
#8
|
|||
|
|||
@CHRONOMASTER thx for that suggestion but i have HP Thin Client T5520 @ 800MHz/128MB RAM + external USB HDD and Puppy linux works great on this configuration, i tried windows xp and it was too slow and took too much RAM (when RAM goes above 128MB then windows started write on HDD as RAM and that was annoying because HDD worked all time)
In Linux i configured everything:SAMBA, UPnP,WIFI to act as AP, and jdownloader to start automaticly and now i wanted to have sound on popup window when jdownloader asks for type the captcha, and this question goes for drbits Could you expand your idea more and describe how i can do that in linux with this ,,PS output" or ,,wildcards" ot somthing else, because i'm novice in linux and i I do not understand what you mean by ,,PS output" and ,,Wildcards" Could you give here some examples or links to pages with some examples how to enable sound when window from jdownloader popups ? PS. Beep command is smallest problem thank you in advance for your reply george2002 |
#9
|
|||
|
|||
@george2002
All I can do is suggest that you give Wine a try. **External links are only visible to Support Staff** http://en.wikipedia.org/wiki/Wine_(software) |
#10
|
||||
|
||||
The PS command (with the appropriate parameters) allows you to list information about all of the processes (and I think threads). If you grep the output of ps -e (I think) grep will return a different value when it finds an occurrence than when it does not.
It has been years since I did this, so this is probably not right (the parameters changed) You are looking for a script something like: Code:
while (`ps -e | grep "java.*"') { if (`ps -e --windowtitle | grep "*.?\Please Enter"') beep 700 2 sleep 2 } If the beep parameters are as I remember them, this is a request for a 2 second beep at 700Hz (A above middle C). That is the same frequency as most beeping alarm clocks. Almost nobody can sleep through it. We used to play songs by using beep followed by pairs of numbers. Note that the conditionals are enclosed in accent characters ` ` so that they will be interpreted each time. This would be more efficient in TEMACS or AWK, but a lot harder to write. As to regular expressions, they have changed a little over the years. Look at the documentation in the JDownloader Wiki. I have been locked in the Windows world almost full time since 1996. Every so often, I get a chance to work in *nix for things like build scripts. Last edited by drbits; 14.09.2010 at 09:49. |
#11
|
|||
|
|||
Quote:
It will act only as a media centre: AP,SAMBA,FTP,and jdownloader. Quote:
Of course if someone other have a idea how to beat that problem i would be grateful for help in solving this problem thx for any working solution george2002 |
#12
|
||||
|
||||
|
#13
|
|||
|
|||
Quote:
Either you go to a linux scripting forum where scripting wizards will start discussing your problem and provide an optimal solution, or you wait until jD's devs have designed and programmed a more generic solution. |
#14
|
|||
|
|||
Quote:
As i see this problem is longer than half year - in my opinion adding this future as: checkmark in options menu with link to audio file when windows with captcha appear can be done in one - maximum two days (of course, without unnecessary options) (if someone use firefox addon called download Statusbar - there is a checkmark option in options of that plugin that plays sound when downloading of file is finished - I think it should be enough and not so difficult to done) because jD's dev team are professionals in programming in my opinion and they could know that option is critical for large amount of users of jdownloader (many of them don't write here on this forum but i can bet that they would be very grateful for this option) and more users will use jdownloader then there be more $ support from them for upgrades etc I wroted that suggestion about checkmark in options because this will resolve problems with external programs and operating systems problems - all will work on the go from jdownloader side without other programs/scripts. This can be done faster before adding whole eventmanager PS Or i'm wrong and service of sounds/links to files in java is very hard to code ? As i said i don't have programmer skills and if I am wrong then please accept my apology And of course I could go to another forum/ programmers for solution but i think this friendly forum is for such needs I do not expect that someone write this solution in 5 minutes but in 3-7 days is enough time for that - dodn't you agree with this ? whether there are other inhibition to do that ? As i said:this problem is not just about me - it concerns a large number of users Best Regards George2002 Last edited by george2002; 15.09.2010 at 23:07. |
#15
|
||||
|
||||
It is not the difficulty, but the lack of development volunteers makes it take much longer before these convenience features are implemented.
Besides, an update of this kind would not be released in an update (those are for Host Plugins), but would be included in a Major release. Since I don't expect this in the next major release, it will probably be early next year before it is part of JDownloader. That is why we have been trying to find external files to solve your problem. One of the things you should be aware of is that Linux scripting is not intended to be user friendly, just very powerful. I used to be a unix expert, but I have been stuck in Windows since 1985. The man pages are a good resource for finding out about features (start with "man tsh"). I also recommend books by O'Reilly such as Linux in a nutshell. |
#16
|
|||
|
|||
Quote:
I think it's better to integrate such features in a more generic function such as an event/task manager, but nothing forbids you to find a good java developer to develop it now. |
#17
|
|||
|
|||
Thx for drbits and remi for reply
So there is no chance to have that wish done until next christmas... :( Maybe there will be someone who will provide this function before next year It would be awesome Regards George2002 |
#18
|
|||
|
|||
As I said nothing is impossible if you can find a good java programmer. It depends on how much you want to invest in it. A few bottles of wine might be sufficient.
|
#19
|
|||
|
|||
Hi to all! I've a problem: script don't work!
I have copied the script code with correct variable sound file for my operating system (Windows xp SP3) into SciTE Script Editor (AutoIT v3) and saved without errors. After I open script, it's open in TrayIcon, but the sound don't work when a captcha window in JDownloader pops up. Excuse for bad english!:unsure: |
#20
|
|||
|
|||
@arsenic0
Does the message "Press OK to stop this alert." pop up when the captcha window is displayed? If it does, then maybe the sound file format is incompatible and is not being played. I will test it in Windows XP to check compatibly, although I don't anticipate a problem other than the audio file not existing. Last edited by CHRONOMASTER; 20.09.2010 at 10:46. |
#21
|
|||
|
|||
No, the message isn't displayed.
Sound format is wav. |
#22
|
|||
|
|||
I just tested it in a new VMwared copy of Windows XP Pro SP3 and I didn't have a problem after changing the sound file path.
Oh, I just thought of something. Is JDownloader set to a language other than English? The reason I ask is because the script is set to look for the window title "[somesite]: Please enter", but if it's in Spanish for example it will say "[somesite]: Por favor ingresar" and will not be detected. You can fix this by changing the "Please enter" in the $DetectWindow variable to what the window says in your language. |
#23
|
|||
|
|||
Ok, solved! JDownloader was set to italian, now It's set up to English and work! (message and wav file)
Thank you very much!;) |
#24
|
|||
|
|||
Script Updated to v1.1
v1.1 (9/20/2010)
|
#25
|
|||
|
|||
Quote:
Chronomaster you rule!!!!!!!!! thank you so much! I can now get other stuff done! : ) not sure why its so difficult to have the program do this (yes, I feel entitled to complain cuz even though this program is FREAKING GENIUS, I donated a tidy sum so there! thanks again chrono! I bow to your programmyness |
#26
|
|||
|
|||
Sorry, someone help me with this script?? I don't now how to add it to my jdownloader (0.9.580).
|
#27
|
|||
|
|||
This is not a script you can add to JDownloader.
For this script you must install AutoIt then you need to right click on your desktop and choose 'New -> AutoIt v3 Script' after that, right click on the file and choose "Edit Script". Once the editor window appears, replace the content with my script then save. Close the window and double click on the file to run it. While it's running it will be located in the system tray by your clock. To quit the script, right click on the icon in the system tray and choose "Exit". |
#28
|
|||
|
|||
Quote:
I did as you wrote, and still no sound when capatacha code displays. Tell me what I have to change in order was the sound of the display capatacha code from servers such as hotfile.com, fileserve.com. |
#29
|
|||
|
|||
Quote:
Look for this icon in the system tray and the hidden tray icons, if it not there the script is not running. 2. Is JDownloader set to a language other then English? |
#30
|
|||
|
|||
Linux solution
Working for me linux solution written as bash scrips is following:
Code:
#!/bin/sh PLAY=0 while [ true ]; do WIN=`xdotool search --title 'please enter'` if [ -n "$WIN" ]; then PLAY=1 else PLAY=0 fi if [ $PLAY = 1 ]; then aplay /path/to/sound/file/jdsound.wav fi sleep 5 done It requires xdotools and aplay installed (usually from given distribution repository). Copy code to text file, name it somehow (eg. jdsound.sh), chmod it to 0755, provide wav sound file, replace "/path/to/sound/file/jdsound.wav" part with your sound file path and execute. Sound should appear when window with 'please enter' text in title will be opened. Tested on gnome (ubuntu hardy). |
#31
|
|||
|
|||
Thanks, this looks very nice.
|
#32
|
|||
|
|||
Instead:
Code:
echo CAPTCHA! | sendxmpp --tls --user user --jserver yourserver.com --password password recipient@jabberserver.com Gives XMPP/jabber notification. Needs sendxmpp package. |
#33
|
|||
|
|||
Hello there
i also have my version of enabling sound on linux when desired window popups This is the script that wroted my buddy: Code:
# title_window # Copyright (C) 2010 Rafal Pogorzelec (mail:http://www.google.com/recaptcha/mailhide/d?k=01we46RSAUuqHSIbxuEMpsSQ==&c=SGoWxLS_x56S5_ScSXPXwCtmTBN5-ln181pkuq2_xpg=) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <**External links are only visible to Support Staff** import subprocess,re if __name__ == '__main__': xprop = subprocess.Popen(('xprop', '-root', '-spy'),stdout=subprocess.PIPE, stderr=subprocess.PIPE) while True: line = xprop.stdout.readline() if not line: break if re.match('_NET_ACTIVE_WINDOW', line): try: id = re.split(' ', line)[4] xwininfo = subprocess.Popen(('xwininfo', '-id', id),stdout=subprocess.PIPE, stderr=subprocess.PIPE) while True: line = xwininfo.stdout.readline() if not line: break if re.match('xwininfo', line): m = re.compile('".*"').search(line) if m: title = m.group() print title if re.search('', title): play = subprocess.Popen(('aplay','sound/sound.wav'),stdout=subprocess.PIPE, stderr=subprocess.PIPE) except IndexError: pass Its writed in python language and for working python 2.6 must be installed - pet file of python 2.6 (for puppy linux - i work on that version of linux ) can be found here:dotpups.de/puppy4/dotpups/Programming/python-2.6.4-i386.pet Small description/howto: In attached file there is 2 catalogs: license - GPL license tw - in that catalog there is python script that plays sound when wanted window popups and catalog with sound file (default - sound.wav, i added 2 more sounds from windows ) edit line Code: if re.search('', title): for eg jdownloader Code: if re.search('Please enter', title): - for english language version of course eg for Polish it will be: Code: if re.search('Prosz wprowadzi', title): and one file: start_tw - it's start file for python script - i added this file to my-documents/Startup (autostart catalog in puppy) PS Whole popup catalog must be in root catalog PS2 Ups i can't attache file :( it can be found here:megaupload.com/?d=OQ2WLJX9 PS3 Hello there again I uploaded here:megaupload.com/?d=500C3JBQ new version of script. My buddy added very cool feature: Now sound is played in loop with additional delay between played sound as long as window appears, if window disappears then sound stops playing and waiting for next appear of window Regards George2002 Last edited by george2002; 27.10.2010 at 21:58. |
#34
|
||||
|
||||
The python script should need very little change to run in Activestate Python (a free distribution that includes some Windows libraries - you do not have to buy any of their products to make this work).
|
#35
|
|||
|
|||
For Windows IMO there's a simple solution using windows script host, doing exactly the same as my script, and being able to be executed on any windows version without any additional tools. But isn't really simplier to add this single line of code to captcha window in jdowloader?
|
#36
|
||||
|
||||
Quote:
This requires a Setting line (or two) on Modules -> AntiCaptcha to supply the path to the sound file (empty=quiet). The Java code requires importing more classes that are related to sound. Then, function must be written to contain the statement(s) for playing the sound files. Exception handling (to log and then ignore any errors adds more code. Finally, there is the call to the function. Technically, there should be synchronization to avoid overlapping sound calls, but we can let the library deal with it (that is one of the exceptions that must be caught). Research 1-2 hours, Coding test program for the function, 1 hour (must test existing and non-existing sound files)). Coding function and call to function 1 hour. Rework, because we forgot to load the Codecs (Nobody ever specified the Container type or the data format - both of these require Codecs). Under Windows, the sound standard for this type of alert is still WAV (uncompressed binary values fed directly to the sound software). However, WAV codecs are not available for all Linux distributions. MP3 is an alternative. This is the container type. Usually data is clipped, frequency limited, and then compressed. The compression/decompression requires a codec. This should be available on Java 1.6 or later. I don't know about 1.5. |
#37
|
|||
|
|||
OK, well done job takes more than a while. But I've been thinking about something much simplier, which is adding a command line option --exec-on-captcha="command" as a workaround. The command could be system-dependend and could give a sound, send jabber message, and do whatever you want. On the other hand, if you plan to add fully-functional event manager within a fair amount of time, there's no reason to clutter the code with such solutions. But if we will be waiting longer time for that, why not to do it?
|
#38
|
|||
|
|||
I really don't want to waste you're time but for some odd reason this script isn't working for me. I got installed a English version of Windows XP Professional, running the latest version of JDownloader v 0.9.580 and using the English language interface. I also installed the AutoIt v3 program package for their official site. So there can't be any problem with the language and any other programs I use.
I'm downloading form a site called "filesonic. com" so I changed this correctly in your script like this (oh and yes the pop-up window for CAPTCHA input is entitled with exactly the same title as it is written below) Code:
$Title = "filesonic.com: Please enter" Code:
Sleep(250) Code:
While 1 If WinExists($DetectWindow) Then ExitLoop Else Sleep(250) EndIf WEnd Well I would love to see this working on my computer and I'm also really thankful for his great script of you. Thank you for any help in advance |
#39
|
|||
|
|||
Why do you want it to recognise the filesonic captcha alerts only?
The script works fine with ": Please enter". If you want to be sure, only use "filesonic.com", because there might be invisible, special characters in that window title. I'm using "Captcha Alert : a simple tool solution.". It's similar but you don't need AutoIt and you can set several window titles at once. I'm already using it for 4 different applications and I'm no longer missing 'hidden' or 'silent' alerts. |
#40
|
|||
|
|||
Thank you for help remi
|
Thread Tools | |
Display Modes | |
|
|