Script command is not supported by device (JS)

NL
Nicolas LE BIHAN
SYSTEME U CENTRALE NATIONALE

Hi, 

I am having trouble using JS scripts sent to terminals from a package created from McStudio.15.4.1.
What I don't understand is that the same script sent from the WEB console is working, but when it is sent from a PKG I get an error per line of my script in the log.
Below is my script:

#!/usr/bin/env js
var buttonLabels = ['PDV', 'Entrepôt']
var file = new mobicontrol.io.File('/sdcard/EnvironnementInfo.ini');

mobicontrol.message.createInfoDialog('Sélectionner un environement.')
    .withButtons(buttonLabels[0], buttonLabels[1])
    .withWarnIcon()
    .withTitle('Préparation terminaux')
    .withCallback(onConfirm).show();

function onConfirm(result) {
if (result.buttonIndex != null){

file.writeText('[EnvironnementInfo]'
+ '\nEnvironnementInfo = ' + buttonLabels[result.buttonIndex]);

mobicontrol.log.info('EnvironnementInfo:' + buttonLabels[result.buttonIndex]);
mobicontrol.log.info('File exists');
mobicontrol.agent.checkIn()
}
}

Any idea ?

4 years ago
SOTI MobiControl
ANSWERS