#1101
|
|||
|
|||
![]() Quote:
How do you refine it to local dateTime? plus able to chose 12hour and 24hour format? with example above it returns 20:35 which is 08:35PM but my local time is 12:35PM |
#1102
|
|||
|
|||
![]() Quote:
Use JS date object methods to convert it to your desired format. Code:
www.w3schools.com/jsref/jsref_obj_date.asp |
#1103
|
|||
|
|||
![]() Quote:
var n = new Date(); alert(n.toLocaleDateString("en-US")) //'February 27, 2020' Is there anyway to convert ''February 27, 2020' to numeric 'yyyy-mm-dd'? |
#1104
|
|||
|
|||
![]()
I'm trying to have two scripts with trigger via 'Toolbar Button Pressed'
Button 1 is called 'This is script' Button 2 is called 'This is script Child' but when Button 1 is pressed both are executed at the same time. Could review examples bellow. Code:
//Caller Script - Parent //Trigger: Toolbar Button Pressed if (name = 'This is script') { alert('script 1') } Code:
//Be called - Child //Trigger: Toolbar Button Pressed if (name = 'This is script Child') { alert('script 2') } Off topic: Is it possible to have script1 call script2? Thanks Last edited by zreenmkr; 27.02.2020 at 10:38. |
#1105
|
|||
|
|||
![]() Quote:
Quote:
Code:
if (name = 'This is script') { Use 'comparision operator' instead. Code:
if (name == 'This is script') { Quote:
|
#1106
|
|||
|
|||
![]() Quote:
Code:
if (name == 'This is script') { Sorry for he typo, comparison operator is what I had in the script. So any idea? see attached for the created buttons. |
#1107
|
|||
|
|||
![]()
Example:
Code:
var myDate = function() { var t = new Date(); var year = t.getFullYear(); var month = ("0" + (t.getMonth() + 1)).slice(-2); var date = ("0" + t.getDate()).slice(-2); return [year, month, date].join("-"); } alert(myDate()); Only the mods have access to the attachment. I have tested both scripts using comparision operator and they are working correctly. |
#1108
|
|||
|
|||
![]() Code:
var myDate = function() { var t = new Date(); var year = t.getFullYear(); var month = ("0" + (t.getMonth() + 1)).slice(-2); var date = ("0" + t.getDate()).slice(-2); return [year, month, date].join("-"); } alert(myDate()); Quote:
screenshots Last edited by zreenmkr; 27.02.2020 at 13:37. |
#1109
|
|||
|
|||
![]()
tried to create trigger 'Toolbar Button Pressed' in Right Click 'Open Menu Manger' but script didn't get executed
|
#1110
|
|||
|
|||
![]() Quote:
Code:
if (name = 'This is script Child') { Code:
if (name == 'This is script Child') { |
#1111
|
|||
|
|||
![]() Quote:
Quote:
Try creating a different one using instructions provided in this KB article. |
#1112
|
|||
|
|||
![]() Quote:
Quote:
One more thing. Is it normal for EventScripter to failed when code has mistakes in them. Code is triggered by Interval. When executed and error message popup. Went back in the editor and fixed the error but Script would not execute again until restart jd. (exit out jd/and reload). Is this a bug? |
#1113
|
|||
|
|||
![]() Quote:
Quote:
Quote:
The script will be disabled on error. While there are methods which can be used to prevent it, I would recommend using it only for debugging. Code:
setDisableOnException(myBoolean); // enable/disable script on exceptions setNotifyOnException(myBoolean); // enable/disable notification on exceptions You can also use the use JS error handling methods: Code:
www.w3schools.com/js/js_errors.asp |
#1114
|
|||
|
|||
![]() Quote:
Code:
setDisableOnException(myBoolean); // enable/disable script on exceptions setNotifyOnException(myBoolean); // enable/disable notification on exceptions yea, I gave 'JS error handling methods' a go before and for some odd reasons it kept saying "missing ';' before try" so I gave up (couldnt remember exactly). Now the switches above is easier to implement. Disable Match Files https :// github.com/mgpai/resources/blob/master/jdownloader/eventscripter/scripts/netgearjd.js This script utilized 92% of cpu power to the point where mouse movement was no longer possible. End task was not possible so It required hard reset. I have a few thousand links in Downloads tabs alone. Last edited by zreenmkr; 27.02.2020 at 15:23. |
#1115
|
|||
|
|||
![]() Quote:
Code:
Help > About JDownloader > Memory You may need to increase memory allocation based on the number of links in JD and the text file. Related post #414379 |
#1116
|
|||
|
|||
![]() Quote:
Could you give an example where say one of Packgizer rules below return true then exit without trying the next rule bellow? I want to sort books and group them into different packages. If none of new books match any given given Packagizer rules then group those in general ebooks package. As of right now, due to linear rules execution in Packagizer all ebooks will be grouped in '___Ebooks' Package although some books return true to some of prior rules. <Condition Name> = _Book Of Animals if <File Name> contains (birds|elephant) [x]RegExp then <Package Name> = __Book Of Animals <Condition Name> = _Book Of Cars if <File Name> contains (bmw|honda|tesla) [x]RegExp then <Package Name> = __Book Of Animals ... <Condition Name> = _eBooks if <File Type> is pdf,epub,mobi [x]RegExp then <Package Name> = ___eBooks |
#1117
|
|||
|
|||
![]()
Revisit prior resolved post above by @mgpai
Objective is to get dateTime in numeric format such as 'yyyy-mm-dd' with an alternative other than above. toJSON() and toISOString() are a few that return this layout but timezone is not local as explained bellow. Desired layout yyyy-mm-ss_-_hh-mm-ss Code:
//@mgpai var dateTime = new Date().toJSON().substr(0, 19).replace("T", "_-_").replace(/:/g, "-"); Quote:
So here is the alternative Code:
var date = new Date(); var n = date.getTimezoneOffset(); //alert(n); //return time different in #minutes var dateTime = new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toJSON(); //alert(dateTime); //yyyy-mm-ssThh:mm:ss.msZ - Converted to Local Time var finalDateTime = dateTime.substr(0, 23).replace("T", "_-_").replace(/:/g, "."); alert(finalDateTime ); Final modified yyyy-mm-ss_-_hh.mm.ss.ms |
#1118
|
|||
|
|||
![]() Quote:
Code:
// Trigger: Packagizer Hook var fn = link.getName(); var pn; if (!pn && /birds|elephant/.test(fn)) pn = "animals"; if (!pn && /bmw|honda|tesla/.test(fn)) pn = "cars"; if (!pn && /.*\.(pdf|epub|mobi)$/.test(fn)) pn = "ebooks"; if (pn) link.setPackageName(pn); |
#1119
|
|||
|
|||
![]()
a) Is there a function to get filename or link on selected file in Downloads/LinkGrabber tab
b) and function that return all subfolders and a function return files in dir Thanks |
#1120
|
|||
|
|||
![]()
Is it possible to check file exist via regex?
Original fileName with spaces and/or underscore and/or hyphen ect... code below doesn't work. Code:
var file = 'c:/docs/my(.*?)file(.*?)name(.*?)by(.*?)author.pdf' if (!file.exists()) return; alert('file exist'); |
![]() |
Thread Tools | |
Display Modes | |
|
|