Convert Client Setting Data to Hex and Write to Registry

We have defined numerous client settings including things like location and function of machines. Those values are written as BESClient settings so they are easy to retrieve from various OS.
I’d like the ability to pull multiple different client settings, convert the strings to hex, separate each character by hex value 00, and then write the multiple hex words separated by 00 2c 00 ( , ) to a different location in the registry on Windows or as a file on Linux.

So if I pull a value of “Office” and a value of “Sales” from a machine, then I’d like to write those 2 values as hex to a registry key in this format: 4f 00 66 00 66 00 69 00 63 00 65 00 2c 00 53 00 61 00 6c 00 65 00 73 00 00 00

The final 3 null values represent the end of the data.

I can read in the client settings, and I can read the hex values from the target location.

I’m looking for some help with ActionScript to automate this work of pulling specified client settings and then writing them as Hex to the specific location.

I’m afraid I can’t dedicate time on it at the moment, but I’d check whether the ‘reg add’ command does any of that encoding for you; and if it needs to be done in Relevance directly, this tip may help you get started Strings, Hexadecimal, and ASCII Values

Thanks for the quick reply. I had reviewed that page as part of my initial research and I’m using that in development. The suggestion of using reg add is something I hadn’t considered. I’ll start playing with that.

Try something like this - this is the Windows version, for *Nix just change the paths. One thing I would advise you is that not sure you will be able to control the order of the values… on one machine it may be office 00 sales, on another it may be sales 00 office, so not sure if you are pulling a lot of settings how good that data will be. If I was you, I’d seriously rethink the final format in favour of something key-value-based (json, ini, etc). Also, certainly change the relevance clause to specify exactly which client settings you want extracted… There are a TON of client settings that the client itself sets/uses, and if you extract everything with no filter it will be something gigantic in size. Last but NOT least, the relevance to convert the data is a massive string - strings in relevance are limited to 512 characters… if the data you are extracting is MORE characters, you may need apply logic to split it across multiple lines manually (add multiple appendfile statements with only a few client settings on each that you know would be below 512 characters).

delete __appendfile 
delete "{(value of variable "windir" of environment) & "\Temp\file.txt"}" 

appendfile {concatenation " 00 " of (concatenation " " of (it as string) of (it as hexadecimal) of characters of it) of values of settings whose (name of it starts with "some-criteria") of client}

move __appendfile "{(value of variable "windir" of environment) & "\Temp\file.txt"}"