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

Break link to Object Style Script only Working when selecting text frame / frames!

Enthusiast ,
Jun 08, 2021 Jun 08, 2021

Copy link to clipboard

Copied

Hi Experts, Im trying to develop a script to break links to object styles in all text frames?, but it only work if i select one or more frame, i dont know why?, here is the code :

 

//Break Link to Object Style
BreaklinktoObjStyle();
function BreaklinktoObjStyle () {
var myCounter = 0;
var myDoc = app.activeDocument;
var myPage = myDoc.pages;
var myFrames = myDoc.textFrames;
for (var i=0; i< myFrames.length ; i++) {
myCounter ++;
   try {
        app.scriptMenuActions.itemByID(113166).invoke();
        } catch (e) {
}
}
return myCounter;
}

 

Please help,

 

Best
Mohammad Hasanin
TOPICS
Scripting

Views

314

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

correct answers 1 Correct answer

Community Expert , Jun 08, 2021 Jun 08, 2021

Hi M.Hasanain,

the important thing with that script menu action is, that you have to select a given text frame first.

Without selecting a text frame the script will do nothing. It's just the same in the UI when you did not select a frame on the page the menu is not available, it is grayed out.

 

myDoc.select( myFrames[i] );

 

If a frame is not selectable the script menu action will do nothing.

How could a frame not be selectable? If it is locked for example.

Or if it is not visible.

 

myFrames[i
...

Votes

Translate

Translate
Community Expert ,
Jun 08, 2021 Jun 08, 2021

Copy link to clipboard

Copied

Hi M.Hasanain,

the important thing with that script menu action is, that you have to select a given text frame first.

Without selecting a text frame the script will do nothing. It's just the same in the UI when you did not select a frame on the page the menu is not available, it is grayed out.

 

myDoc.select( myFrames[i] );

 

If a frame is not selectable the script menu action will do nothing.

How could a frame not be selectable? If it is locked for example.

Or if it is not visible.

 

myFrames[i].locked = false;
myFrames[i].visible = true;
myDoc.select( myFrames[i] );

 

Another thing: It could be that myDoc.textFrames will not get all text frames in a document.

It will not get frames that are anchored or otherwise in nested structures like groups, buttons etc.pp.

 

FWIW: You might detect other situations where the frames are not selectable.

If you do, come back with sample documents where this happens, share the documents so that we can find a solution.

 

Regards,
Uwe Laubender

( ACP )

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
Enthusiast ,
Jun 08, 2021 Jun 08, 2021

Copy link to clipboard

Copied

LATEST

Thanks a lot Eng.Uwe Laubender

I will develop the script to try to catch other frames like graphics and images and shapes and let you know, thanks a lot

 

Best
Mohammad Hasanin

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