SE ParagraphStyles in a text file
Hi all
How to get all the paragraph style to a text file names.
Thanks in advance
Learner
Hi the learner,
Please use the JS code below, becomes paragraph styles only. If you need styles of characters as you can simply change.
var Report = new File("~/Desktop/Styles_Report.txt" ); Report.open("w"); var Styles = (app.activeDocument.allParagraphStyles); var i = Styles.length; while (i--){ Report.writeln(Styles[i].name+"\n") } Report.close();
THX,
csm_phil
Tags: InDesign
Similar Questions
-
Export to text file paragraph Style
I have an InDesign document (several really), where I would like to extract all the text formatted with a paragraph style to create a glossary.
I looked at ChangeCaseofSelectedStyle ExportAllStories and Dave Saunder trying to cobble something together (my scripting skills are next to zero). I had that day, now I'm stuck and errors.
Any help?
If ((app.documents.length! = 0) & & (app.selection.length! = 0)) {}
myDoc = app.activeDocument;
myStyles = myDoc.paragraphStyles;
myStringList = myStyles.everyItem () .name;
myExportFormatList = ['Text only', 'RTF', 'Text referenced InDesign'];myDialog = app.dialogs.add var ({name: "ExtractParagraphByStyle"})
{with (MyDialog)}
{with (dialogColumns.Add ())}
with (dialogRows.add ()) {}
with (dialogColumns.add ()) {}
staticTexts.add ({staticLabel: "Style of paragraph :"});})
}
with (dialogColumns.add ()) {}
myStyle = dropdowns.add({stringList:myStringList,selectedIndex:0,minWidth:133});)
}
}
with (dialogRows.add ()) {}
with (dialogColumns.add ()) {}
staticTexts.add ({staticLabel: "export as :"}); "})
}
with (myExportFormatButtons = {radiobuttonGroups.add ())}
radiobuttonControls.add ({staticLabel: "Text only", checkedState:true});})
radiobuttonControls.add({staticLabel:"RTF"});)
radiobuttonControls.add ({staticLabel: "InDesign tagged text"});
}
}
}
}
myReturn = myDialog.show ();
If (myReturn == true) {}
Get the values of the dialog box.
myExportFormat = myExportFormatButtons.selectedButton;
myDialog.destroy;
myFolder is Folder.selectDialog ("select a file");.
If ((mondossier! = null) & & (app.activeDocument.stories.length! = 0)) {}
myExtractParagraphByStyle (myExportFormat, myFolder);
}
}
else {}
() myDialog.destroy; s
}
}myExportStories function handles the export of the stories.
myExportFormat is a number between 0-2, where 0 = text only, 1 = 3 = tagged text and rtf.
myFolder is a reference to the folder in which you want to save your files.
function myExtractParagraphByStyle (myExportFormat, myFolder) {}
for (myCounter = 0; myCounter < app.activeDocument.stories.length; myCounter ++) {}
monarticle = app.activeDocument.stories.item (myCounter);
myID = myStory.id;
{Switch (myExportFormat)}
case 0:
myFormat = ExportFormat.textType;
myExtension = 'txt '.
break;
case 1:
myFormat = ExportFormat.RTF;
myExtension = ".rtf".
break;
case 2:
myFormat = ExportFormat.taggedText;
myExtension = 'txt '.
break;
}
myFileName = "StoryID" + myID + myExtension;
CheminMonFichier = myFolder + "/" + myFileName.
myFile = new File (myFilePath);
myStory.exportFile (myFormat, myFile);
}
}
+++ Functions start here +++function errorExit (message) {}
If (arguments.length > 0) {}
If (app.version! = 3) {beep()} / / CS2 includes beep() function.
Alert (message);
}
Exit(); CS ends with a beep; CS2 left silently.
}The example script, export all the text to the file might give you some clues:
ExportAllText.jsx
An InDesign CS4 JavaScript
//
Export all the text in the active document with a single
text file. To do this, the script will create a new document,
combine the stories in the new document using export/import
and then export the text into the new document.
main();
main() {} function
mySetup();
mySnippet();
myTeardown();
}
function mySetup() {}
myDocument var = app.documents.add ();
myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
myDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
myPage var = myDocument.pages.item (0);
var myTextFrameA = myPage.textFrames.add ();
myTextFrameA.geometricBounds = [72, 144, 72, 288];
myTextFrameA.contents = 'This is story 1.';
var myTextFrameB = myPage.textFrames.add ();
myTextFrameB.geometricBounds = [72, 300, 228, 288];
myTextFrameB.contents = 'This is the story 2.';
var myTextFrameC = myPage.textFrames.add ();
myTextFrameC.geometricBounds = [72, 444, 312, 288];
myTextFrameC.contents = 'This is the story of 3.';
}
function mySnippet() {}
//
If (app.documents.length! = 0) {}
If (. stories.length app.documents.item (0)! = 0) {}
myExportAllText (app.documents.item (0) .name);
}
}
//
}
function myTeardown() {}
}
//
function myExportAllText (myDocumentName) {}
var monarticle;
File name for the exported text. Specify a valid file on your system path.
var myFileName = "/ c/test.txt ';
If you want to add a line of separation between the floors, myAddSeparator set to true.
var myAddSeparator = true;
var myNewDocument = app.documents.add ();
var app.documents.item (myDocumentName) = myDocument;
var myTextFrame = myNewDocument.pages.item (0).textFrames.add ({geometricBounds:myGetBounds (myNewDocument, myNewDocument.pages.item (0))});
var myNewStory = myTextFrame.parentStory;
for (myCounter = 0; myCounter)< mydocument.stories.length;="">
monarticle = myDocument.stories.item (myCounter);
Export the story as tagged text.
myStory.exportFile (ExportFormat.taggedText, leader (myFileName));
Import (place) the file at the end of the temporary history.
myNewStory.insertionPoints.item(-1).place (File (myFileName));
If the imported text does not end with a return, enter a return
to keep the stories running together.
If (myCounter! = myDocument.stories.length-1) {}
If (myNewStory.characters.item(-1).contents! = '\r') {}
myNewStory.insertionPoints.item(-1).contents = "\r";
}
if(myAddSeparator == true) {}
myNewStory.insertionPoints.item(-1).contents = '-\r ";
}
}
}
myNewStory.exportFile (ExportFormat.taggedText, File("/c/test.txt));
myNewDocument.close (SaveOptions.no);
}
//
function myGetBounds (myDocument, myPage)}
var myPageWidth = myDocument.documentPreferences.pageWidth;
var myPageHeight = myDocument.documentPreferences.pageHeight
if(MyPage.Side == PageSideOptions.LeftHand) {}
var myPage.marginPreferences.left = myX2;
myX1 = myPage.marginPreferences.right var;
}
else {}
var myPage.marginPreferences.left = myX1;
myX2 = myPage.marginPreferences.right var;
}
var myY1 = myPage.marginPreferences.top;
myX2 var = myPageWidth - myX2;
var myY2 = myPageHeight - myPage.marginPreferences.bottom;
return [myX1, myY2, myY1, myX2];
} -
AppleScript to delete a text file
Hi, here is a job Applescript that lists the contents of a folder and its subfolders to a text file named 'file inventory. The problem, for example, is that if a subfolder is emptied of files, the list of his previous content is always indicated in the text of the inventory of the last time file that the script is run. So, I would delete all of the text in the file until it is written again. I searched and found this code and put my name of file in there, but I can't make it work.
Any help will be appreciated.
expressions of folklore ": folder files inventory.txt" value 0
property file_id: null
tell application "Finder" for the value this_folder for folder 'movies' from disk 'files '.
the value log_file_path to ": folder files Inventory.txt.
file_id value to open access file log_file_path with write permission
Try
write ('Start' & (current date) & back) to file_id
my do_subfolders (this_folder, "")
write (back & return) to file_id
file_id of close access
say "finished".
we error error message
file_id of close access
errMsg say
end try
on do_subfolders (this_folder, name_prefix)
say application 'Finder '.
Journal name_prefix & string (name of this_folder)
write (back & name_prefix & (name of this_folder) chain ) to file_id
the value File_List for each file in this_folder
Repeat with this_file in File_List
Journal name_prefix & "" & string (name of this_file)
write (back & name_prefix & "" & (name of this_file) chain ) to file_id
end Repeat
the value folder_list for each folder in this_folder
Repeat with this_subfolder in folder_list
my do_subfolders (this_subfolder, "" & name_prefix)
end Repeat
end say
end do_subfolders
You are on the right track, but set the folklore expressions takes the file reference that you have already opened, not the path text.
so, since you open the file via:
file_id value to open access file log_file_path with write permission
the appropriate solution would be:
file_id of the folklore of the value to 0
-
Is there a way to open the text files with arbitrary extensions?
As part of the mobile platform iOS, is possible to open arbitrary text files that have an arbitrary extension? For example, in the course of my work day, I meet regularly with plain text files that have an .out extension. I'd love to be able to open these simply with iOS notes without renaming them in .txt. I meet many of them and only need to do this for a few minutes, so take the time to rename them significantly adds both.
On the desktop a BONE can generally "open with", then choose the application. I'm looking for the equivalent in iOS. Please note that to access the files on iOS is not a problem with icloud drive, dropbox, etc.. they just can not be opened easily. Simple text editor, word processor not full blown.
You will need a software that can handle the file.
Usually the file management applications can manage any type of file. I like the 5 Documents to Readdle, it can open almost anything.
https://iTunes.Apple.com/us/app/documents-5-file-system-PDF/id364901807?Mt=8
The equivalent of 'Open with' in the iOS is "open in", 'Share xxx' or even 'Copy To '.
How to get to it, depends on where the file is located.
ICloud drive for example, you can do open the file in a specific application by holding your finger on the icon of the file and by selecting more «...» "in the menu that appears, and then selecting"Share point... ". "and finally select an application from the list.
-
Create the file CSV to edit the text file
I am trying to convert an image list to a CSV file, so I can import it into a Web site. But the Web site importer does not recognize out of editing text in CSV. I am registering as a simple text file. When I create dummy data in a spreadsheet and the export to CSV is exactly the same when I opened in text editing, but it matter perfectly.
Any ideas?
The following thread might solve your issue.
-
How can I put all the mail to a folder in a text file?
I want to put all the lines of the object to a file (any file) in a text file for analysis of traffic.
Right-click on a folder, ImportExportTools/export all messages in the folder/just index (CSV or HTML).
-
Here is the message from text file:
%% [ProductName: Distiller] %.
X8AEC0BD1 not found, by using the messaging service.
%% [Error: invalidfont;] [OffendingCommand: show] %.Battery:
()%% [Flushing: rest of job (end of file) will be ignored] %%.
%% [Warning: PostScript error.] No PDF file produced. ] %%What print driver are you using to print to PDF. Firefox is not any printer to print a page in PDF format.
I use CutePDF , if you are interested. It's free.
-
How can I save an email as a text file before you delete it my Inbox?
Some emails I want to save on my computer so that I can view without opening to the top of my email. I'm used to be able to do this by registering in a document as a text file folder. (Outlook express). I don't find this capablity in Thunderbird. If it is there, I have not found it.
File | Register under gives you several options. By default, it will save in an .eml file, which will need an e-mail client to display. You can usually save drag-and-drop, but that creates an .eml file too.
You can save as HTML by putting in a file html extension when you do file | Save as.
This add-on:
https://NIC-NAC-project.org/~kaosmos/mboximport-en.html
offers several options to save one or more messages in different formats.
-
How can I convert a page typed into an editable text file
How can I convert a page typed in an edible text file? I have a 50 page typed (on a typewriter ;-) document I want to convert (scan?) in a format so that I can then open the file in a text editing application (Word?) and edit.
How is the most effective (and least expensive) way to do it?
Thank you
HAL
< re-titled by host >
"Edible text file?" You hear as he print on rice paper, so you can serve it up like at dinner side dish? You want someone to eat their words
I think that the last two multifunction printers, I bought came with some kind of OCR characters (OCR) software as part of the sweeping package. I guess that's not the greatest.
-
Our clients have trouble downloading a text file (.txt) on our site version 33.0 (using a filestream). It worked well in previous versions.
The error message they get reads as follows:
{name of file and download user path} not can be saved, because the source file could not be read.Thank you
MikeIt is an old relative to corrupted downloads (http://kb.mozillazine.org/Source_file_could_not_be_read) error message, but has become more widespread in Firefox 33.
To make a long story short... before, if the server sent a response which was smaller than the specified size, the gap has been ignored and the download was considered to be very good. From Firefox 33, a file that is smaller than the specified size is considered as being damaged.
This comment in the bug tracking system has more information: https://bugzilla.mozilla.org/show_bug.cgi?id=1083090#c8
-
Automator: using a text file to set several items from the finder?
Hello
what I would do:
I have a text file that contains multiple entries for files and folders, each on a separate line. I want to dragndrop this file on an automator action, he should ask me a destination folder and then copy all the files and folders in this folder.
I have my action, automator, set up like this:
Elements of the open Finder
Get the content of the TextEdit Document
Copy to the Clipboard (I have not found another way to keep my text sort file values and let it not be crushed by the following, but it works)
Quit the Application (TextEdit)
Ask the Finder items (this requires a destination folder)
Set the value of the Variable (Destination)
Get the contents of the Clipboard
Copies the items from the Finder (at Destination)
It all works, but only when there is 1 entry in my text file. As soon as I have 2 lines of text, I get the following error message:
The action "copy Finder items" has not provided with the required data.
How can I make this work with multiple entries?
The problem is that you only pass the only element to the copy action (you have copied text), instead of an element for each line (paragraph) in the text. The solution is to use the action filter paragraphs to break up along the borders of paragraph text, which will give you a list of items. In addition, you do not necessarily have to use TextEdit or the Clipboard - If you already have a file somewhere, you can simply use the action to combine text files to read the text.
With the above modifications, your workflow should look like:
Ask the Finder items (ask for a destination folder)
Set the value of the Variable (Destination)
Ask the Finder items (Download text files) - set the action to ignore the entry
Combine text files (read the text files)
Filter paragraphs (paragraphs which are not empty return)
Copy the items to the Finder (at Destination)
-
USB for my iPhone, so it can read a text file
Hi, I would like to be able to connect a standard USB to my iPhone, so it can read a text file from USB, any suggestions on cable/apps? Thank you, Tony
Hello. In fact, you can use any USB adapter to connect your iPhone to the computer and transfer text files. Apple recommends the adapter like this http://www.apple.com/shop/product/MD820AM/A/lightning-to-micro-usb-adapter
-
I need to scratch the data of a few 1000 + email. How can I believe more easily the content of these emails and either push in text files, or treat them with a script?
Thank you
Install ImportExportTools:
https://addons.Mozilla.org/en-us/Thunderbird/addon/ImportExportTools/
http://chrisramsden.vfast.co.UK/3_How_to_install_Add-ons_in_Thunderbird.html
Copy the messages in a folder, select the folder, tools/ImportExportTools/export all of the messages in the text file / in the single folder.
-
In a sequence of CTF, is it possible to obtain a text file of clips in sequences display (name and duration)? There is a display of text file for clips (cmd-9). Zoom the timeline makes this visible annotation for shorts, cancels but the ability to see the whole sequence of the time line. Of course, it would help my editing.
TIA
In Final Cut Pro 7, you can use editing > find command to search on used clips in the sequence. See if there is an equivalent command in FCE. Unfortunately, I can't determine that at first hand on my system. (In addition, if you are still interested whereas FCP X, there the so-called Timeline index which provides quick access to a list of markers, clips, effects, etc..)
Good luck.
Russ
-
Why the FF fix the links click on a text file, but IE10 works fine?
I'm composing a text file LibreOffice prepare for the publication of an e-book. In this text I incorporated hyperlinks to locations on the map Icelanders for the development system. I replaced these links with Google URL shortener for easy management and use.
When I test the links with FF as the default browser on this laptop under Win8/64, FF tries to open the pages of the card but stalls with no image displayed. In IE10, however, they work very well. These links also work on FF or IE on Windows 7/64 on my desktop.
In addition, when I click on the same link listed in my account Google shortened the list of URLS, it works in both FF and IE on this same laptop - only when the user clicks on the link in the doc file. fact FF fail to open the page target card. This is the case if the OL WRITE option 'Ctrl + click' or simply 'click' is specified.
Doc file: LibreOffice 4.1.x with hyperlinks embedded URL "googleized", usually a clickable link to graphic character after the place agreed.
Target Web site: http://atlas.lmi.is/kortasja_en/ zoom to specific locations.
Note that the http://atlas.lmi.is/kortasja_en/ page is a Flash object, so check the address bar to see if there is an icon to the left of the address bar on the blocking of the version of the Flash plugin.
Maybe you are looking for
-
Why my Add ons uninstall whenever I restart Firefox?
I re - install add ons, but whenever I restart, they are all gone once more. I uninstalled Firefox and re-installed and I still have the same problem.
-
Share iTunes media to external drive issues
I think I know 'how' to do it, but have a question about what happens if I go this way. Background: Set up a new iMac and put our music on an external drive. I have my card to the library user account using 'alt' / find the process of the library. N
-
Satellite A200 - touch pad does not work with Windows 7
Hello I have an A200 and that you have upgraded to Windows 7. Can someone help me with how I can get the touchpad to work?I would be very gratefull for any advice.Thanks in advance
-
Starting process blocking application
I have an application that uses a test internal client (no labview) to test a server. Use of LabVIEW makes API calls to control this client. I need to start the test client before I can control and most of the time it works pretty well. However quite
-
I can't perform a system restore, how to fix system errors?
I clicked on system restore, and I was told that the restoration will not be complete.