#1
|
|||
|
|||
![]()
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 ![]() ![]() 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) ![]() ![]() 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. |
![]() |
Thread Tools | |
Display Modes | |
|
|