Updating script properties directly

Post Reply
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Updating script properties directly

Post by gabrielp »

If you're working with a script that has a bunch of properties (e.g. switch-private-data-write has 50+), you may find that editing property values is tedious and time consuming. There is a faster way than doing so through Scripter.

Save your script package as a new copy. Rename the .sscript file .zip and extract its contents. You should see the following:

Code: Select all

manifest.xml
icon.png
your_script_name.js
your_script_name.sscript
your_script_name.xml
Open your_script_name.xml with a text editor. This XML file holds all of the declaration properties for the script. Scroll down and you should see property values represented as XML nodes. You can carefully add, remove, or do a find and replace on property value properties.

Code: Select all

<Key1 Validation="None" LocalizedTagName="  Key" Subtype="inline" Default="" Tooltip="" DetailedInfo="" Type="string" Editor="inline;sltextwithvar;scriptexp"></Key1>
        <Value1 Validation="None" DependencyCondition="Not-empty" Dependencyvalue="Yes" LocalizedTagName="↳ Value" Subtype="inline" Default="" Dependency="Key1" Tooltip="" DetailedInfo="" Type="string" Editor="inline;sltextwithvar;scriptexp"></Value1>
        <Key2 Validation="None" LocalizedTagName="  Key" Subtype="inline" Default="" Tooltip="" DetailedInfo="" Type="string" Editor="inline;sltextwithvar;scriptexp"></Key2>
        <Value2 Validation="None" DependencyCondition="Not-empty" Dependencyvalue="Yes" LocalizedTagName="↳ Value" Subtype="inline" Default="" Dependency="Key2" Tooltip="" DetailedInfo="" Type="string" Editor="inline;sltextwithvar;scriptexp"></Value2>
        <Key3 Validation="None" LocalizedTagName="  Key" Subtype="inline" Default="" Tooltip="" DetailedInfo="" Type="string" Editor="inline;sltextwithvar;scriptexp"></Key3>
        <Value3 Validation="None" DependencyCondition="Not-empty" Dependencyvalue="Yes" LocalizedTagName="↳ Value" Subtype="inline" Default="" Dependency="Key3" Tooltip="" DetailedInfo="" Type="string" Editor="inline;sltextwithvar;scriptexp"></Value3>
      
Once you're done with your changes, re-zip your files back together. The files must be at the top level of the zip (do not zip the files in a containing folder). Rename the modified .zip to .sscript and open it back up in Scripter to see your changes.

I found this to be a big time saver. Props to the Enfocus engineers for leaving that file unencrypted -- if only our source code was so lucky.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
Post Reply