Use Case: We are wanting our custom attribute to update with the user everytime a new user logs into velocity.
I have this working manually but trying to automate the js file using file sync. Velocity needs to read in the MAC address for each device. I have the .js script, that when sent manually will create the folder sdcard/com.wavelink.velocity and put the file into it containing the mac address (DeviceInfo.txt). Velocity file assisant will move it from there.
I saved the js in a file (GetMAC.js) and have the file syncing to my device but i am unsure how to execute the file so it will do what I have already done manually.
How do I execute this file. or is there a better way to do this altogether? should i put this script in the file sync itself? what would i specify for folder paths is there is none?
JSScript:
var folderPath = '/sdcard/com.wavelink.velocity'; var deviceMAC = mobicontrol.device.macAddress; // ----- Folder check with logging ----- var foldercheck = new mobicontrol.io.File(folderPath); if (foldercheck.exists) { mobicontrol.log.info('Folder exists'); } else { mobicontrol.log.info('Folder does not exist, writing folder to sdcard'); new mobicontrol.io.File(folderPath).createDirectory(); }
// ----- Write txt ----- var txtFile = new mobicontrol.io.File(folderPath + '/DeviceInfo.txt'); txtFile.writeText(deviceMAC); mobicontrol.log.info('DeviceInfo.txt written successfully');

