Skip to main content
Inspiring
May 19, 2025
Answered

script - add a blank line to a menu

  • May 19, 2025
  • 1 reply
  • 597 views

I am using a variation of @Russ Ward 's 100.04 Favorites menu from here: http://www.weststreetconsulting.com/WSC_ExtendScriptSamples.htm

 

I modifed the script to change the order and to display and run macros rather than opening favorite documents.

 

The script reads a text file where each line contains script name displayed, followed by ~~~~, followed by path to script, i.e.

My script~~~~<Path to My Script>

 

It works fine, but I would like to put two BLANK lines between commonly used scripts and rarely used scripts. I don't want  separator, I want blank lines ... (The script adds separators and that works well).

 

If I try (in the text file) "  ~~~~~ "", the script changes that to a separator in the drop-down menu.

 

If I use "<br>~~~~A", the script displays "<br>" in the drop-down.

 

If I use "_~~~~A", the script displays "&&&&_" in the drop-down - not sure where the "&'s" come from.

 

If I "<br>~~~~A", and then in the define macros code I add: 

{
var file = new File(macrosFilePath);
if(file.exists)
{
file.open("r");
while(!file.eof)
{
var line = trim(file.readln());
// var line = file.readln();
if(line != "" && line.indexOf(";") != 0)
{
var args = line.split("~~~~");
var macro = new Array(2);
macro[0] = args[0];
macro[0] = macro[0].replace("<br>", " ");
if(args.length > 1)
macro[1] = args[1];
else macro[1] = "";
macros.push(macro);
}
}
}

I get "&&&&&&" in the drop-down, so somewhere it is substituting &'s for blank spaces.

 

I'll use "N/A" for now, but I'd prefer a completely blank line.

Correct answer Marshall_Brooks

The XML entity I am using is a non-breaking space. Since Russ's file is a text file, it is not recognized. There might be an ASCII (or Unicode) code for it but I am not sure.


Bingo!!!!

Non-breaking space works and is recognized. For Russ's file, it is (on a Windows PC) - <Alt Down> Keypad 255<Alt Up>

https://forum.squarespace.com/topic/193923-is-there-a-way-to-add-a-non-breaking-space-to-a-text-block/

 

Thank you again @frameexpert !!!

1 reply

Inspiring
May 19, 2025

More info/oddities:

N/A works. I tried adding "." or ".." or "...." for the names and I got "&&&&&&&.", "&&&&&&..", and "&&&&&&..." for the results.

Inspiring
May 21, 2025

@frameexpert - Wondering if you had any ideas on what is going on or suggestions ... Thanks!

frameexpert
Community Expert
Community Expert
May 21, 2025

I don't use Russ's method for setting up my custom menus. I use an XML file that allows the client control over menu and command labels. There is a script that reads the XML file to set up menus and commands. I am not able to post the script here as it took significant development time.

<?xml version='1.0'?>
<settings markerType="Index">
  <clientFolder>CP-Carmen</clientFolder>
  <menuName>Carmen_Publishing</menuName>
  <url>www.frameexpert.com</url>
  <menus>
    <menu name="CP-MainMenu" label="Carmen-Publishing">
      <command cmd="10" name="CP-AddMarkerSortStringsCmd" label="Add Marker Sort Strings..."
        enabled="FV_ENABLE_NEEDS_DOCP_OR_BOOKP"/>
      <command cmd="20" name="CP-AddMarkerSortStringsOnBookUpdateCmd"
        label="Add Marker Sort Strings on Book Update" canHaveCheckMark="1" checkMarkIsOn="1"
        enabled="FV_ENABLE_ALWAYS_ENABLE"/>
      <command cmd="30" name="CP-RemoveMarkerSortStringsCmd" label="Remove Marker Sort Strings..."
        enabled="FV_ENABLE_NEEDS_DOCP_OR_BOOKP"/>
      <sep name="sep1"/>
      <command cmd="1000" name="CP-AboutCmd" label="Write Version Information to Console"
        enabled="FV_ENABLE_ALWAYS_ENABLE"/>
    </menu>
  </menus>
</settings>