Jive codin'


In terms of "coding skills", I am almost at level zero. The extent of my knowledge is a little bit of BASIC; a little bit of MPALC; a little bit of ladder diagrams; a little bit of STEP5 and a tiny bit of 8085 assembler. I did have a ZX81 and a TI99 long ago (man am I sore now about getting rid of those) but missed the gaming boat by a thousand miles but the radio bug bit me instead.

A while ago I needed to add a ton of channels to a radio codeplug. As you all know, this can be a pain in the ____. Using Google Gemini and Canvas, I created a JavaScript that runs in Google Sheets that will take a list of frequencies and convert it into XML that you can paste into the codeplug. I know almost nothing about JavaScript so all of this was done using "jive coding".

When I was in Gdynia a few weeks ago, the workshop attendees asked about this.
  1. To use this, you will need:
  2. A Google account (easy enough) and will need to be signed in.
  3. A copy of this script.
  4. To create a Google Sheet called channel_list - save this in your Google Drive (root folder a.k.a. My Drive).
  5. Save this copy of zone_data.xml to your Google Drive in the same location as the above Google Sheet. This is basically a seed file so that all the variables get populated in the resultant file.
  6. A radio codeplug which you want to add the channels to. This codeplug must have entries in the contact list appears in column 4 of the Google Sheet (CP_UKPPERS) - see below.
  7. You can make a copy of this Google Sheet to use as a pre-populated example to try out for yourself.
  8. In the Google Sheet you created, you will need four columns:
    aliasCP_TXFREQCP_RXFREQCP_UKPPERS
  9. Column 1 should be formatted as text. This is the name you want to appear on the radio display.
  10. Column 2 (CP_TXFREQ) is the transmit frequency with a dot as the decimal separator.
  11. Column 3 (CP_RXFREQ) is the receive frequency also with a dot as the decimal separator.
  12. Column 4 (CP_UKPPERS) is the TX Contact. This text needs to match one of the entries you already have in the targeted codeplug's contact list.
  13. Column 2 and 3 should be formatted as a number.
  14. In the channel_list Google Sheet, on the top menu, click Extensions >> Apps Script. 
  15. Delete any code in the editor and paste the script mentioned in step 2.
  16. Give the script a name (e.g. XML Merge) though this does seem to be important.
  17. Click the Save icon (floppy disk).
  18. Click the Run button at the top.
  19. The first time you run this, Google will ask for permission to access your Drive and Sheets. You will need to click "Review permissions," select your account, click "Advanced," and then "Go to project (unsafe)" to allow it.
  20. It will take a minute or so and at the end it will show " Notice  Execution completed".
  21. Go to your Google Drive. There you will find a file called zone_data_updated.xml. Download this file to your PC.
  22. Open the downloaded zone_data_updated.xml, using your favourite text editor, select all of the contents and copy it (Ctrl+A, Ctrl+C)
  23. Go to the target codeplug expand the Zone Channel Assignment branch, right-button click on Zone (not one of the Zones) and click Paste.


  24. The CPS (or RM) will do some thinking stuff et puis voila!
The way that its set up now, the channels will be pasted into Zone1. If you don't want that, you will need to change the following lines in the generated zone_data_updated.xml to match the zone name where the channels should go.

<set alias="Zone1" key="NORMAL" name="Zone"> (line 4)
<field name="ZP_ZONEALIAS">Zone1</field> (7th last line)

It's very rough at the edges but it done what I needed it to do. Hopefully this can help you get a few minutes or hours of your life back.

Comments and bug reports are welcome. You are also welcome to make improvements.




Powered by Blogger.