JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 23.11.2017, 15:30
crashme crashme is offline
Modem User
 
Join Date: Nov 2017
Posts: 3
Default Getters on archive return null in EventScripter

Hi guys,

I recently discovered the EventScripter feature of JDownloader. However the following code fails, archive is undefined and as a result, all getters just return null.

Code:
var paths = archive.getExtractedFilePaths();
if (paths !== null)
    writeFile(JD_HOME + "/log.txt", JSON.stringify(paths), false);
Any help? The script itself should be configured correctly, trigger is "ON_ARCHIVE_EXTRACTED".

Kind regards
Reply With Quote
  #2  
Old 23.11.2017, 15:33
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 70,910
Default

Please know that some getters do now work in *Test* Mode because of dummy objects.
also it will only return !=null if there are extracted files.
null = nothing got extracted
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3  
Old 23.11.2017, 15:33
crashme crashme is offline
Modem User
 
Join Date: Nov 2017
Posts: 3
Default

I tested it with valid data. Extraction works fine, "archives" however is empty.
Reply With Quote
  #4  
Old 23.11.2017, 15:37
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 70,910
Default

Can you provide example archives/log/example script?
Cannot reproduce the issue
__________________
JD-Dev & Server-Admin
Reply With Quote
  #5  
Old 23.11.2017, 15:53
crashme crashme is offline
Modem User
 
Join Date: Nov 2017
Posts: 3
Default

Found my mistake. paths does not seem to be serializable which resulted in an error. At the same time writeFile failed because I set the "append" flag to false, thinking it would erase the file's content before writing to it. However an exception was raised because the file already existed.
Reply With Quote
  #6  
Old 23.11.2017, 16:35
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 70,910
Default

getExtractedFilePaths returns FilePath objects and no String.
So you will have to iterate through results and build string yourself

Thanks for the feedback!
__________________
JD-Dev & Server-Admin
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 16:37.
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 - 2021, Jelsoft Enterprises Ltd.