Page 1 of 1

Generate a UUID For Use in XML?

Posted: Fri Mar 23, 2018 10:28 pm
by rgpepper
I need to provide a UUID in an XML file I'm thinking I'll be able to generate using "Make XML". But I'm not seeing anything about actually generating one within (and for use within) Switch.

Re: Generate a UUID For Use in XML?

Posted: Mon Mar 26, 2018 12:00 pm
by Padawan
Switch doesn't provide any functionality to create UUID's that I'm aware of. Possible solutions I see are:

- Write functionality in Switch Javascript to create them (based on Math.Random())
The following page can give some inspiration:
https://stackoverflow.com/questions/105 ... javascript

- Use a command line tool to generate the UUID and get the communicate with the command line tool via Switch Javascript
On mac you can run the pre-installed "uuidgen" command
On Windows you can try to use something like this:
POWERSHELL -COMMAND "$([guid]::NewGuid().ToString())"
(I have not tested this command in Switch yet, you might need to have the full path to powershell)

Re: Generate a UUID For Use in XML?

Posted: Mon Mar 26, 2018 12:36 pm
by r.zegwaard
WIth the global data in a switch-script, you can quite easy create counter as a uuid.
See: http://www.enfocus.com/manuals/Develope ... /home.html