zaphod Posted March 10, 2021 Share Posted March 10, 2021 I have written a Python script to easily make C4 drivers with customized icons by altering the stock Control4 Scenario Experience driver. This involves unzipping a C4Z file, changing the icon image files, and making slight alterations to the XML file before rezipping it. This script automates all of that and outputs a new C4Z driver file that can be added to your project by your dealer via Composer Pro. You just need to provide an image file to start with - ideally a PNG file that is about 1024x1024. (Smaller image files were working but some icons might look stretched.) After the new driver file is added to your sytem you can then use Composer HE to decide what screens to display these in, and Favoriting in Navigator to put these buttons on (almost) any screen that you want and tie them to any task in C4. You will need Python 3, but it should work in Windows, Linux and WSL. (If you are running Linux under Windows 10 then you should have Python already installed on that. If you have Windows 10 I would highly recommend installing Ubuntu so that you have a Linux system running inside of Windows 10). Instructions on how to do all of this are in a Readme file and in comments in the Python file. In theory the script should work on Macs as well but I don't have a Mac to test. Download the file from Github: https://github.com/zaphodb65/C4driverbuilder The final result will look like this. (This is from the C4 app on an iPad) milehighguy, PorterTX, DLite and 4 others 5 2 Quote Link to comment Share on other sites More sharing options...
RAV Posted March 10, 2021 Share Posted March 10, 2021 Very cool. I had a couple issues following your instructions, maybe it was me, I don't know python, but I'll include here how I got it to work, if anyone else runs into them. Prep Download Python 3.9 Run installer Check “add Python to Path” during installation Open a Command Prompt Type “python -m pip install pillow” Close Command Prompt Create new folder in root of c drive “c4dm” Copy in script and original experience driver Ready Create image file 1024 x 1024 PNG Save with a simple name in folder c4md, this will be the new drivers name Create a second selected image file, name it "xxx_selected.png" where xxx is the first png files name (If no second image, then primary image will be used for both.) Open command prompt Type "CD \c4dm" Type “python c4driver.py xxx” where xxx is the png files name Quote Link to comment Share on other sites More sharing options...
HRT Posted March 10, 2021 Share Posted March 10, 2021 haven't fully looked at this, but very cool idea. Question, are you altering the file name, creator, version, to reflect what the driver is and if you have different versions of it? Quote Link to comment Share on other sites More sharing options...
RAV Posted March 10, 2021 Share Posted March 10, 2021 MY BAD - ignore. Zaphod, For a two image icon, could you modify the script into two steps? Script 1 would create the default image Script 2 would add the selected image to part 1 and package the driver I haven't tried, but I suspect, I could run the script and create 2 new buttons, then replace the default icons of button 2 with the default set from button 1. Quote Link to comment Share on other sites More sharing options...
zaphod Posted March 10, 2021 Author Share Posted March 10, 2021 14 minutes ago, HRT said: haven't fully looked at this, but very cool idea. Question, are you altering the file name, creator, version, to reflect what the driver is and if you have different versions of it? In the XML file I am chaging the name, created and modified date XML fields - plus the references to the png image files. Everything else is unchanged. If you run this multiple times with different for different icons, which I have, you will have different files. So I didn't bother playing around with versions. The name gets changed to the name of your image file. So in the case of the "stones" the driver has a name of stones and the file is stones.c4z. Quote Link to comment Share on other sites More sharing options...
zaphod Posted March 10, 2021 Author Share Posted March 10, 2021 14 minutes ago, RAV said: Zaphod, For a two image icon, could you modify the script into two steps? Script 1 would create the default image Script 2 would add the selected image to part 1 and package the driver I haven't tried, but I suspect, I could run the script and create 2 new buttons, then replace the default icons of button 2 with the default set from button 1. I don't quite understand what you mean by create the default image for Script 1 above? You may have missed this in the instructions but if you have two files called myimage.png and myimage_selected.png then it will use them both when creating the driver file. The script looks for a _selected.png file and if it doesn't find one then it uses the same image for both. But it will use a selected image if you have provided one. One other thing I could do is to create an inverted image. The Pillow commands include one called invert. But that may not give a very useful image. Quote Link to comment Share on other sites More sharing options...
zaphod Posted March 10, 2021 Author Share Posted March 10, 2021 FYI, for the Rolling Stones logo I manually swapped a few colours to create the selected file. So here is it unselected and selected. I wasn't sure if people would use selected buttons. The c4 UI doesn't normally give you that feedback for media, does it? Quote Link to comment Share on other sites More sharing options...
RAV Posted March 10, 2021 Share Posted March 10, 2021 4 minutes ago, zaphod said: I don't quite understand what you mean by create the default image for Script 1 above? You may have missed this in the instructions but if you have two files called myimage.png and myimage_selected.png then it will use them both when creating the driver file. The script looks for a _selected.png file and if it doesn't find one then it uses the same image for both. But it will use a selected image if you have provided one. One other thing I could do is to create an inverted image. The Pillow commands include one called invert. But that may not give a very useful image. Sweet, missed that when I read through the instructions. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.