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
{Array<Object>} args
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 command to be executed
{Array<Object>} args The command arguments
Returns: String The result from standard output.
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 clipboard text.
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.
getSystemInformation()
Retrieve information from the ngdesktop client
@return {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 memoryReturns: CustomType<ngdesktoputils.sysinfo> an object containing the client's system information:ngDesktopVersion - string: ngdesktop versionosPlatform - string: can be 'darwin', 'linux', 'freebsd', 'openbsd' and 'win32'osRelease - string: kernel release numberosTotalMem - long: total system's memoryosFreeMem - long: total available memory
isNGDesktop()
Whether application is running as NGDesktop.
Returns: Boolean True if app running inside NGDesktop, false otherwise.
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
{CustomType<ngdesktoputils.printoptions>} [options]
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.
Types
printer
Contains printer information. scripting type: CustomType<ngdesktoputils.printer>
- deviceId - The device identifier for the printer. 
- Type: string 
 
- name - The name of the printer. 
- Type: string 
 
- paperSizes - An array of supported paper sizes. 
- Type: string[] 
 
printoptions
Contains print options for different platforms. scripting type: CustomType<ngdesktoputils.printoptions>
- printer - The printer identifier or name to use. 
- Type: string 
 
- unix - An array of Unix-specific printing options. 
- Type: string[] 
 
- win32 - An array of Windows-specific printing options. 
- Type: string[] 
 
sysinfo
Contains system information from the NGDesktop client. scripting type: CustomType<ngdesktoputils.sysinfo>
- electronVersion - The version of Electron used by NGDesktop. 
- Type: string 
 
- ngDesktopVersion - The NGDesktop version. 
- Type: string 
 
- osFreeMem - The available (free) system memory in bytes. 
- Type: long 
 
- osPlatform - The operating system platform (e.g. 'darwin', 'win32', etc.). 
- Type: string 
 
- osRelease - The operating system release version. 
- Type: string 
 
- osTotalMem - The total system memory in bytes. 
- Type: long 
 
Last updated
Was this helpful?
