Summarizing the contents of files
If you manage large numbers of text files, you may want to see a summary of the contents of a file. The Standard Additions dictionary (located in the Scripting Additions folder) includes the term Summarize that lets you do this.
To see the syntax of the Summarize command: The Summarize command requires the text to summarize. You can provide the actual text, or you can provide an alias to a text file or a file specification of a text file, including the name of any folders you have to open to see the file. For example, a file specification might look like this: My Disk:Documents Folder:Text File You would probably want to use this command to summarize any file, so the script needs to let you pick which file to summarize. The following example uses two other commands defined in the Standard Additions dictionary: This script lets you select one file at a time and displays the summary in the Results window in the Script Editor. You can also see the summary of several files, including those in folders, when you don't have the Script Editor open. The following example includes an On Open handler, so you can use it as a droplet script. To use this script, save it as an application, then drag files to it in the Finder. The script shows a summary of any text files you drop on the script.
|
|||||||||
Table of contents |