View Single Post
  #591  
Old 17.02.2019, 01:02
almanteka almanteka is offline
Baby Loader
 
Join Date: Feb 2019
Posts: 9
Default

hi! i'm trying to adapt these two scripts to move the original "un-extracted" package to another folder after the extraction ocurred! i know that jdownloader can move the original files to the recycle bin, but i'm looking to move the original "un-extracted" package to another folder instead! thanks in advance for your suggestions & help!


ArchiveExtracted.js
Code:
var script = 'F:\\JDownloader v2.0\\JDTest3.bat'

var myFilePackage = package;
var path = myFilePackage.getDownloadFolder()
var name = myFilePackage.getName()
var label = myFilePackage.getComment() ? myFilePackage.getComment() : 'N/A'
var links = myFilePackage.getDownloadLinks() ? myFilePackage.getDownloadLinks() : []

function isReallyFinished() {
	for (var i = 0; i < links.length; i++) {
		if (links[i].getArchive() != null && links[i].getExtractionStatus() != "SUCCESSFUL" || !package.isFinished()) {
			return false
		}
	}
	return true
}

if (isReallyFinished()) {
	var command = [script, path, name, label, 'PACKAGE_FINISHED']
	log(command)
	log(callSync(command))
}

maybe this one?
Code:
//Trigger: "Archive Extraction Finished"

var packageFinished = archive.getDownloadLinks()[0].getPackage().isFinished();

var folder = archive.getDownloadLinks()[0].getPackage().getDownloadFolder();
var name = archive.getDownloadLinks()[0].getPackage().getName();


if (packageFinished) {
    alert("External Command " + " Parameter1: " + folder + " Parameter2: " + name);
}

JDTest3.bat
Code:
@ECHO OFF

set ARG_NAME=%1

move "F:\\JD Downloads\\%ARG_NAME%" "F:\\!TRASH!"

:thumbup:
Reply With Quote