/*! \copyright Sertainty Corporation, 2020. All Rights Reserved. \file sample_config.uxl \brief Sample program using UXL that demonstrates fetching current machine's location information using the Sertainty SDK. Similarly, machine's network interface information can also be fetched from the machine's configuration. This sample only demonstrates location information for brevity. \author Melvin Valdez de la Roca \date 07/15/2020 \note Application expects to find the necessary source files in the current working folder. */ replace procedure sample_config() { bytearray buffer; string outputFile = "machine_configuration.txt"; int loc1, loc2, fe; string location, zipcode; printf("\nSample UXL Config/Location Application\n\n"); fe = file::exists(outputFile); if (fe) { file::remove(outputFile); } /* Load the current machine configuration to extract location and network information from */ x::setOutput(outputFile); x::showConfiguration(); if (errorstring) { printf("Error getting Config: %1\n", errorstring); } x::cancelOutput(); /* Extract location config from machine config */ buffer = file::readAll(outputFile); if (errorstring) { printf("Error reading file to buffer: %1\n", errorstring); } loc1 = locate(buffer, " Address"); location = substr(buffer, loc1, 10000); /* Get the Zipcode from location config */ loc2 = locate(location, " Zipcode"); zipcode = substr(location, loc2 + 19, 5); printf(concat("\n Zipcode Property from location: ", zipcode)); printf("%1\n", location); printf("\nSample finished running\n"); return 0; } sample_config();