A way to write Kustom presets in XML.
-
Get kml2kclip.exe from the releases tab of this repository.
-
Get kml-schema.xsd from here and attach it to your XML editor of choice. Instructions for Visual Studio and VSCode below.
-
In your xml editor of choice, write a preset and save it in a file. I'd recommend using
.xmlas the extension, just so you don't have to manually bind.kmlto an xml editor. -
Run
kml2kclip.exefrom the console, passing the XML file as stdin or with the -in argument.
-
stdio:
kml2kclip <kmlfile.xml >kclip.txt -
args:
kml2kclip -in kmlfile.xml -out kclip.txtThe program will compile your XML into a kustom clipboard JSON and put it in the file specified (or into the console, if no file was specified!) I would recommend against using
.jsonas your output file extension, since it will include##KUSTOMCLIP##at the beginning and end, which will make it light up red in a JSON editor.
-
Put the compiled kustom clipboard JSON into your mobile device's clipboard. You can do this with Pushbullet, through a Google Keep note, whatever you want.
-
Go into a Kustom app of your choice and hit paste.
VSCode
-
Get the VSCode XML by Red Hat extension (you can easily find it by typing "xml" into the extension search box).
-
After you created your xml document, at the top of it, below
<?xml version="1.0"?>put
<?xml-model href="D:\path\to\schema\kml-schema.xsd"?>Of course putting the correct schema path in the href attribute.
Visual Studio
-
Open the XML file you wish to edit.
-
In the properties window, select
Schemasand click the...button. -
Click
Addon the right side, then select the.xsdfile from your file system. If you added the file before, it should appear on the list, in that case, select itsUsecell and selectUse this schemafrom the dropdown.
-
Open the folder containing your KML file in VSCode.
-
Hit
Ctrl + Shift + Pto open the Command Palette. -
Find
Tasks: Configure Default Build Task, hit enter, then enter again. From the list that pops up, selectOther. VSCode will createtasks.jsonfor you. -
Edit the only task in the file:
- the label can be whatever you want it to be
- the type must be
shell - the command should be
.\\kml2kclip -in kml-preset.xml -out kclip.txt, or something similar.- this assumes
kml2kclip.exeis in the same folder as your KML file. if that's not the case, you'll need to include a path to it, or add it's containing folder to PATH. .\\is there because of powershell- I had to make
-inand-outwork because of powershell too - why doesn't powershell support
<and>for stdio???
- this assumes
- After that, hit open the Command Palette again and execute
Tasks: Configure Default Build Taskagain. Your task should pop up, press enter and you're good to go. From now on,Ctrl + Shift + Bshould compile the kml file.