-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvelocity-script-lauch-zebra-dimensioning.js
42 lines (36 loc) · 1.27 KB
/
velocity-script-lauch-zebra-dimensioning.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Logger.debug("ZEBRA Dimensioning - Launch");
//Create the values that will be passed to the action.
var actionName = "com.spozebra.zebradimensioningactivityforresult.MainActivity";
//Use either action, class and package, or both. Define extras with a name, value, and type.
//var intent = { action: actionName, extras: [ ] };
var intent = {
action: 'android.intent.action.MAIN',
package: "com.spozebra.zebradimensioningactivityforresult",
class: "com.spozebra.zebradimensioningactivityforresult.MainActivity",
};
//Launch the action and mark the input as handled.
Action.launchForResult(intent, function (intent) {
Logger.debug("Intent = " + JSON.stringify(intent));
if (intent.result == -1) {
var length = 0;
var width = 0;
var height = 0;
var extras = intent.extras
for (pos in extras) {
Logger.debug("Extra = " + JSON.stringify(extras[pos]));
if (extras[pos].name == "length") {
length = extras[pos].value;
}
else if (extras[pos].name == "width") {
width = extras[pos].value;
}
else if (extras[pos].name == "height") {
height = extras[pos].value;
}
}
Logger.debug("ZEBRA Dimensioning - Launch - Script Success");
var volume = length * width * height;
Device.sendKeys(volume);
}
});
Logger.debug("ZEBRA Dimensioning - Launch Ended");