NGDesktop Utils (ref)
(part of package 'NGDesktop Utils')
You can access it in code via: plugins.ngdesktoputils
API
executeCommand(program,args)
Executes a command async, the server side call will not block on this call.
Parameters:
{String} program The executable or command to run.
{Array<object>} args An array of arguments to pass to the command.
executeCommandSync(program,args)
This executes a command and returns the result of the stdout This will also call reject when a error happens so the call will error out. (will not return correct) Try to use the async executeCommand so nothing will be blocking.
Parameters:
{String} program The executable or command to run.
{Array<object>} args An array of arguments to pass to the command.
Returns: String The standard output result of the executed command.
exit()
This will close the NGDesktop main application. Be sure you will call this and after this call application.exit() to close also the client directly itself.
getClipboardContent()
Get clipboard text.
Returns: String The current text content stored in the clipboard.
getDefaultPrinter()
Returns default printer on local machine.
Returns: CustomType<ngdesktoputils.printer> The default printer object.
getPrinters()
Returns installed printers on local machine.
Returns: Array<CustomType<ngdesktoputils.printer>> An array of printer objects representing installed printers.
getSystemInformation()
Retrieve information from the ngdesktop client
Returns: CustomType<ngdesktoputils.sysinfo> An object containing the client's system information: ngDesktopVersion - string: ngdesktop version osPlatform - string: can be 'darwin', 'linux', 'freebsd', 'openbsd' and 'win32' osRelease - string: kernel release number osTotalMem - long: total system's memory osFreeMem - long: total available memory
isNGDesktop()
Whether application is running as NGDesktop.
Returns: Boolean True if the application is running in NGDesktop mode; otherwise, false.
printPDF(path,options)
Prints a pdf document specified by path. Optionally, specify printer or unix print options (lp command) or windows print options see: https://github.com/Servoy/pdf-to-printer
Parameters:
{String} path The file path of the PDF document to be printed.
{CustomType<ngdesktoputils.printoptions>} [options] Optional print settings, including printer selection and specific print parameters for Unix (lp command) or Windows.
setClipboardContent(text)
Set clipboard text.
Parameters:
{String} text To be set in clipboard
showExternal(url)
Manage URLs using their default applications
Parameters:
{String} url The URL to be opened in the default web browser or application.
Types
printer
scripting type: CustomType<ngdesktoputils.printer>
printoptions
scripting type: CustomType<ngdesktoputils.printoptions>
sysinfo
scripting type: CustomType<ngdesktoputils.sysinfo>
electronVersion
Type: string
ngDesktopVersion
Type: string
osFreeMem
Type: long
osPlatform
Type: string
osRelease
Type: string
osTotalMem
Type: long
Last updated
Was this helpful?