JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #101  
Old 19.05.2017, 20:58
0r3n 0r3n is offline
Baby Loader
 
Join Date: Oct 2016
Posts: 9
Default

That's exactly, mgpai.
to a text file, or to csv file that have the file name and the comment.
anything that will help to save the comments will be helpful.
Reply With Quote
  #102  
Old 19.05.2017, 22:16
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 167
Default

Quote:
Originally Posted by 0r3n View Post
... save all comments from the comment column into a package to a txt file ...
Quote:
Originally Posted by 0r3n View Post
... or to csv file that have the file name and the comment ...
Code:
// Write link comments to 'csv' file.
// Trigger: "Package Finished".

var links = package.getDownloadLinks();
var data = [];

for (i = 0; i < links.length; i++) {
    var link = links[i];
    var comment = link.getComment();
    var fileName = link.getName();
    if (comment) data.push([fileName, comment].join(","));
}

if (data.length) {
    var destFolder = package.getDownloadFolder() + "/";
    var destFile = package.getName() + ".csv";
    writeFile(destFolder + destFile, data.join("\r\n"), true);
}

Last edited by mgpai; 19.05.2017 at 22:32. Reason: Optimized script
Reply With Quote
  #103  
Old 22.05.2017, 21:11
Fireman449 Fireman449 is offline
I will play nice!
 
Join Date: May 2017
Posts: 5
Question Script dont work if JDownloader starts it, but if I start it manually it works fine..

Quote:
Originally Posted by mgpai View Post
Can use either of the following, with trigger "Archive extraction Finished".

Synchronous:
Code:
callSync("cmd","/c","c:/myFolder/myBatch.bat");

Asynchronous:
Code:
callAsync(function(){},"cmd","/c","c:/myFolder/myBatch.bat");

At first, thank you for your really fast support
Now JD starts the script after unrar but the batch script doesnt find the sample or proof data. If i start the batch script manually the batch script is working fine.
I think the problem depends on the drive mapping cause the Log File is generated on "C:\temp" well but the script dont delete the files on drive Z:.

May you can help me out, here is my batch script:
Spoiler:
@echo off & setlocal


::Ordnername
set "name=sample"
set "name2=proof"


::Speicherpfad der Logdatei
set "path=C:\temp\deleted.txt"


::Suchpfad der Ordner
set "search=Z:\Downloads\Entpackt"



::Erstellen der .txt-Datei mit den Pfaden der gelöschten Ordner und Dateien
echo Folgende Ordner und Dateien mit dem Namen %name% und %name2% wurden unter %search% gefunden und entfernt: >> "%path%"
echo. >> "%path%"
cd "%search%"
dir /b /s "*%name%*" >> "%path%"
dir /b /s "*%name2%*" >> "%path%"
echo. >> "%path%"


::Löschen der Ordner
for /f "delims=" %%a in ('dir /ad /b /s "%name%"') do rd /s /q "%%a" 2>nul
for /f "delims=" %%a in ('dir /ad /b /s "%name2%"') do rd /s /q "%%a" 2>nul


::Löschen der Dateien die direkt im gleichen Ordner liegen
del /s "%search%\*%name%*.*"
del /s "%search%\*%name2%*.*"


::Öffnen der Log Datei (auskommentiert)
::%path%



EXIT
Reply With Quote
  #104  
Old 23.05.2017, 08:12
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 167
Default

Quote:
Originally Posted by Fireman449 View Post
I think the problem depends on the drive mapping cause the Log File is generated on "C:\temp" well but the script dont delete the files on drive Z:.
Troubleshoot the batch file using:

Code:
alert(callSync("cmd","/c","c:/myFolder/myBatch.bat"));// Log to screen (Dialog Box)
OR
Code:
log(callSync("cmd","/c","c:/myFolder/myBatch.bat"));// Log to file  "<JD>\logs\<sessionID>\ScriptEnvironment.log.0"

Alternatively, the folders can also be removed directly from event scripter
Code:
// Delete junk folders
// Trigger: "Archive Extraction Finished"

var archiveFolder = archive.getExtractToFolder(); // <- Will dynamically get the folder from 'archive info'. Can also set static folder.
var junkFolders = ["proof", "sample"]; // <- Specify folders to delete.

for (i = 0; i < junkFolders.length; i++) {
    var junkFolder = getPath(archiveFolder + "/" + junkFolders[i]);
    if (junkFolder.exists()) junkFolder.deleteRecursive();
}
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 08:00.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.