• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

RtMouseText no longer loads after latest update

Explorer ,
Mar 16, 2018 Mar 16, 2018

Copy link to clipboard

Copied

The following code has worked for the past 6 months -- but the 0.1 update seems to have broken it

var fileMenu = app.menus.item("$ID/RtMouseText");

fileMenu.menuItems.add(menuAction,LocationOptions.AT_BEGINNING);

var fileMenu2 = app.menus.item("$ID/RtMouseSpellSuggestions");

  fileMenu2.menuItems.add(menuAction,LocationOptions.AT_BEGINNING);

}

I get an error (two actually -- one for each menu) that neither installed.

Anyone else experience this? Any suggestions what to do?

TIA

TOPICS
Scripting

Views

489

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2018 Mar 16, 2018

Copy link to clipboard

Copied

Hi TIA,

hm…


I have no problem with "$ID/RtMouseText".
For example: A startup script written by Dirk Becker that is adding the menu action for "$ID/Apply no break" to the context menu "$ID/RtMouseText" is still working with my CC 2018.1 on Mac OS X 10.11.6 without any problems.

What is defined in your variable menuAction ?

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 16, 2018 Mar 16, 2018

Copy link to clipboard

Copied

menuAction = app.scriptMenuActions.add(menuTitle);

and menuTitle is the text for the menu.

Is the script you mentioned available? I'd like to try it and see if it works...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2018 Mar 16, 2018

Copy link to clipboard

Copied

akiva_atwood  wrote

… Is the script you mentioned available? I'd like to try it and see if it works...

See the link with my answer #2.

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2018 Mar 16, 2018

Copy link to clipboard

Copied

You could try Dirk's script:

menuitemNoBreak.jsx script for Adobe InDesign

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 16, 2018 Mar 16, 2018

Copy link to clipboard

Copied

Thanks. I'll give it a try

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 18, 2018 Mar 18, 2018

Copy link to clipboard

Copied

Note that the script reuses an existing hard-wired action.

A scriptMenuAction requires more code where things can go wrong, including a targetengine.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 18, 2018 Mar 18, 2018

Copy link to clipboard

Copied

LATEST

Here's the entire script:

#targetengine 'SSIsession';

var fTitle = "Add Style";

var selLength;

var theSel;

var fHandlersI = {

  'beforeDisplay' : function(event)

  {

  try{

  event.target.enabled = (app.documents.length>0);

  }

  catch(e){notify("RT003: \n"+e,2);}

    

        if(event.target.enabled){

            selLength=app.selection[0].characters.length;

            theSel=app.selection[0];

            }    

  },

  'onInvoke' : function(event)

  {

  try{

  app.doScript(addStyle, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "SmartStyleIt");

  }

  catch(e){notify("RT004: \n"+e,2);}

  }

  };

var fHandlersStyle = {

  'onInvoke' : function(event)

  {

          //alert(event.target.name);

          s=event.target.name;

          if(s.indexOf("pStyle")>0){

                ss=s.replace(" pStyle","");

                //alert(ss+"\r"+theSel.contents);

              theSel.appliedParagraphStyle=ss;

                }

        else{

            ss=s.replace(" cStyle","");

          // alert(ss+"\r"+theSel.contents);

                theSel.appliedCharacterStyle=ss;

            }

  }

  };

// THE MENU INSTALLER

// -----------------------------------------------

var fMenuInstaller = fMenuInstaller||

(function(menuTitle,menuHandlers)

{

var menuAction = app.scriptMenuActions.add(menuTitle);

var event;

for( event in menuHandlers )

  {

  menuAction.eventListeners.add(event,menuHandlers[event]);

  }

// 3. Create the menu item

try{

var fileMenu = app.menus.item("$ID/RtMouseText");

fileMenu.menuSeparators.add(LocationOptions.AT_BEGINNING);

fileMenu.menuItems.add(menuAction,LocationOptions.AT_BEGINNING);

var fileMenu2 = app.menus.item("$ID/RtMouseSpellSuggestions");

  fileMenu2.menuSeparators.add(LocationOptions.AT_BEGINNING);

  fileMenu2.menuItems.add(menuAction,LocationOptions.AT_BEGINNING);

}

catch(e){

  alert("failed to install RtMouseText");

  }

return true;

})(fTitle, fHandlersI);

function installMenuItem(menuTitle,menuHandlers)

{

var menuAction = app.scriptMenuActions.add(menuTitle);

var event;

for( event in menuHandlers )

  {

  menuAction.eventListeners.add(event,menuHandlers[event]);

  }

// 3. Create the menu item

try{

var fileMenu = app.menus.item("$ID/RtMouseText");

fileMenu.menuItems.add(menuAction,LocationOptions.AT_BEGINNING);

var fileMenu2 = app.menus.item("$ID/RtMouseSpellSuggestions");

  fileMenu2.menuItems.add(menuAction,LocationOptions.AT_BEGINNING);

}

catch(e){

  alert("failed to install RtMouseText");

  }

return true;

}

function doStyle(){

    alert("assigned");

    }

function addStyle(){

    styleName="";

    sel=app.selection[0];

    if(selLength==0){

        styleName=sel.appliedParagraphStyle.name+" pStyle";

        }

    else{

        styleName=sel.appliedCharacterStyle.name+" cStyle";

        }

    installMenuItem(styleName,fHandlersStyle);

    }

It's a start up script. I get the error message alert ("failed to install") whenever it starts up AND when I use the menu item -- which works despite the error message

This behaviour is new -- just since the last update. Before that it worked fine without the error messages.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines