Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Yes, Quark does have an easy as pie way to turn off Hyphenation. Under the Edit menu, select H&Js (hyphenation and justifications) then double click on No Hyphenation. This will open a window that shows the current settings for No Hyphenation. If the Auto Hyphenation box is already Unchecked, just click OK or press Enter. If there's a check in the AH box, just uncheck and click OK.
Now click the Save button and you're all set. Easy peasy. This is just one of the many many reasons I prefer Quark over ID. But that's me.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I try the script, but doesn't work in table, how can also turn off hyphenation in table's text with javascript?
Copy link to clipboard
Copied
@creativejoan0425 – As you can see tables have to be accessed separatly.
Also footnotes.
The following script handles also footnotes and tables (but not tables inside tables!):
//TurnHyphenationOFF_Stories_Footnotes_PlainTables.jsx
//Uwe Laubender
//DESCRIPTION:Does NOT work for TABLES INSIDE tables!
//See discussion at:
//http://forums.adobe.com/thread/323599?tstart=0
/**
* @@@BUILDINFO@@@ TurnHyphenationOFF_Stories_Footnotes_PlainTables.jsx !Version! Fri Dec 06 2013 11:24:16 GMT+0100
*/
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
app.doScript(_TurnHyphenationOff, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT, "Turn off hyphenation");
alert("Done: Hyphenation is off for all stories, footnotes and plain, not nested tables.");
function _TurnHyphenationOff(){
var everyStory = app.documents[0].stories.everyItem();
//Plain stories:
everyStory.texts[0].hyphenation = false;
//All footnotes:
everyStory.footnotes.everyItem().texts[0].hyphenation = false;
//Plain table cells (NOT NESTED TABLES):
everyStory.tables.everyItem().cells.everyItem().texts[0].hyphenation = false;
}; //END function _TurnHyphenationOff()
You can undo the script in one go…
Uwe
Copy link to clipboard
Copied
If I want to do it in a selection? I want to select a table row to turn off hyphenation, how can I do?
從三星手機發送
Copy link to clipboard
Copied
Do it manually -- select the text in the row, choose Hyphenation from the Control panel flyout menu, and clear the checkbox.
Copy link to clipboard
Copied
That would be:
app.selection[0].cells.everyItem().texts[0].hyphenation = false;
Uwe
Copy link to clipboard
Copied
It doesnt work
從三星手機發送
Copy link to clipboard
Copied
With a table row selected, it will work. I tested that…
Or did you ask how to select or adress a table row to turn hyphenation off? If yes, which one?
For a table put into the variable myTable, for the first row of that table it would be:
myTable.rows[0].cells.everyItem().texts[0].hyphenation = false;
The variable myTable can stand for any table in a document.
To make myTable the first table in a specific story, select a text frame of that story and:
myTable = app.selection[0].parentStory.tables[0];
myTable.rows[0].cells.everyItem().texts[0].hyphenation = false;
Uwe
Copy link to clipboard
Copied
Here is my script, I use the Adobe FindChangebyList to make some modified, I want to clear the hyphenation and break link to style when I select texts or table row, or maybe a cells, can you help me to fix the error? thx ver much
main();
function main(){
var myObject;
//var myCheckSelection = false;
//Make certain that user interaction (display of dialogs, etc.) is turned on.
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
if(app.documents.length > 0){
if(app.selection.length > 0){
switch(app.selection[0].constructor.name){
case "InsertionPoint":
case "Character":
case "Word":
case "TextStyleRange":
case "Line":
case "Paragraph":
case "TextColumn":
case "TextFrame":
case "Text":
case "Cell":
case "Column":
case "Row":
case "Table":
myDisplayDialog();
break;
default:
//Something was selected, but it wasn't a text object, so search the document.
//myFindChangeByList(app.documents.item(0));
//alert("Nothing Selected, Please Select Text Frame or Text.");
}
}
else{
//Nothing was selected, so simply search the document.
//myFindChangeByList(app.documents.item(0));
alert("Nothing Selected, Please Select Text Frame or Text.");
}
}
else{
alert("No documents are open. Please open a document and try again.");
}
}
function myDisplayDialog(){
var myObject;
var myDialog = app.dialogs.add({name:"Joan New Clear Setting_v1.0"});
with(myDialog.dialogColumns.add()){
with(dialogRows.add()){
with(dialogColumns.add()){
staticTexts.add({staticLabel:"Search Range:"});
var mySearchButtons = radiobuttonGroups.add();
with(mySearchButtons){
radiobuttonControls.add({staticLabel:"Current Document", checkedState:true});
if(app.selection[0].contents != ""){
radiobuttonControls.add({staticLabel:"Selection", checkedState:true});
}
}
}
with(dialogColumns.add()){
with(borderPanels.add()){
staticTexts.add({staticLabel:"Clear Setting:"});
var myDateButtons = radiobuttonGroups.add();
with(myDateButtons){
radiobuttonControls.add({staticLabel:"English", checkedState:true});
radiobuttonControls.add({staticLabel:"Chinese"});
}
}
}
}
}
var myResult = myDialog.show();
if(myResult == true){
switch(mySearchButtons.selectedButton){
case 0:
BreakLinktoStyleDocument();
TurnOffHyphenationDocument();
myObject = app.documents.item(0);
myCheckSelection = false;
break;
case 1:
BreakLinktoStyleSelection();
TurnOffHyphenationSelection();
myObject = app.selection[0];
myCheckSelection = true;
break;
}
switch(myDateButtons.selectedButton){
case 0:
myFindChangeByList1(myObject, myCheckSelection);
break;
case 1:
myFindChangeByList2(myObject, myCheckSelection);
break;
}
myDialog.destroy();
//myFindChangeByList1(myObject);
}
else{
myDialog.destroy();
}
}
//-------------------------------------------------------------------------------------------------
function TurnOffHyphenationDocument() {
app.activeDocument.stories.everyItem().texts.everyItem().hyphenation=false;
myTables = app.activeDocument.stories.everyItem().tables.everyItem();
myTables.cells.everyItem().paragraphs.everyItem().hyphenation=false;
}
function TurnOffHyphenationSelection() {
app.selection[0].texts[0].hyphenation=false;
app.selection[0].cells.everyItem().texts[0].hyphenation=false;
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function BreakLinktoStyleDocument() {
app.activeDocument.stories.everyItem().texts.everyItem().applyParagraphStyle(app.activeDocument.paragraphStyles.item(0), false);
app.activeDocument.stories.everyItem().texts.everyItem().applyCharacterStyle(app.activeDocument.characterStyles.item(0), false);
myTables = app.activeDocument.stories.everyItem().tables.everyItem();
myTables.cells.everyItem().paragraphs.everyItem().applyParagraphStyle( app.activeDocument.paragraphStyles.item(0), false);
myTables.cells.everyItem().paragraphs.everyItem().applyCharacterStyle( app.activeDocument.characterStyles.item(0), false);
}
function BreakLinktoStyleSelection() {
app.selection[0].applyParagraphStyle(app.activeDocument.paragraphStyles.item(0), false);
app.selection[0].applyCharacterStyle(app.activeDocument.characterStyles.item(0), false);
app.selection[0].cells.everyItem().texts[0].applyParagraphStyle(app.activeDocument.paragraphStyles.item(0), false);
app.selection[0].cells.everyItem().texts[0].applyCharacterStyle(app.activeDocument.paragraphStyles.item(0), false);
}
//--------------------------------------------------------------------------------------------------
function myFindChangeByList1(myObject, myCheckSelection){
var myScriptFileName, myFindChangeFile, myFindChangeFileName, myScriptFile, myResult;
var myFindChangeArray, myFindPreferences, myChangePreferences, myFindLimit;
var myStartCharacter, myEndCharacter;
var myFindChangeFile = myFindFile("/ScriptSupport/te.txt")
if(myFindChangeFile != null){
// Because the selection will change as we add/remove characters,
// we'll need to reset the selection after each pass if we are
// checking the selection. We'll get the index of the first character
// in the selection (relative to the start of its parent story) and
// the index of the last character in the selection (relative to the
// *end* of the story, and we'll use them later in the script to
// keep the ends of the selection in place.
if(myCheckSelection == true){
var myStart = myObject.characters.item(0).index;
var myEnd = myObject.characters.item(-1).index;
var myStory = myObject.parentStory;
var myStoryEnd = myStory.characters.item(-1).index;
myEnd = (myStoryEnd - myEnd)+1;
}
myFindChangeFile = File(myFindChangeFile);
var myResult = myFindChangeFile.open("r", undefined, undefined);
if(myResult == true){
//Loop through the find/change operations.
do{
myLine = myFindChangeFile.readln();
//Ignore comment lines and blank lines.
if((myLine.substring(0,4)!="text")||(myLine.substring(0,4)!="grep")||(myLine.substring(0,5)!="glyph")){
myFindChangeArray = myLine.split("\t");
//The first field in the line is the findType string.
myFindType = myFindChangeArray[0];
//The second field in the line is the FindPreferences string.
myFindPreferences = myFindChangeArray[1];
//The second field in the line is the ChangePreferences string.
myChangePreferences = myFindChangeArray[2];
//The fourth field is the range--used only by text find/change.
myFindChangeOptions = myFindChangeArray[3];
switch(myFindType){
case "text":
myFindText(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
break;
case "grep":
myFindGrep(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
break;
case "glyph":
myFindGlyph(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
break;
}
if(myCheckSelection == true){
myStartCharacter = myStory.characters.item(myStart);
myEndCharacter = myStory.characters.item(-myEnd);
myObject = myStory.texts.itemByRange(myStartCharacter, myEndCharacter);
app.select (myObject);
}
}
} while(myFindChangeFile.eof == false);
myFindChangeFile.close();
}
}
alert("Done");
}
function myFindText(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
//Reset the find/change preferences before each search.
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences = NothingEnum.nothing;
app.findChangeTextOptions = NothingEnum.nothing;
var myString = "app.findTextPreferences.properties = "+ myFindPreferences + ";";
myString += "app.changeTextPreferences.properties = " + myChangePreferences + ";";
myString += "app.findChangeTextOptions.properties = " + myFindChangeOptions + ";";
app.doScript(myString, ScriptLanguage.javascript);
myFoundItems = myObject.changeText();
//Reset the find/change preferences after each search.
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences = NothingEnum.nothing;
app.findChangeTextOptions = NothingEnum.nothing;
}
function myFindGrep(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
//Reset the find/change grep preferences before each search.
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences = NothingEnum.nothing;
app.findChangeGrepOptions = NothingEnum.nothing;
var myString = "app.findGrepPreferences.properties = "+ myFindPreferences + ";";
myString += "app.changeGrepPreferences.properties = " + myChangePreferences + ";";
myString += "app.findChangeGrepOptions.properties = " + myFindChangeOptions + ";";
app.doScript(myString, ScriptLanguage.javascript);
var myFoundItems = myObject.changeGrep();
//Reset the find/change grep preferences after each search.
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences = NothingEnum.nothing;
app.findChangeGrepOptions = NothingEnum.nothing;
}
function myFindGlyph(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
//Reset the find/change glyph preferences before each search.
app.changeGlyphPreferences = NothingEnum.nothing;
app.findGlyphPreferences = NothingEnum.nothing;
app.findChangeGlyphOptions = NothingEnum.nothing;
var myString = "app.findGlyphPreferences.properties = "+ myFindPreferences + ";";
myString += "app.changeGlyphPreferences.properties = " + myChangePreferences + ";";
myString += "app.findChangeGlyphOptions.properties = " + myFindChangeOptions + ";";
app.doScript(myString, ScriptLanguage.javascript);
var myFoundItems = myObject.changeGlyph();
//Reset the find/change glyph preferences after each search.
app.changeGlyphPreferences = NothingEnum.nothing;
app.findGlyphPreferences = NothingEnum.nothing;
app.findChangeGlyphOptions = NothingEnum.nothing;
}
function myFindFile(myFilePath){
var myScriptFile = myGetScriptPath();
var myScriptFile = File(myScriptFile);
var myScriptFolder = myScriptFile.path;
myFilePath = myScriptFolder + myFilePath;
if(File(myFilePath).exists == false){
//Display a dialog.
myFilePath = File.openDialog("Choose the file containing your find/change list");
}
return myFilePath;
}
function myGetScriptPath(){
try{
myFile = app.activeScript;
}
catch(myError){
myFile = myError.fileName;
}
return myFile;
}
and here is my text file (te.txt)
//001
grep {findWhat:"."} {appliedLanguage: app.languagesWithVendors.item("English: USA"), kerningMethod: "無"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, includeLockedStoriesForFind:true, widthSensitive:true}
//002
grep {findWhat:"."} {kinsokuSet: "繁體中文避頭尾(s)"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, includeLockedStoriesForFind:true, widthSensitive:true}
//003
grep {findWhat:"."} {mojikumi: "nothing"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, includeLockedStoriesForFind:true, widthSensitive:true}
//004
grep {findWhat:"."} {ligatures:false} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, includeLockedStoriesForFind:true, widthSensitive:true}
//005
grep {findWhat:"."} {gridAlignment: 1852796517} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, includeLockedStoriesForFind:true, widthSensitive:true}
//006
grep {findWhat:"."} {leadingModel: 1248619858} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, includeLockedStoriesForFind:true, widthSensitive:true}
//007
grep {findWhat:"."} {characterAlignment: 1247896172} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, includeLockedStoriesForFind:true, widthSensitive:true}
Copy link to clipboard
Copied
@creativejoan0425 – maybe it's best, to switch over to the InDesign Scripting Forum to discuss on.
http://forums.adobe.com/community/indesign/indesign_scripting?view=discussions
And another thing:
to present your code, there is the "Use advanced editor" button at the top right, if you are writing a new answer.
To format lines of code, select your code, go to the >> icon, click and chose: Syntax Highlighting/Java.
That's for better readability of your code.
Uwe
Copy link to clipboard
Copied
I just found when i run the script, that will not change in empty cell, how can i fix it?
從三星手機發送
Copy link to clipboard
Copied
What script exactly?
If it's something around:
myTable.cells.everyItem().texts[0].hyphenation = false;
it should work.
At least it's working for me.
Btw. what exact version of InDesign on what OS platform are you using?
A Chinese version? Maybe this is the culprit?
(Some bugs that are not present in the other international versions.)
Uwe
Copy link to clipboard
Copied
It ok, thx juust wrong typing of my script
從三星手機發送
Copy link to clipboard
Copied
Hi I also want to do in a selection to clear all linked style (Cell and Table Style), but found some error, would u mind to help me to fix it?
Thx a lots
BreakLinkToTableStyleSelection();
BreakLinkToCellStyleSelection();
function BreakLinkToTableStyleSelection(){
var mySelection = app.selection[0];
myTables = myDoc.tables.everyItem().getElements();
for (var i=0; i<myTables.length; i++){
myTable = myTables;
myTable.appliedTableStyle = myDoc.tableStyles.item(0), false;
}
}
function BreakLinkToCellStyleSelection(){
var mySelection = app.selection[0];
myCells = myDoc.cells.everyItem().texts[0].getElements();
for (var i=0; i<myCells.length; i++){
myCell = myCells;
myCell.appliedCellStyle = myDoc.cellStyles.item(0), false;
}
}
Copy link to clipboard
Copied
Hi! I would like to reactivate this old thread.
Can anyone suggest a way how to modify the "TurnHyphenationOFF_Stories_Footnotes_PlainTables.jsx"
script by Uwe so that it modifys tables and footnotes only if they are present in a document?
Actually the script does only work with documents witch do contains footnotes and tables.
This would be very helpful, thanks a lot in advance!
Copy link to clipboard
Copied