#1
|
|||
|
|||
![]()
Hi and Merry Christmas to all celebrating
Firstly thank you for wonderful Even Scripter, I started playing around, and tried using convert to mp3 script which works. Was just thinking of adding an "Are you sure" box before converting to mp3 file as below: Code:
// Convert aac/m4a/ogg files to mp3. // Trigger required: "A Download Stopped". // Requires ffmpeg/ffprobe. Uses JD ffmpeg/ffprobe settings if available. // Overwrites destination file (mp3) if it already exists. disablePermissionChecks(); //confirm("Pree OK to convert AAC to MP3, Cancel to ignore"); if (window.confirm("Convert to Mp3?")) { if (link.finished) { var input = link.downloadPath; var output = input.replace(/(aac)$/, "mp3"); if (input != output) { try { var ffmpeg = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypath"); var bitrate = callSync(ffmpeg, "-i", input).match(/bitrate: (\d+) kb/)[1]; callAsync(function(error) { !error && getPath(input).delete(); }, ffmpeg, "-y", "-i", input, "-b:a", bitrate + "k", output); } catch (e) {}; } } } Details tell me: Code:
net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "window" is not defined. Please can you advise? Thanks. Last edited by FWD079; 25.12.2024 at 18:23. |
#2
|
|||
|
|||
![]()
Images are not being uploaded from imgur somehow, please see attachment to this thread.
Thanks. |
#3
|
||||
|
||||
![]()
@FWD079: JDownloader is no browser. No window object exists. Please don't rely/ask chatgpt for help
![]() At the moment, there is no support for a confirm dialog but I can add one. You just need a dialog that you can define text and button text and then get back the result=clicked button?
__________________
JD-Dev & Server-Admin |
#4
|
|||
|
|||
![]() Quote:
Thank you so much for super fast reply. |
#5
|
||||
|
||||
![]()
@FWD079: I will ping here once I've added a "confirm dialog" support
__________________
JD-Dev & Server-Admin |
#6
|
|||
|
|||
![]() Quote:
![]() Thanks. |
#7
|
||||
|
||||
![]()
Update is live.
Quote:
in future(if needed) I can add finer *not okay* return status (closed, cancelled, timeout support,.....).
__________________
JD-Dev & Server-Admin |
#8
|
||||
|
||||
![]()
@Jiaz
Is there any docs for this or maybe at least an example code where you could include such methods so ppl can not only find them by browsing our forums?
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#9
|
|||
|
|||
![]()
Can be found in the 'global' methods section in the built-in editor help:
Code:
var myInt = showConfirmDialog(myString/*message*/, myString/*okOption*/, myString/*cancelOption*/);/*Show a Confirm Dialog*/ |
#10
|
||||
|
||||
![]()
@pspzockerscene: I've posted working example in my answer
![]()
__________________
JD-Dev & Server-Admin |
#11
|
||||
|
||||
![]()
@mgpai
Ahh indeed. Thanks! I've never looked at that lol @Jiaz Yes I know but as explained, my post was about finding the availability of that code without the need to do a websearch and find this thread.
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#12
|
|||
|
|||
![]()
Ah brilliant, I checked and all my notifications are on, but this neither sent an email nor popped up for some reason. Thank you 🙏🙏
|
![]() |
Thread Tools | |
Display Modes | |
|
|