UNE provides an application action framework based on messages/signals. It is possible to pass these as instructions to the application. There is a very rich set of instructions which may be passed.
When using the Run action task, a script must be provided that returns a single instruction or an array of instructions. The instructions will be executed in sequence.
For example the following script will pan the map to a point and open the find panel:
// Run an action.
// Pan to a location and change tool.
return [
{
command: "panto",
geometry: Point({ x: 1000, y: 1000, spatialReference: { wkid: 102100 } }),
flash: true
},
{
command: "openpanel",
panel: "panel.find" // Other examples "panel.[Custom Panel]" | 'panel.basemaps' | 'panel.plans' | 'panel.levels' |
// 'panel.effects' | 'panel.protect' | 'panel.stencils' | 'panel.find' | 'panel.connectivity' |
// 'panel.layers' | 'panel.selection' | 'panel.attributes' | 'panel.actions' | 'panel.messages' |
// 'panel.dfeedback'
}
];
Another example is zooming in on a feature from the search bar. This is achieved by adding a button to the find panel and adding the below code:
return {
command: "zoomto",
geometry: Extent(buffer($action.matchedlocationgeometry,50,"m"))
};
Copy Coordinates to Clipboard
This script allows you to create a custom action within the Look and Feel – Keyboard Shortcuts.
Sends the mouse Eastings/Northings position to clipboard.
// Define XY information
var cursorDetails = State("cursorPoint");
var xValue = Round(cursorDetails.x);
var yValue = Round(cursorDetails.y);
var clipboardText = `${xValue}${yValue}`;
// Return values as a message
return [{
command: "set-clipboard",
textvalue: clipboardText
}];
See Application Actions section for a list of possible actions.