## Global ### alert ``` /* alert(myObject[]); Show a Message Box */ alert(JD_HOME); ``` ### callAPI ```js /* var myObject = callAPI(myString, myString, myObject[]); Call the MyJDownloader API locally (no network involved), see API Docs here https://my.jdownloader.org/developers/ */ callAPI("downloadsV2", "queryLinks", { "name": true}) ``` callAsync(myFunction, myString[]);/*Call a local Process asynchronous*/ /* Example: */callAsync(function(exitCode,stdOut,errOut){ alert("Closed Notepad");},"notepad.exe",JD_HOME+"\\license.txt"); var myString = callSync(myString[]);/*Call a local Process. Blocks Until the process returns*/ /* Example: */var pingResultString = callSync("ping","jdownloader.org"); var myBoolean = deleteFile(myString/*path*/, myBoolean/*recursive*/);/*Delete a file or a directory*/ /* Example: */var myBooleanResult=deleteFile(JD_HOME+"/mydirectory/",false); disablePermissionChecks();/*disable permission checks*/ var myBoolean = doReconnect();/*Perform a reconnect and wait for it*/ /* Example: */var success= doReconnect(); enablePermissionChecks();/*enable permission checks*/ var myString = experimental_proxybanlist();/*(experimental) Get proxy banlist*/ /* Example: */experimental_proxybanlist(); var myString = experimental_proxylist();/*(experimental) Get proxy list*/ /* Example: */experimental_proxylist(); fakeReconnect(myBoolean/*true|false (Wait for fake reconnect)*/);/*Perform a fake reconnect and optionally wait for it*/ /* Example: */fakeReconnect(false); var myCrawledLink[] = getAllCrawledLinks();/*Get a list of all crawledlinks*/ var myCrawledPackage[] = getAllCrawledPackages();/*Get a list of all crawledpackages*/ var myDownloadLink[] = getAllDownloadLinks();/*Get a list of all downloadlinks*/ var myFilePackage[] = getAllFilePackages();/*Get a list of all packages*/ var myLong = getAverageSpeed();/*Get current average Download Speed in bytes/second*/ var myBrowser = getBrowser();/*Get an Browser Object*/ var myString = getChecksum(myString, myString);/*Create a Checksum for a file. Types: e.g. CRC32, MD5, SHA-1, SHA-256*/ var myCrawledLink = getCrawledLinkByUUID(myLong/*uuid*/);/*Get a CrawledLink Link by it's uuid*/ var myCrawledPackage = getCrawledPackageByUUID(myLong/*uuid*/);/*Get a CrawledLink Package by it's uuid*/ var myLong = getCurrentTimeStamp();/*Get current timestamp in ms*/ var myDownloadLink = getDownloadLinkByUUID(myLong/*uuid*/);/*Get a DownloadList Link by it's uuid*/ var myFilePackage = getDownloadPackageByUUID(myLong/*uuid*/);/*Get a DownloadList Package by it's uuid*/ var myString = getEnv(myString/*environment variable*/);/*Gets the value of the specified environment variable*/ var myEnvironment = getEnvironment();/*Get an Environment Object*/ var myModifyLock = getModifyLock(myString/*"key"*/);/*Get a ModifyLock.*/ /* Example: */var lock=getModifyLock("lockID"); var myString = getPage(myString/*URL*/);/*Loads a website (Method: GET) and returns the source code*/ /* Example: */var myhtmlSourceString=getPage("https://jdownloader.org"); var myFilePath = getPath(myString/*Path to a file or folder*/);/*Get a FilePath Object*/ var myString = getPathSeparator();/*Get the current path separator / or \*/ var myObject = getProperty(myString/*"key"*/, myBoolean/*global(boolean)*/);/*Get a Property. Set global to true if you want to access a global property*/ /* Example: */var value=getProperty("myobject", false); var myString = getProperty(myString/*system property key*/, myString/*default value*/);/*Gets the system property indicated by the specified key.*/ var myDownloadLink[] = getRunningDownloadLinks();/*Get a list of all running downloadlinks*/ var myFilePackage[] = getRunningDownloadPackages();/*Get a list of all running packages*/ var myString = getStringChecksum(myString, myString);/*Create a Checksum for a String. Types: e.g. CRC32, MD5, SHA-1, SHA-256*/ var myLong = getTotalSpeed();/*Get current total Download Speed in bytes/second*/ var myBoolean = isDownloadControllerIdle();/*Check if Download Controller is in IDLE State*/ var myBoolean = isDownloadControllerPaused();/*Check if Download Controller is in PAUSE State*/ var myBoolean = isDownloadControllerRunning();/*Check if Download Controller is in RUNNING State*/ var myBoolean = isDownloadControllerStopping();/*Check if Download Controller is in STOPPING State (Still running, but stop has been pressed)*/ var myBoolean = isSynchronous();/*is current script run in synchronous mode?*/ log(myObject[]);/*Log to stderr and to JDownloader Log Files*/ openURL(myString/*URL*/);/*Open a website or path in your default browser/file explorer*/ /* Example: */openURL("https://jdownloader.org"); playWavAudio(myString/*myFilePathOrUrl*/);/*Play a Wav Audio file*/ /* Example: */playWavAudio(JD_HOME+"/themes/standard/org/jdownloader/sounds/captcha.wav"); var myString = postPage(myString/*URL*/, myString/*PostData*/);/*Loads a website (METHOD: POST) and returns the source code*/ /* Example: */var myhtmlSourceString=postPage("https://support.jdownloader.org/index.php","searchquery=captcha"); var myString = readFile(myString/*filepath*/);/*Read a text file*/ /* Example: */var myString=readFile(JD_HOME+"/license.txt"); refreshAccounts(myBoolean/*true|false (Wait for account checks)*/, myBoolean/*true|false (Force Check)*/);/*Refresh all premium accounts*/ /* Example: */refreshAccounts(true,true); var myBoolean = removeCrawledLinkByUUID(myString);/*Remove a crawledlink by uuid*/ var myBoolean = removeCrawledPackageByUUID(myString);/*Remove a crawledpackage by uuid*/ var myBoolean = removeDownloadLinkByUUID(myString);/*Remove a downloadlink by uuid*/ var myBoolean = removeFilePackageByUUID(myString);/*Remove a package by uuid*/ requestReconnect();/*Request a reconnect*/ /* Example: */requestReconnect(); require(myString/*myFilePathOrUrl*/);/*Loads a Javascript file or url. ATTENTION. The loaded script can access the API as well.*/ /* Example: */require("https://raw.githubusercontent.com/douglascrockford/JSON-js/master/json.js"); setAdvancedAlert(myBoolean);/*enable/disable alert with textbox and copy&paste*/ setDisableOnException(myBoolean);/*enable/disable script on exceptions*/ setDownloadsPaused(myBoolean);/*Pause/Unpause Downloads*/ setNotifyOnException(myBoolean);/*enable/disable notification on exceptions*/ var myObject = setProperty(myString/*"key"*/, myObject/*anyValue*/, myBoolean/*global(boolean)*/);/*Set a Property. This property will be available until JD-exit or a script overwrites it. if global is true, the property will be available for al scripts*/ /* Example: */var oldValue=setProperty("myobject", { "name": true}, false); setSpeedlimit(myInt/*speedlimit in bytes/second*/);/*Set the Speedlimit in bytes/second. Values<=0 -> Disable Limiter*/ var myInt = showConfirmDialog(myString/*message*/, myString/*okOption*/, myString/*cancelOption*/);/*Show a Confirm Dialog*/ /* Example: */showConfirmDialog("Do you like this method?","yes","no" sleep(myInt/*milliseconds*/);/*Perform a sleep and wait for x milliseconds*/ /* Example: */sleep(1000); startDownloads();/*Start Downloads*/ stopDownloads();/*Stop Downloads*/ writeFile(myString/*filepath*/, myString/*myText*/, myBoolean/*append*/);/*Write a text file*/ /* Example: */writeFile(JD_HOME+"/log.txt",JSON.stringify(this)+"\r\n",true); /* ========= Properties =========*/ //JDownloader Installation Directory; var myString = JD_HOME; /* =============== Classes =============== */ /* === Archive === */ /* ========= Methods =========*/ var myArchiveFile[] = myArchive.getArchiveFiles(); var myString = myArchive.getArchiveID(); var myString = myArchive.getArchiveType(); var myDownloadLink[] = myArchive.getDownloadLinks();/*DEPRECATED, this method may be removed in future version*/ var myString = myArchive.getExtractToFolder(); var myFilePath[] = myArchive.getExtractedFilePaths(); var myString[] = myArchive.getExtractedFiles(); var myString = myArchive.getExtractionLog();/*DEPRECATED, this method may be removed in future version*/ var myString = myArchive.getFolder(); var myObject = myArchive.getInfo(); var myArchiveFile = myArchive.getLastArchiveFile(); var myString = myArchive.getName(); var myArchive = myArchive.getParentArchive(); var myList = myArchive.getPasswords(); var myArchive = myArchive.getRootArchive(); var myString = myArchive.getSettingsID(); var myString = myArchive.getUsedPassword(); var myBoolean = myArchive.isPasswordProtected(); myArchive.setPasswords(myList); /* === ArchiveFile === */ /* ========= Methods =========*/ var myBoolean = myArchiveFile.exists(); var myBoolean = myArchiveFile.exists(myBoolean); var myString = myArchiveFile.getArchiveID(); var myCrawledLink[] = myArchiveFile.getCrawledLinks(); var myDownloadLink[] = myArchiveFile.getDownloadLinks(); var myString = myArchiveFile.getFilePath(); var myLong = myArchiveFile.getFileSize(); var myString = myArchiveFile.getName(); var myFilePath = myArchiveFile.getPath(); myArchiveFile.invalidateExists(); var myBoolean = myArchiveFile.isComplete(); var myBoolean = myArchiveFile.isMissingArchiveFile(); var myBoolean = myArchiveFile.isPartOfAnArchive(); /* === Browser === */ /* ========= Methods =========*/ var myBrowser = myBrowser.cloneBrowser(); var myInt = myBrowser.getConnectTimeout(); var myLong = myBrowser.getContentLength(); var myString = myBrowser.getContentType(); var myString = myBrowser.getCookie(myString, myString); var myBoolean = myBrowser.getDefaultSSLTrustALL(); myBrowser.getDownload(myString, myString); var myString = myBrowser.getHTML(); var myInt = myBrowser.getLoadLimit(); var myString = myBrowser.getPage(myString); var myInt = myBrowser.getReadTimeout(); var myString = myBrowser.getRedirectLocation(); var myString = myBrowser.getRequestMethod(); var myLong = myBrowser.getRequestTime(); var myInt = myBrowser.getResponseCode(); var myString = myBrowser.getResponseHeader(myString); var myMap = myBrowser.getResponseHeaders(); var myString = myBrowser.getURL(); var myString = myBrowser.headPage(myString); var myBoolean = myBrowser.isFollowingRedirects(); var myBoolean = myBrowser.isSSLTrustALL(); var myString = myBrowser.postPage(myString, myString); myBrowser.setConnectTimeout(myInt); myBrowser.setCookie(myString, myString, myString); myBrowser.setDefaultSSLTrustALL(myBoolean); myBrowser.setFollowRedirects(myBoolean); myBrowser.setHeader(myString, myString); myBrowser.setLoadLimit(myInt); var myBoolean = myBrowser.setProxy(myString); myBrowser.setReadTimeout(myInt); /* === ConditionalSkipReason === */ /* ========= Methods =========*/ var myString = myConditionalSkipReason.getClassName(); var myDownloadLink = myConditionalSkipReason.getDownloadLinkCondition(); var myString = myConditionalSkipReason.getMessage(); var myLong = myConditionalSkipReason.getTimeOutLeft(); var myLong = myConditionalSkipReason.getTimeOutTimeStamp(); var myString = myConditionalSkipReason.getWaitingSkipReason(); var myBoolean = myConditionalSkipReason.isConditionReached(); var myBoolean = myConditionalSkipReason.isDownloadLinkCondition(); var myBoolean = myConditionalSkipReason.isTimeOutCondition(); /* === CrawledLink === */ /* The context linkgrabber list link*/ /* ========= Methods =========*/ var myLong = myCrawledLink.getAddedDate(); var myArchive = myCrawledLink.getArchive(); var myString = myCrawledLink.getArchiveID(); var myString = myCrawledLink.getAvailableState(); var myLong = myCrawledLink.getBytesTotal(); var myLong = myCrawledLink.getBytesTotalVerified(); var myString = myCrawledLink.getComment(); var myString = myCrawledLink.getContainerURL(); var myString = myCrawledLink.getContentURL(); var myString = myCrawledLink.getDownloadHost(); var myDownloadLink = myCrawledLink.getDownloadLink(); var myString = myCrawledLink.getDownloadPath(); var myString = myCrawledLink.getFinalName(); var myString = myCrawledLink.getForcedName(); var myString = myCrawledLink.getHashInfo(); var myString = myCrawledLink.getHost(); var myString = myCrawledLink.getLinkID(); var myLinkInfo = myCrawledLink.getLinkInfo(); var myString = myCrawledLink.getName(); var myString = myCrawledLink.getOriginURL(); var myCrawledPackage = myCrawledLink.getPackage(); var myString = myCrawledLink.getPluginURL(); var myString = myCrawledLink.getPriority(); var myMap = myCrawledLink.getProperties(); var myObject = myCrawledLink.getProperty(myString); var myString = myCrawledLink.getReferrerURL(); var myObject = myCrawledLink.getSessionProperty(myString); var myCrawlerJob = myCrawledLink.getSourceJob(); var myString = myCrawledLink.getUUID(); var myString = myCrawledLink.getUrl(); var myBoolean = myCrawledLink.isEnabled(); var myBoolean = myCrawledLink.isNameSet(); var myBoolean = myCrawledLink.isPartOfAnArchive(); var myBoolean = myCrawledLink.remove(); myCrawledLink.setComment(myString); myCrawledLink.setEnabled(myBoolean); myCrawledLink.setName(myString/*new Name*/);/*Sets a new filename*/ myCrawledLink.setPriority(myString); myCrawledLink.setProperty(myString, myObject); myCrawledLink.setSessionProperty(myString, myObject); var myString = myCrawledLink.toString(); /* === CrawledPackage === */ /* The context linkgabber list package*/ /* ========= Methods =========*/ var myLong = myCrawledPackage.getAddedDate(); var myArchive[] = myCrawledPackage.getArchives(); var myLong = myCrawledPackage.getBytesTotal(); var myString = myCrawledPackage.getComment(); var myString = myCrawledPackage.getDownloadFolder(); var myCrawledLink[] = myCrawledPackage.getDownloadLinks(); var myLong = myCrawledPackage.getModifiedDate(); var myString = myCrawledPackage.getName(); var myString = myCrawledPackage.getPriority(); var myString = myCrawledPackage.getUUID(); var myInt = myCrawledPackage.indexOf(myCrawledLinkSandbox); var myBoolean = myCrawledPackage.isExpanded(); var myBoolean = myCrawledPackage.remove(); myCrawledPackage.setComment(myString); myCrawledPackage.setDownloadFolder(myString); myCrawledPackage.setExpanded(myBoolean); myCrawledPackage.setName(myString); myCrawledPackage.setPriority(myString); var myString = myCrawledPackage.toString(); /* === CrawlerJob === */ /* ========= Methods =========*/ var myList = myCrawlerJob.getArchivPasswords(); var myString = myCrawlerJob.getOrigin(); var myString = myCrawlerJob.getPassword(); var myString = myCrawlerJob.getSourceUrl(); var myString = myCrawlerJob.getText(); var myString = myCrawlerJob.getUUID(); var myBoolean = myCrawlerJob.isAssignJobID(); var myBoolean = myCrawlerJob.isDeepAnalysisEnabled(); var myBoolean = myCrawlerJob.isOverwritesPackagizerRulesEnabled(); myCrawlerJob.setAssignJobID(myBoolean); myCrawlerJob.setDeepAnalysisEnabled(myBoolean); myCrawlerJob.setPassword(myString); myCrawlerJob.setText(myString); /* === DownloadLink === */ /* The context download list link*/ /* ========= Methods =========*/ myDownloadLink.abort(); var myLong = myDownloadLink.getAddedDate(); var myArchive = myDownloadLink.getArchive(); var myString = myDownloadLink.getArchiveID(); var myString = myDownloadLink.getAvailableState(); var myLong = myDownloadLink.getBytesLoaded(); var myLong = myDownloadLink.getBytesTotal(); var myLong = myDownloadLink.getBytesTotalVerified(); var myString = myDownloadLink.getComment(); var myConditionalSkipReason = myDownloadLink.getConditionalSkipReason(); var myString = myDownloadLink.getContainerURL(); var myString = myDownloadLink.getContentURL(); var myLong = myDownloadLink.getDownloadDuration(); var myString = myDownloadLink.getDownloadHost(); var myString = myDownloadLink.getDownloadPath(); var myHTTPProxy = myDownloadLink.getDownloadProxy(); var myLong = myDownloadLink.getDownloadSessionDuration(); var myLong = myDownloadLink.getDownloadTime(); var myLong = myDownloadLink.getEta(); var myString = myDownloadLink.getExtractionStatus(); var myString = myDownloadLink.getFinalLinkStatus(); var myString = myDownloadLink.getFinalName(); var myLong = myDownloadLink.getFinishedDate(); var myString = myDownloadLink.getForcedName(); var myString = myDownloadLink.getHashInfo(); var myString = myDownloadLink.getHost(); var myString = myDownloadLink.getLinkID(); var myLinkInfo = myDownloadLink.getLinkInfo(); var myString = myDownloadLink.getName(); var myString = myDownloadLink.getOriginURL(); var myFilePackage = myDownloadLink.getPackage(); var myString = myDownloadLink.getPluginURL(); var myString = myDownloadLink.getPriority(); var myMap = myDownloadLink.getProperties(); var myObject = myDownloadLink.getProperty(myString); var myString = myDownloadLink.getReferrerURL(); var myObject = myDownloadLink.getSessionProperty(myString); var myString = myDownloadLink.getSkippedReason(); var myLong = myDownloadLink.getSpeed(); var myString = myDownloadLink.getStatus(); var myMap = myDownloadLink.getTempProperties(); var myObject = myDownloadLink.getTempProperty(myString); var myString = myDownloadLink.getUUID(); var myString = myDownloadLink.getUrl(); var myBoolean = myDownloadLink.isAborting(); var myBoolean = myDownloadLink.isActive(); var myBoolean = myDownloadLink.isEnabled(); var myBoolean = myDownloadLink.isFinished(); var myBoolean = myDownloadLink.isPartOfAnArchive(); var myBoolean = myDownloadLink.isResumeable(); var myBoolean = myDownloadLink.isRunning(); var myBoolean = myDownloadLink.isSkipped(); var myBoolean = myDownloadLink.remove(); myDownloadLink.reset(); myDownloadLink.resume(); myDownloadLink.setComment(myString); myDownloadLink.setEnabled(myBoolean); myDownloadLink.setName(myString/*new Name*/);/*Sets a new filename*/ myDownloadLink.setPriority(myString); myDownloadLink.setProperty(myString, myObject); myDownloadLink.setSessionProperty(myString, myObject); myDownloadLink.setSkipped(myBoolean); myDownloadLink.setTempProperty(myString, myObject); var myString = myDownloadLink.toString(); /* === Environment === */ /* ========= Methods =========*/ var myString = myEnvironment.getARCHFamily(); var myLong = myEnvironment.getJavaVersion(); var myString = myEnvironment.getNewLine(); var myString = myEnvironment.getOS(); var myString = myEnvironment.getOSFamily(); var myString = myEnvironment.getPathSeparator(); var myBoolean = myEnvironment.is64BitArch(); var myBoolean = myEnvironment.is64BitJava(); var myBoolean = myEnvironment.is64BitOS(); var myBoolean = myEnvironment.isBSD(); var myBoolean = myEnvironment.isHeadless(); var myBoolean = myEnvironment.isLinux(); var myBoolean = myEnvironment.isMac(); var myBoolean = myEnvironment.isWindows(); /* === FilePackage === */ /* The context download list package*/ /* ========= Methods =========*/ var myLong = myFilePackage.getAddedDate(); var myArchive[] = myFilePackage.getArchives(); var myLong = myFilePackage.getBytesLoaded(); var myLong = myFilePackage.getBytesTotal(); var myString = myFilePackage.getComment(); var myString = myFilePackage.getDownloadFolder(); var myDownloadLink[] = myFilePackage.getDownloadLinks(); var myLong = myFilePackage.getFinishedDate(); var myLong = myFilePackage.getModifiedDate(); var myString = myFilePackage.getName(); var myString = myFilePackage.getPriority(); var myMap = myFilePackage.getProperties(); var myObject = myFilePackage.getProperty(myString); var myString = myFilePackage.getUUID(); var myInt = myFilePackage.indexOf(myDownloadLinkSandBox); var myBoolean = myFilePackage.isExpanded(); var myBoolean = myFilePackage.isFinished(); var myBoolean = myFilePackage.remove(); myFilePackage.setComment(myString); myFilePackage.setDownloadFolder(myString); myFilePackage.setExpanded(myBoolean); myFilePackage.setName(myString); myFilePackage.setPriority(myString); myFilePackage.setProperty(myString, myObject); var myString = myFilePackage.toString(); /* === FilePath === */ /* ========= Methods =========*/ var myBoolean = myFilePath.copyTo(myString); var myBoolean = myFilePath.copyTo(myString, myString, myBoolean); var myBoolean = myFilePath.delete(); var myBoolean = myFilePath.deleteRecursive(); var myBoolean = myFilePath.exists(); var myString = myFilePath.getAbsolutePath(); var myFilePath[] = myFilePath.getChildren(); var myLong = myFilePath.getCreatedDate(); var myString = myFilePath.getExtension(); var myLong = myFilePath.getFreeDiskSpace(); var myLinkInfo = myFilePath.getLinkInfo(); var myLong = myFilePath.getModifiedDate(); var myString = myFilePath.getName(); var myFilePath = myFilePath.getParent(); var myString = myFilePath.getPath(); var myString = myFilePath.getPathSeparator(); var myLong = myFilePath.getReservedDiskSpace(); var myLong = myFilePath.getSize(); var myBoolean = myFilePath.isDirectory(); var myBoolean = myFilePath.isFile(); var myBoolean = myFilePath.mkdirs(); var myBoolean = myFilePath.moveTo(myString); var myFilePath = myFilePath.rename(myString); var myFilePath = myFilePath.renameName(myString); var myFilePath = myFilePath.renamePath(myString); var myBoolean = myFilePath.renameTo(myString); var myString = myFilePath.toString(); /* === HTTPProxy === */ /* ========= Methods =========*/ var myString = myHTTPProxy.getHost(); var myString = myHTTPProxy.getPassword(); var myInt = myHTTPProxy.getPort(); var myString = myHTTPProxy.getType(); var myString = myHTTPProxy.getUsername(); var myInt = myHTTPProxy.indexOf(); var myBoolean = myHTTPProxy.isEnabled(); var myBoolean = myHTTPProxy.remove(); myHTTPProxy.setEnabled(myBoolean); var myString = myHTTPProxy.toExportString(); /* === LinkInfo === */ /* ========= Methods =========*/ var myString = myLinkInfo.getDesc(); var myString = myLinkInfo.getGroup(); var myInt = myLinkInfo.getPartNum(); var myString = myLinkInfo.name(); /* === ModifyLock === */ /* ========= Methods =========*/ var myBoolean = myModifyLock.readLock(); myModifyLock.readUnlock(myBoolean); myModifyLock.writeLock(); myModifyLock.writeUnlock(); // ========= Properties for the EventTrigger 'A Download stopped' ========= var myHTTPProxy = proxy; var myFilePackage = package; var myDownloadLink = link;