Remove the unused master spread
Hi all
Does anyone know how to remove unused in the document master spread.
Thanks in advance.
tanshk
It will work in CS3 at least. It is not very fast, however. It will remove all unused master spreads.
myDoc=app.activeDocument; for (var n=myDoc.masterSpreads.length-1; n>=0; n--){ if (isMasterSpreadInUse(myDoc.masterSpreads[n])==false){ myDoc.masterSpreads[n].remove(); } } function isMasterSpreadInUse(myMasterSpread){ var myDoc=myMasterSpread.parent; for (var n=myDoc.masterSpreads.length-1; n>=0; n--){ if (myDoc.masterSpreads[n].appliedMaster==myMasterSpread){ return true; } } for (var n=myDoc.pages.length-1; n>=0; n--){ if (myDoc.pages[n].appliedMaster==myMasterSpread){ return true; } } return false; }
Tags: InDesign
Similar Questions
-
Hello
I need to remove some unused document masters spreads. If there is any unused master then propagates its removal. But when there is no unused master spreads, its pop-up below alert. Its deletion pages. I use the code below.
What is my in the code below.
function removeUnusedMaster()
{
App.Selection = 1851876449;
If (app.menuActions.itemByID checked (6145) == true)
{
try {}
app.menuActions.itemByID (6151) .invoke ();
app.menuActions.itemByID (6150) .invoke ();
} catch (e) {/ / remove spread all except 1st, when all differences are not used except no.}
app.activeDocument.masterSpreads [1] .select)
app.activeDocument.masterSpreads [app.activeDocument.masterSpreads.length - 1]. Select (Select ionOptions.addTo);
app.menuActions.itemByID (6176) .invoke ();
}
} else
{
try {}
app.menuActions.itemByID (6145) .invoke ();
app.menuActions.itemByID (6151) .invoke ();
app.menuActions.itemByID (6150) .invoke ();
} catch (e) {}
}
}
Thanks in advance,
Sudha K
The alert you see pop up when there is no unused masters gaps, but when you try to delete a master that applies to one or another master page/double. You cannot use menuActions for that I don't think that because you have to be able to tell if a master is applied. With menuActions test is to check if this alert appears, but you cannot script that.
But it is not too difficult to check if the masters are used: create a list of masters applied to the pages of the document, another list of teachers applied to the masters of the document (i.i. a list of masters end of other masters), then delete the masters that do not occur in any of the lists.
(function(){ var pages; var masters; var i; var appliedToPages = {}; var appliedToMasters = {}; // Get the names of the masters applied to document pages pages = app.documents[0].pages.everyItem().getElements(); for (i = pages.length-1; i >= 0; i--) { if (pages[i].appliedMaster !== null) { appliedToPages[pages[i].appliedMaster.name] = true; } } // Get the names of masters applied to masters (i.e. masters based on other masters) masters = app.documents[0].masterSpreads.everyItem().getElements(); for (i = masters.length-1; i > 0; i--) { if (masters[i].appliedMaster !== null) { appliedToMasters[masters[i].appliedMaster.name] = true; } } // Delete masters that are not applied to any document pages or other masters for (i = masters.length-1; i > 0; i--) { if (!appliedToPages[masters[i].name] && !appliedToMasters[masters[i].name]) { // $.writeln (masters[i].name); masters[i].remove(); } } }());
Peter
-
I have a movie... great... now I want to save as a .wmv file, so I can burn it to a CD, but I keep getting an error 0 x 87160139 "find missing or remove the unusable items in your project and then try again." so I tried to change the format of mp4 to mi/gal (what I know now was not necessary), but it will not save yet. I would like to make photos and videos I use. I think that this video might be too big? not sure... also, all files have the same name and in the same folder that I shot, I'm in a block, any help appreciated! Thank you.
-Mark
Hi Mark,
Thanks for posting your query on the Microsoft Community.
According to the description, I understand that you are getting an error code.
I suggest you to refer to the Microsoft Help Article below and check if that helps.
You can also check:
Hope this information helps. Please let us know if you need any other help with Windows in the future. We will be happy to help you.
-
Remove the unused nuances in Illstrator CS6?
I just moved to CS6 illustator CS4. I am trying to remove the unused nuances in my palette of nuance, but do not see as an option when I click on the menu at the top right of the window.
Thanks Mike!
I knew there must be something simple.
-
The school where I teach is recently spent all gmail accounts. To use Thunderbird, I had to register again, which gives me two accounts Thunderbird on the same column on the left. As far I can tell, everything has migrated to the new account. Can I remove the old one - or hide in some way? Is it safe to delete? And how do I do it.
If you are sure that there are no mail to be kept in the old account, it can be deleted.
Press Alt or F10, where the menu bar is hidden.
In the main menu bar:
Tools - account settings
Select the account to be deleted in the left pane.
Select 'Delete account' in the drop down menu "Action counts" at the bottom. -
Remove the unused nuances in InDesign CS5, js
Hello
I need to select and delete the unused nuances in InDesign CS5. I looked through OMV 'Shades' and 'Swatch', but I could not find any function to select unused swatch and delete.
I'm looking for it in the wrong place?
And I also need to read the values of color for the samples used. I got this to OMV and hoped he would give me an array of color values for all existing shades, but I get only "color of the object":
mySwatches = myDoc.swatches [1] .getElements ();
Alert (mySwatches) Thank you for your help.
Yulia
I love!
Thank you.
-
Remove the unused characters from string
Hi, I try to remove unused characters from a string, but I can't find a function for this.
The string like: 0000 0000 0000 0000 0000 0000 0130 3130 3030 3030 3004 0000 0000 0000 0000 0000 0000 0000, I need the characters from 01 to 04.
I need some advice.
If the characters between the SOH and EOT had a NULL value, then Match Regular Expression can be a choice:
Find \x01, find something else THAN \x04, then find \x04
-
remove the security master av.what is
What is security master av? How can I remove it?
You can try to run the full scan of the system with:
http://OneCare.live.com/site/en-us/Center/whatsnew.htm
And remove it, it's a fake anti-virus.
-
I know that some Adobe products have an option to remove unused resources from a project, but I can't seem to find one in AE. For example, I have a model that I'm not sure is always used nowhere in my project. I do a "household" and it would be nice to remove stuff like this. What is the best way to do this?
COMPOSITIONS are not elements of film in the direction corresponding to the command delete unused images.
There are several commands described in the page I linked, for different types of cleaning and consolidation.
I was hoping that you would read this paragraph:
«To Remove unselected compositions and elements of unused film of selected compositions in the project Panel, choose file > reduce project.»
Try selecting the compositions you want to keep and use the command scale down the project. Don't forget to do a backup first, in case it does not work as you wish.
-
How to remove the IDE MAST * A DVD-RAM UJ-820 s - Tecra A2?
DVD-RAM on my Tecra A2 unit has stopped working (generates many errors of controller to the event log and FAILS in the Toshiba utility). I'm sure it's only the flexible cable (got trapped once that do not closed with care).
If the cable needs replacing or the whole unit, it should be a fairly easy DIY job, but I can't find detailed disassembly procedures in the manual, or anywhere on the web. Anyone know how to get a service manual for the A2?
Hello
Maybe this URL
http://www.irisvista.com/tech/laptops/Toshiba-Tecra-A2/notebook-disassembly-Guide.htm
could be useful.
Good luck!
Antonio -
The single Master Page spread value
Hi guys, noob on inDesign scripting of apple and hoped someone could help me. I'm stuck trying to figure out how to put the first master spread in the document on a single page. I managed to create two new spreads masters with simple pages or face, although I can not change the first. I'm sure it's something simple I'm missing, but for the life me I can't see it.
Thanks in advance, best regards, Rob.
while(myMaster.pages.length > 1){ myMaster.pages.item(-1).remove(); }
Substances
-
I'm working on a script that search masters spreads for specific text. Once it is found, the master spread name is returned. Now I'm stuck looking for pages to find where this master spread is applied first. Any help?
var doc = app.activeDocument; app.findTextPreferences = app.changeTextPreferences = NothingEnum.NOTHING; app.findChangeTextOptions.includeMasterPages = true; app.findTextPreferences.findWhat = "custom text"; var finds = doc.findText(); if (finds.length > 0) { var mspage = finds[0].parentTextFrames[0].parent.name; var dpage = doc.pages[0].appliedMaster.name; //This of course is not right, it's returning the name of the master spread for whatever page is currently selected. So how do I set the current page to the page that first uses the found master spread (mspage)?
You will have to look for him.
var i, dpage; for (i=0; i<=doc.pages.length; i++) { if (doc.pages[i].appliedMaster == mspage) { dpage=doc.pages[i]; break; } }
However, if ever he finds one, you will get an error.
-
How to remove the layer by name?
Hello
I currently have a script that removes the unused/white/empty layers:
var layers = app.activeDocument.layers.everyItem () .getElements ();
for (var i = layers.length - 1; i > = 0; i--) {}
{if(Layers[i].pageItems.Length==0)}
layers [i]. Remove();
}
}
but in addition to the unused layers, I need to remove layers which have a layer name that begins with a support "[]". Often, there are layers of model in our workflow which are not necessary - they are named differently but always begin with a hook. Example: [page 2] xxx - xxx-#.
I tried frankensteining in a piece of code that Jarek provided for another script that processes the names of swatch, but I'm afraid, I'm rather desperate (I intend to become less desperate... then maybe you will not always be overcome with dread seeing my messages... but it does not solve my (or your) problem now).
As always, I appreciate your consideration and help.
After the first appearance of the line
layers [i]. Remove();
try adding the line
continue;
Here, the reason may be that if a layer is empty, then it is removed, and
so it's no good trying to access his name since there is no
more. A command continue will force the loop to move on to the next
iteration instead of a wrong to move on to the next if statement.
Ariel
-
How can I remove addys unused e-mail, under the sign in space?
How can I remove addys unused e-mail, under the sign in space? In Hotmail.
After all the Hotmail issues in the appropriate forum found here:
http://windowslivehelp.com/ -
How can I remove all the unused files to clear a space
How can I remove all the unused files from my computer
You can remove applications on the control panels. XP seems to me (im not on a XP ATM machine) programs cpanel
Files? you do not (or should not) delete separately
Maybe you are looking for
-
Hello I should probably start by listing the specs of the laptop. So here it is: Model: Pavilion Sleekbook 15-b003sm Series: [personal information] Product: C6T29EA #BED Processor: Intel Core i5-3317U (1.7 GHz) Memory: 8 GB RAM Graphics card: GeForce
-
I have a copy of Windows XP Pro (Upg) RTM, originally purchased at the retail price (CompUSA or Best Buy, Colorado Springs, Colorado in 2001), and I still have the original blue folder with the orange product key sticker. This past weekend I slipstr
-
Windows phone scam
-
Get only a blank page when you try to print
When I go to print anything, nothing prints. I just get a blank sheet of paper. What is going on?
-
pro 8600, CLP1CN1304AR FIRMWARE Installation - MAC OSX 10.8.3
Installed the latest firmware on HP Pro 8600, and suddenly the Web server is not normal fields: (all changed fields or indicators have-> or) Header: HP Officejet Pro 8600 N911g L@S#2632 Then First descent to the bottom of the tab screen displays 'INT