Error during command authentication.
Error - unable to initiate communication with LISTSERV (errno=10061, phase=CONNECT, target=127.0.0.1:2306). The server is probably not started.
This got me to thinking and I knocked this out. It generates a file named "(originalFilename)_Italicized.rtf" right next to the source file you choose. Let me know how this does on you r large text file, I'm curious. try set head to "{\\rtf1\\ansi\\ansicpg1252\\cocoartf949\\cocoasubrtf350 {\\fonttbl\\f0\\fswiss\\fcharset0 Helvetica;} {\\colortbl;\\red255\\green255\\blue255;} \\margl1440\\margr1440\\vieww12240\\viewh15840\\viewkind1 \\pard\\tx720\\tx1440\\tx2160\\tx2880\\tx3600\\tx4320\\tx5040\\tx5760\ \tx6480\\tx7200\\tx7920\\tx8640\\ql\\qnatural\\pardirnatural \\f0\\fs24 \\cf0 " set tail to "}" try tell application "Finder" activate set fileRef to choose file with prompt "Choose an underscore delimited plaintext file for input." set fileRefName to name of fileRef set AppleScript's text item delimiters to "." copy text item 1 of fileRefName to fileRefName set AppleScript's text item delimiters to "" set fileRefPath to ((container of fileRef) as alias) as text end tell set fileRefHandle to open for access fileRef set outFileHandle to open for access file (fileRefPath & fileRefName & "_Italicized.rtf") with write permission on error e number n display dialog "Error: " & (n as text) & return & e end try set textoutput to {} set evenOddOpenCloseItalicsToggle to 0 repeat try set currentChunk to read fileRefHandle until "_" if evenOddOpenCloseItalicsToggle is 0 then if currentChunk is "_" then set the end of textoutput to (ASCII character 32) & "\\i " as text else set the end of textoutput to (text 1 thru -2 of currentChunk) & (ASCII character 32) & "\\i " as text end if set evenOddOpenCloseItalicsToggle to 1 else set the end of textoutput to (text 1 thru -2 of currentChunk) & (ASCII character 32) & "\\i0" as text set evenOddOpenCloseItalicsToggle to 0 end if on error set thischunk to (read fileRefHandle until end) set the end of textoutput to thischunk as text exit repeat end try end repeat try display dialog "Error: " & (n as text) & return & e end try on error e number n display dialog "Error: " & (n as text) & return & e end try write head & (textoutput as text) & tail to outFileHandle as text try close access fileRefHandle close access outFileHandle end try On Oct 2, 2008, at 4:36 PM, RJay Hansen wrote: > On Oct 2, 2008, at 1:59 PM, Bill Steele wrote: > >> Unless you need this to happen in front of people's eyes, you don't >> have to do it in Tex-Edit. You can operate on an Applescript string >> variable with the search features in the ACME Script Widgets or >> Satimage OSAXen. > > Can you do the text styling though? From what I've been able to > determine, you can't although I'd be happy to be shown I'm wrong. > >> Finding what's between two underscores also could be a regular >> expression job. > > I actually thought of this yesterday when someone on the A.S.S. list > mentioned regular expressions. However, I've got that part of the > script working fine. I suspect using regular expressions to do that > would be quicker, but what I've got goes pretty fast. > > RJay