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,
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
...
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 )
Copy link to clipboard
Copied
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