Jump to content
C4 Forums | Control4

Easily make Custom-Scenario buttons for your Control4 Navigator screens


zaphod

Recommended Posts

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)

image.thumb.png.6b39e9e90582c1dcc097832438047c40.png

Link to comment
Share on other sites


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

Link to comment
Share on other sites

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.
 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?  


5CA-YLjz8DFld72k7kKVMy6g_Yz_SmdS0gcfz6r4tyx8toqNAjA2Rf2vOUr_CPfbGJ0uwEfLgxHzB9hyh0vqhDWCd1ccJe9JcsTW9nRcM6uSjqSbcUiH68fkOQLPmse_wolhiQTWWFwATJgCJVC9JV0Swb0lORcw8a2mN7TYfLulFEYdMNkByAZ0Sjrpk24mfOCcDL-9USXdXKJfz4wbh7SpW5p4-wz0wj18jfbPbwCctSXv0Nul4ovzpF2ozs7oB0o1RsYqXJd552dSVGZePpMAvdL6iSZYZYslS-o4tZGyPbGaUGRPaQNfRg-lLHCVOArJteU2B8cAkamS1dKUT5TXC-bntEh3L0_LeLf2dSTVl4VHOIHoOJ-qNfzD5_7oKoKkcnxeFMlYKfXduTwsUkL8x6daEL0xT40yFQmiC63hbdGk4gSHo9i7bjG8wxQo5dl08ku0NP3gZQV0y9mL9kHIIUDwj9fpap5TF3ttH6N-8v_RLZQCv1dpnKuIokKSVToLrGXYqRZiwSwMdaAu5OPmOc3iX-Bb8cKTYAdzE8D9b4CD9D8dqOH_3FSvo_eCw8shaOBADJwxruLywDbcDI7RW4QHL5NaZEcDf-l7NUi2WZALIauwTMA2bK4X-qeD9hOiNQ7blbocAAskZZ0OU7x1WX5Wi06SdhP_6kB2mssN-cK8Pmd9PWvuIklt50KEBQ6c3CrEIIviP0HLv4z1rZlp=w438-h947-no?authuser=0r9-e9sCJmVDOAiW9znpmStGmn6IHCMUomj8-xLILayn-I795-Qmm64fLV5ciYb1OSVpi067M-uvrNDIBur00cHX5Yz5mg_zlXIob0UT0PdiMg5ORzBaqzS35eSODY7pYI0D_eRSezr9H6RfGhdsGec-kX95kx6rJRAWMRrsO4kSeUZUrJBO2hpEr7EZQWEKd9sBTlEwowoFZIiZwVf529TO8QVYGnCyxjslzhvSMCwuVHSme97jmS7LhjP4DOgX5l-PqrNCcmeBQFCJm6OZjwHxznWA3ki4IJ8hY3tfruqwTE_EfHy69QOPuXzQlO-LjktoOwItsdlLtIasfAnq7TVMIBFThiLhKa9W37nGpKVIUK8MqjHl-D7N140_F7ZkEvqblDyWBMw7q3MlNBs3ydJRcvLT7c3zkxhvZiYsdNyBM35NS7ksJq2Ps5weGFcY9z059ynj49ByQW13CkY5capGv70TQHL4bkU3JIhzp48mz2S1vei0GCFnSwGDPIqs5R4qIRXbinxd6fs9weCKXgYVuqhRb7eXvZhV6IZuTMlkP98JrmMYD1Y63FVk01p0Z5ge73Yl1Law7V7B15IU2aKyWC9tny2mb8iJMJz62TcdE9JzlWAxnFOfR3Zeg3LAJcFS_6DoUi3I2E6stbEYoDvAsBtY14aYXnnGVpidm9wm8ykZ1ojd8OU7fnpR0HutWeb5R-AW2SwahFLz1PvQuK0hL=w438-h947-no?authuser=0

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.