mediengestalter.info
FAQ :: Mitgliederliste :: MGi Team

Willkommen auf dem Portal für Mediengestalter

Aktuelles Datum und Uhrzeit: Mi 24.04.2024 15:43 Benutzername: Passwort: Auto-Login

Thema: InDesign: Skripte nicht sichtbar, TextCleanUp vom 18.08.2005


Neues Thema eröffnen   Neue Antwort erstellen MGi Foren-Übersicht -> Software - Print -> InDesign: Skripte nicht sichtbar, TextCleanUp
Autor Nachricht
sheck
Threadersteller

Dabei seit: 25.03.2002
Ort: Luxemburg
Alter: 45
Geschlecht: Männlich
Verfasst Do 18.08.2005 09:32
Titel

InDesign: Skripte nicht sichtbar, TextCleanUp

Antworten mit Zitat Zum Seitenanfang

Hallo people,

Ich hab von der InDesign CS2 Installations-CD mal die Skripte runter kopiert. Mir ging es dabei vor allem um TextCleanUp mit dem man einen Text sauber machen kann (Abstände vor Kommas, Doppelpunkt, unnütze Leerzeilen …) Jetzt hab ich in meinem InDesign-Verzeichnis auf der Festplatte einen Ordner "Scripts" angelegt (war noch keiner da) und die Skripte da rein kopiert. Jetzt müssten diese doch in der Skripte-Palette in InDesign angezeigt werden oder nicht? Wie geht man mit Skripten im allgemeinen um? Jemand Erfahrung damit?

Danke schon mal vorab,

Gruß, Sash
  View user's profile Private Nachricht senden Website dieses Benutzers besuchen
sheck
Threadersteller

Dabei seit: 25.03.2002
Ort: Luxemburg
Alter: 45
Geschlecht: Männlich
Verfasst Do 18.08.2005 09:38
Titel

Antworten mit Zitat Zum Seitenanfang

Oh sooooorrrryyyyy,

Hab gerade noch etwas rum getüftelt. Ich hatte die Skripte im falschen Ordner. Sie liegen jetzt im Ordner InDesign / Presets / Scripts und jetzt erscheinen sie auch in InDesign.

  View user's profile Private Nachricht senden Website dieses Benutzers besuchen
Anzeige
Anzeige
sheck
Threadersteller

Dabei seit: 25.03.2002
Ort: Luxemburg
Alter: 45
Geschlecht: Männlich
Verfasst Do 18.08.2005 09:56
Titel

Antworten mit Zitat Zum Seitenanfang

Hier ist das Skript. Nur hatte ich das irgendwie anders in Erinnerung.
Weiss vielleicht jemand was ich jetzt hier machen muß um das zu personalisieren? Von Java-Script leider keine Ahnung … Ich möchte das Skript nur so verändern dass ich mein eigenes Suchen und Ersetzen-Skript daraus machen kann. (Text von Kunden angeliefert ist doch oft voll von typografischen Fehlern) Wo muß ich jetzt mein findText hin setzen?

Also z.B.:
Suche Leerraum vor Komma und lösche Leerzeichen.
Suche Leerraum, Bindestrich, Leerraum und ersetze durch Leerraum, Gedankenstrich, Leerraum



//TextCleanup.jsx
//An InDesign CS2 JavaScript
//
//Loads a series of tab-delimited strings from a text file, then performs a series
//of find/change operations based on the strings read from the file.
//
//The data file is tab-delimited, with carriage returns separating records.
//
//The format of each record in the file is:
//findProperties<tab>changeProperties<tab>range_string<tab>description
//
//Where:
//<tab> is a tab character
//findProperties is a properties record (as text)
//changeProperties is a properties record (as text)
//range_string is either "all" or "once"
//description is a description of the find/change operation
//
//Very simple example:
//{findText:" "} {changeText:" "} all Find all double spaces and replace with single spaces.
//
//More complex example:
//{findText:"^9^9.^9^9"} {appliedCharacterStyle:"price"} once Find $10.00 to $99.99 and apply the character style "price".
//
//All InDesign search metacharacters are allowed in the findText property; all but wildcards are allowed in the changeText property.
//
//For more on InDesign scripting, go to http://www.adobe.com/products/indesign/scripting.html
//or visit the InDesign Scripting User to User forum at http://www.adobeforums.com
//
var myObject;
var myCheckSelection = false;
if(app.documents.length != 0){
if(app.activeDocument.stories.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 "Text":
case "TextFrame":
var myArray = myDisplayDialog();
myObject = myArray[0];
myCheckSelection = myArray[1];
break;
default:
myObject = app.activeDocument;
break;
}
}
else{
myObject = app.activeDocument;
}
if(myObject != "None"){
myTextCleanup(myObject, myCheckSelection);
}
}
else{
alert("The current document contains no text. Please open a document containing text and try again.");
}
}
else{
alert("No documents are open. Please open a document and try again.");
}
function myDisplayDialog(){
var myCheckSelection = false;
var myDialog = app.dialogs.add({name:"TextCleanup"});
with(myDialog.dialogColumns.add()){
with(dialogRows.add()){
with(dialogColumns.add()){
staticTexts.add({staticLabel:"Search Range"});
}
var myRangeButtons = radiobuttonGroups.add();
with(myRangeButtons){
radiobuttonControls.add({staticLabel:"Selected Story", checkedState:true});
radiobuttonControls.add({staticLabel:"Document"});
if(app.selection[0].contents != ""){
radiobuttonControls.add({staticLabel:"Selection"});
}
}
}
}
var myResult = myDialog.show();
if(myResult == true){
switch(myRangeButtons.selectedButton){
case 0:
switch(app.selection[0].constructor.name){
case "InsertionPoint":
case "Character":
case "Word":
case "TextStyleRange":
case "Line":
case "Paragraph":
case "TextColumn":
case "Text":
case "TextFrame":
myObject = app.selection[0].parentStory;
break;
default:
myObject = "None";
break;
}
break;
case 1:
myObject = app.activeDocument;
break;
case 2:
switch(app.selection[0].constructor.name){
case "Word":
case "TextStyleRange":
case "Line":
case "Paragraph":
case "TextColumn":
case "Text":
case "TextFrame":
if(app.selection[0].contents != ""){
myObject = app.selection[0].texts.item(0);
myCheckSelection = true;
}
else{
myObject = "None";
}
break;
default:
myObject = "None";
break;
}
break;
}
}
else{
myObject = "None";
}
myDialog.destroy();
return [myObject, myCheckSelection];
}
function myTextCleanup(myObject, myCheckSelection){
var myScriptFileName, myFindChangeFile, myFindChangeFileName, myScriptFile, myResult;
var myFindChangeFile = myFindFile("JSFindChangeList.txt")
if(myFindChangeFile != null){
var myResult = myFindChangeFile.open("r", undefined, undefined);
if(myResult == true){
//Clear any existing find/change settings.
app.changePreferences = NothingEnum.nothing;
app.findPreferences = NothingEnum.nothing;
//Loop through the find/change operations.
do{
myLine = myFindChangeFile.readln();
//Ignore comment lines and blank lines.
if((myLine.substring(0,2)!="//")&&(myLine != "")){
myFindChangeArray = myLine.split("\t");
//The first field in the line is the FindWhat string.
eval("app.findPreferences.properties = " + myFindChangeArray[0]);
//The second field in the line is the ChangeTo string.
eval ("app.changePreferences.properties = " + myFindChangeArray[1]);
//The third field in the line can be either "once" or "all".
//If it's "all", keep on searching until no instances of the
//search text are found, if it's "once," search just once.
myFindLimit = myFindChangeArray[2];
if(myFindLimit == "once"){
myFoundItems = myObject.search(app.findPreferences.findText, undefined, undefined, app.changePreferences.changeText);
}
else{
var myLoopLimit = 0;
outsideloop:
do{
//Because it's easy to end up in an endless loop when you set myFindLimit to "all", we need
//to provide a way to get out of the loop.
myFoundItems = myObject.search(app.findPreferences.findText, undefined, undefined, app.changePreferences.changeText);
myLoopLimit ++;
if(myLoopLimit > 100){
var myResult = confirm("Your find/change operation has been run 100 times. Do you want to continue?");
if(myResult == false){
break outsideloop;
}
else{
myLoopLimit = 0;
}
}
if(myCheckSelection == true){
//If myCheckSelection is true, reacquire a reference to the selection each time through the loop.
//You need to do this because deleting/adding characters has the potential to invalidate the
//text reference you're using.
myObject = app.selection[0];
}
}while(myFoundItems.length > 0);
}
//Reset the find/change preferences after each search.
app.changePreferences = NothingEnum.nothing;
app.findPreferences = NothingEnum.nothing;
if(myCheckSelection == true){
//If myCheckSelection is true, reacquire a reference to the selection each time through the loop.
//You need to do this because deleting/adding characters has the potential to invalidate the
//text reference you're using.
myObject = app.selection[0];
}
}
} while(myFindChangeFile.eof == false);
myFindChangeFile.close();
}
}
}
function myFindFile(myFileName){
var myFile;
try{
var myScriptFileName = app.activeScript;
//Get a file reference to the script.
var myScriptFile = File(myScriptFileName);
//Get a reference to the folder containing the script.
var myFolder = myScriptFile.parent;
//Look for the file name in the folder.
if(myFolder.getFiles(myFileName).length != 0){
var myFile = myFolder.getFiles(myFileName)[0];
}
else{
throw "error"
}
}
catch (myError){
myFile = File.openDialog("Choose the file containing your find/change list");
}
return myFile;
}
  View user's profile Private Nachricht senden Website dieses Benutzers besuchen
sheck
Threadersteller

Dabei seit: 25.03.2002
Ort: Luxemburg
Alter: 45
Geschlecht: Männlich
Verfasst Do 18.08.2005 12:09
Titel

Antworten mit Zitat Zum Seitenanfang

Hey,

Hab's nun doch selbst raus gefunden. Die Java-Script-Datei verlinkt auf ne externe Datei:
JSFindChangeList.txt
In dieser Datei kann man nun definierten was gesucht und ersetzt werden soll und so die Datei kontinuierlich erweitern. Einfach genial dieses Skript!
Lächel Lächel
  View user's profile Private Nachricht senden Website dieses Benutzers besuchen
 
Ähnliche Themen XML Skripte und Indesign :-)
[Indesign CS4] Data Merge für Skripte?
InDesign CS3 - Skripte funktionieren nicht
InDesign CS3 Skripte werden nicht ausgeführt
InDesign CS4 Skripte - wer kann so etwas? Wo gibt es die?
[InDesign CS3] Angewendete Skripte wieder rückgängig machen
Neues Thema eröffnen   Neue Antwort erstellen
MGi Foren-Übersicht -> Software - Print


Du kannst keine Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum nicht antworten.
Du kannst an Umfragen in diesem Forum nicht mitmachen.