JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #2361  
Old 21.06.2022, 11:47
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 313
Default

Quote:
Originally Posted by Jiaz View Post
Excel informs you that JSON value is a List or Record, the type and you have to query which information of that value you're intersted in...
Thanks for the enlightenment!

I checked settings.json and found the correct strings there. So, another 'problem' created by Excel's 'features'.

There are many examples for unwanted 'conversion' etc.

E.g. I want to open a csv file which contains Corona figures for age groups:

0-4
5-9
10-14
15-19
...


What does Excel do?

0-4
05. Sep
Oct 14
15-19
...


Haven't found a way to turn these automatic 'helpers' off.
If you format all columns to Text, Excel won't remember...

Same with the tsv settings file, created by mgpai's script:
Doubleclicking for opening it in Excel results in corruption of some strings.
So, you have to import it, select UTF-8,...


Also haven't found a way to tell Excel that I want to open all files as UTF-8.


Question 1:
You seem to be pretty familiar with Excel, too.
Any ideas, e.g. how to let Excel treat all *.txt, *.csv, *.tsv, ... as UTF-8?

Question 2:
If you format all columns to Text, Excel won't remember...
Do you know how to tell Excel to use text formatting as default? This would solve some problems such as my age group example.

Then I could open csv files from RKI using doubleclick instead of time consuming import of each and every file...

Last edited by StefanM; 21.06.2022 at 11:50.
Reply With Quote
  #2362  
Old 21.06.2022, 12:34
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 76,912
Default

Quote:
Originally Posted by StefanM View Post
Same with the tsv settings file, created by mgpai's script:
Doubleclicking for opening it in Excel results in corruption of some strings.
So, you have to import it, select UTF-8,...


Also haven't found a way to tell Excel that I want to open all files as UTF-8.


Question 1:
You seem to be pretty familiar with Excel, too.
Any ideas, e.g. how to let Excel treat all *.txt, *.csv, *.tsv, ... as UTF-8?
I don't even have/use Excel I just google those answers
Please see:
lukemiller.org/journal/2005/03/changing-default-text-import-origin.html
smallbusiness.chron.com/open-utf8-excel-63726.html

It seems Excel does support BOM, see
superuser.com/questions/911369/excel-change-default-encoding-file-origin-of-text-import-wizard-to-utf-8-650
@mgpai: see stackoverflow.com/questions/4389005/how-to-add-a-utf-8-bom-in-java, just have to add the BOM character at the beginning of the string should do it, for example
Quote:
'\ufeff' + string
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 21.06.2022 at 12:43.
Reply With Quote
  #2363  
Old 21.06.2022, 12:45
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 76,912
Default

Quote:
Originally Posted by StefanM View Post
Question 2:
If you format all columns to Text, Excel won't remember...
Do you know how to tell Excel to use text formatting as default? This would solve some problems such as my age group example.
I'm sorry but I have not found a way to change/define the default formatter of new sheets.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #2364  
Old 21.06.2022, 12:45
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 313
Default

Quote:
Originally Posted by Jiaz View Post
I don't even have/use Excel I just google those answers
I googled already for ages...

But the BOM issue, I haven't found myself.
Will check it out. Thanks a lot!
EDIT:
No, this doesn't help! As you still have to use import. What I want to do is open files in Excel with doubleclick without corrupting anything.




The ultimate solution, however, would be to be able to configure Excel in such a way, that it uses certain start settings.

E.g. I often use 'text to columns'. But it's a pain in the ass, that every time you start Excel, it is reset to it's default settings and it is enabled.

Last edited by StefanM; 21.06.2022 at 12:49.
Reply With Quote
  #2365  
Old 21.06.2022, 12:52
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 76,912
Default

Quote:
Originally Posted by StefanM View Post
I googled already for ages...

But the BOM issue, I haven't found myself.
Will check it out. Thanks a lot!
EDIT:
No, this doesn't help! As you still have to use import. What I want to do is open files in Excel with doubleclick without corrupting anything.
have you tried to change default encoding via registry ?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #2366  
Old 21.06.2022, 16:55
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 313
Default

Quote:
Originally Posted by Jiaz View Post
have you tried to change default encoding via registry ?
Yes, long time ago already. And in Win10 there is also an option to enable UTF-8 (still called experimental). Both won't help.

But I set Windows notepad to UTF-8 via Registry, also long time ago. That works.
Reply With Quote
  #2367  
Old 21.06.2022, 17:20
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 76,912
Default

Quote:
Originally Posted by StefanM View Post
Yes, long time ago already. And in Win10 there is also an option to enable UTF-8 (still called experimental). Both won't help.
I'm not talking about Win10, the links are especially about default encoding for Excel.
What excel version are you using? Just tested on Excel 16 on my college computer and UTF-8 was default encoding.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #2368  
Old 21.06.2022, 20:00
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 313
Default

Quote:
Originally Posted by Jiaz View Post
I'm not talking about Win10, the links are especially about default encoding for Excel.
What excel version are you using? Just tested on Excel 16 on my college computer and UTF-8 was default encoding.
I said both, Win 10 settings and Registry patch, did not help.
I run Excel 2019.

So, how did you test it:
Did you open a csv or tsv file with UTF-8 encoding by doubleclicking on it and Excel displayed 'special' characters like this one '↓ At the bottom' correctly?

I'm not talking about importing such a file, as I don't want to do that:
Too many clicks:
  1. Clicking on 'Data'
  2. Then on 'From Text/csv'
  3. Then browse for the file you want to open
  4. Then select the file origin from some 100 lines as UTF-8,
  5. Then confirm once again the separator,
  6. Then load,
  7. Then copy everything to a new sheet,
Doubleclicking is just one 'click'

PS Notes:
answers.microsoft.com/en-us/msoffice/forum/all/how-to-set-excel-to-default-to-utf-8-when-opening/c05ac760-b9e8-4cad-b188-6c0b4d3d2926

superuser.com/questions/911369/excel-change-default-encoding-file-origin-of-text-import-wizard-to-utf-8-650
And also this is only about text import as explained in those 7 steps (click marathon) I tried to explain.

Last edited by StefanM; 21.06.2022 at 21:22. Reason: PS Notes
Reply With Quote
  #2369  
Old 22.06.2022, 10:45
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 76,912
Default

Quote:
Originally Posted by StefanM View Post
I'm not talking about importing such a file, as I don't want to do that:
Too many clicks:
  1. Clicking on 'Data'
  2. Then on 'From Text/csv'
  3. Then browse for the file you want to open
  4. Then select the file origin from some 100 lines as UTF-8,
  5. Then confirm once again the separator,
  6. Then load,
  7. Then copy everything to a new sheet,
Doubleclicking is just one 'click'
I'm sorry. I was talking about "From Text/CSV" button. But as this is nothing I would do once a day/minute/hour..I would not mind the extra steps/clicks for a proper CSV import
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 22.06.2022 at 10:48.
Reply With Quote
  #2370  
Old 22.06.2022, 17:01
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 313
Default

Quote:
Originally Posted by Jiaz View Post
I'm sorry. I was talking about "From Text/CSV" button. But as this is nothing I would do once a day/minute/hour..I would not mind the extra steps/clicks for a proper CSV import
I do this several times a day (not regarding JD). Still working as a volunteer on IT issues and topics, preparing quite a view documents and statistics. And - as I said - even figures from institutions like RKI or LZG come in csv format and Excel cannot handle them properly by just doubleclicking on them.

I was looking for a solution in general, not only for JD issues. But never mind, I've been searching for ages and could not find solutions.

But thanks for trying!
I really appreciate this!
Reply With Quote
  #2371  
Old 24.06.2022, 07:12
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 500
Default

Hello mgpai,

when I click "Toggle sound notification"


the selected items are sent to history ("Move to history") suddenly


Is there any way to correct that?
__________________
Aktuelles Windows
Reply With Quote
  #2372  
Old 24.06.2022, 11:06
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 76,912
Default

Quote:
Originally Posted by StefanM View Post
I was looking for a solution in general, not only for JD issues. But never mind, I've been searching for ages and could not find solutions.
Have you tried LibeOffice/other SpreadSheet Tools? Even maybe Online Services/Tools?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #2373  
Old 24.06.2022, 11:07
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 76,912
Default

Quote:
Originally Posted by Dockel View Post
Hello mgpai,
when I click "Toggle sound notification"
the selected items are sent to history ("Move to history") suddenly
Is there any way to correct that?
Check your scripts in Eventscripter! They must check on action name!
__________________
JD-Dev & Server-Admin
Reply With Quote
  #2374  
Old 24.06.2022, 11:14
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 500
Default

Sorry, what does that mean, what action name? Where is it? What do I have to do exactly?
__________________
Aktuelles Windows
Reply With Quote
  #2375  
Old 24.06.2022, 11:30
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 76,912
Default

@Dockel: those are scripts in your Eventscripter. You have to check Settings->Eventscripter and search the script and make sure that it only runs on correct action name.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #2376  
Old 24.06.2022, 11:36
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 500
Default

Sorry, do not understand what / where the action is.
__________________
Aktuelles Windows
Reply With Quote
  #2377  
Old 24.06.2022, 11:40
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 76,912
Default

@Dockel: those rightclick context menu items are scripts in your Settings->Eventscripter.
There you must have setup those on Tigger/Event "Downloadlist Contextmenu Button Pressed"
then click on edit and make sure that the script does check for correct name, something like
Quote:
if (name == "Split Packages") {
__________________
JD-Dev & Server-Admin
Reply With Quote
  #2378  
Old 24.06.2022, 11:54
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 500
Default

OK, I will try it. Thank you!
__________________
Aktuelles Windows
Reply With Quote
  #2379  
Old 26.06.2022, 14:47
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by StefanM View Post
A column which indicates whether or not the default settings for a row have been changed. (e.g. DEFAULT / CUSTOM)
Code:
/*
    Export settings
    Trigger : none
*/

var rows = [];
var keys = [];
var file = JD_HOME + "/settings.tsv";
var settings = callAPI("config", "list", ".+", true, true, true, true);

settings.forEach(function(item) {
    var itemKeys = Object.keys(item);
    itemKeys.length > keys.length && (keys = itemKeys);
})

keys = keys.concat(["modified", "comment"]);
rows.push(keys.join("\t"));

settings.forEach(function(item) {
    var obj = {};
    var row = [];

    keys.forEach(function(key) {
        obj[key] = JSON.stringify(item[key]);
    })

    obj.modified = obj.value == obj.defaultValue ? "\"Default\"" : "\"Custom\"";

    for (key in obj) {
        if (key == "value" || key == "defaultValue") {
            row.push(JSON.stringify(obj[key]));
        } else {
            row.push(obj[key]);
        }
    }

    rows.push(row.join("\t"))
})

writeFile(file, rows.join("\n"), false);

Quote:
Originally Posted by StefanM View Post
... restore the settings from the saved tsv file,
Code:
/*
    Import Settings
    Trigger: None
*/
    
var file = JD_HOME + "/settings.tsv";
var text = readFile(file).trim().split("\n");
var keys = text.shift().split("\t");
var settings = [];

text.forEach(function(row) {
    var obj = {};

    row.split("\t").forEach(function(item, index) {
        try {
            obj[keys[index]] = JSON.parse(item);
        } catch (e) {
            obj[keys[index]] = null;
        }
    })

    settings.push(obj);
})

settings.forEach(function(item) {
    item.value != null && callAPI("config", "set", item.interfaceName, item.storage, item.key, item.value);
})
Reply With Quote
  #2380  
Old 26.06.2022, 15:21
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 313
Default

Quote:
Originally Posted by mgpai View Post
Code:
/*
    Export settings
    Trigger : none
*/
...
Quote:
Originally Posted by mgpai View Post
Code:
/*
    Import Settings
    Trigger: None
*/
...
Hey, you really created a script to import settings!
And you also added the the CUSTOM/DEFAULT column!

Thank you so much for all the hard work!

Both scripts will really be very useful for me (and not only for me, I guess...)!
Will test later and let you know about the result.

You probably already read this!?
One working way to use Excel for the job of viewing/editing settings.tsv without corruption.

If you know a better way, please let me know.

Last edited by StefanM; 26.06.2022 at 15:41.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 00:34.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.