Possible to see how many script steps are in a file?

I am just curious if there is a way to see how many script steps are in a file?

ValueCount ( ScriptIDs ( "" ) )

– oh! script steps. Sorry.

The XML will contain a script catalog. So you could query that for elements.

Layouts will also contain script steps. All the buttons will do a perform script or they will do a single script step. Depending on your programming style, buttons can contain a lot of script steps.

Using BaseX you can query a Save as XML Copy with /FMSaveAsXML/Structure/AddAction/StepsForScripts/Script/ObjectList/Step

On a DB I just opened that replies 5864 results.

1 Like

I'm a happy user of FM Perception. I just checked a file I have open on my local dev computer and it shows me that my file has 35,937 total script steps. It includes comments within a script to be a step as well, so this may be a bit deceiving, depending on your commenting habits.

Documentation
A list of every step in every script in the entire database file. Does not include single-step layout objects, menu items, etc.

It can tell you details across a full range of components. Plus, 'ships' with FMComparison which is really handy (for me). No affiliation, just a happy user.

Just for fun, I just did a quick bash shell script to run in Terminal. Running it on the same file returned slightly fewer steps (35,591) using xmlstarlet. I'll test in on some smaller files with fewer scripts to see if the discrepancy remains.

Then I created a python script to do the same thing and it returned the same (35,591) as bash shell script.

Edit to add the scripts here:
Here are the two scripts if someone wants to tinker. The bash script has the xmlstarlet dependency, but there's a comment guiding to install it. When I get a few minutes I'll make them a bit more robust regarding setting path to xml file during input (rather than hard-coded) and a bit more graceful "file not found" alerts.

I'm on Mac OS silicon, so the shebang (first line on each) can be edited, but I have it to look for the proper bash and python 3 in both Mac and Linux environments (using '/env').

If interested in trying them and if guidance is needed, please ask and I'll do my best to help.

CountScriptSteps.zip (2.0 KB)

Fun distraction. :slight_smile:

Edit 2: Updated python script with more interesting (to me) output.
count_script_steps4.py.zip (1.3 KB)

Output looks like this in Terminal:

1) Enabled script steps (excluding comments): 23101
2) Disabled script steps (all step names): 1764
3) Enabled comment steps: 13788

This is from a pretty "crufty" dev file with a lot of disabled steps (chosen purposefully for this).

1 Like