MACSCRPT Archives

October 2008

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
RJay Hansen <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Wed, 1 Oct 2008 16:44:15 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (91 lines)
I've got some plain text files of some old Philip K. Dick novels.  
Italic words or passages in these documents are indicated by being  
enclosed in underscores (I posted here a couple of weeks ago with a  
different question about this little project).

The script I'm (slowly) working on is intended to go thru one of  
these documents and find the underscore-enclosed strings and change  
their style to italic while stripping out the underscores. The script  
works mostly, except for failing on some passages as demonstrated in  
the initial post in this thread.

Most of the supposed-to-be-italic strings are single or words or  
short phrases, but there are some longer ones such as the one I've  
quoted here. I suppose I can do a bit more testing to confirm whether  
the issue is the character count.

Thanks!

RJay


On Oct 1, 2008, at 4:08 PM, Paul Skinner wrote:

> It appears that way as your first query was 254 characters and the  
> second exceeded 256. Is there a reason that you are searching for  
> such a large block of text, or are you just testing your code to  
> the edge cases?
>
>
> On Oct 1, 2008, at 5:04 PM, RJay Hansen wrote:
>
>> You think there's a 256 character limit?
>>
>> RJay
>>
>>
>> On Oct 1, 2008, at 3:22 PM, Paul Skinner wrote:
>>
>>> I suspect that it's because the second term is 258 characters.
>>>
>>> On Oct 1, 2008, at 3:12 PM, RJay Hansen wrote:
>>>
>>>> Using Tex-Edit Plus' "search" command from the Tex-Edit Suite in  
>>>> its AppleScript dictionary, on this paragraph:
>>>>
>>>> "And, as Lantano made his way through the basement, among the  
>>>> cots, stepping over people, their meager stores, saying hello  
>>>> here, smiling to someone there, Nicholas thought, _My god, when  
>>>> he came through the entrance he looked like an old man,  
>>>> weathered, dried-out, but now, closer, Lantano appeared middle- 
>>>> aged; the aura of extreme age had been an illusion due to the  
>>>> scrawny quality of the man and the peculiar stiffness in the way  
>>>> he walked; it was as if he were delicate, feared an injury, a  
>>>> fall._"
>>>>
>>>> If I do this:
>>>>
>>>> tell application "Tex-Edit Plus"
>>>> 	search paragraph 2 of document 1 looking for "My god, when he  
>>>> came through the entrance he looked like an old man, weathered,  
>>>> dried-out, but now, closer, Lantano appeared middle-aged; the  
>>>> aura of extreme age had been an illusion due to the scrawny  
>>>> quality of the man and the peculiar stiffness in the"
>>>> end tell
>>>>
>>>> Tex-Edit selects the string within the paragraph and the script  
>>>> returns "true". However if I add one more word to that search  
>>>> string like so:
>>>>
>>>> tell application "Tex-Edit Plus"
>>>> 	search paragraph 2 of document 1 looking for "My god, when he  
>>>> came through the entrance he looked like an old man, weathered,  
>>>> dried-out, but now, closer, Lantano appeared middle-aged; the  
>>>> aura of extreme age had been an illusion due to the scrawny  
>>>> quality of the man and the peculiar stiffness in the way"
>>>> end tell
>>>>
>>>> I get an error:
>>>>
>>>> Tex-Edit Plus got an error: Can't make some data into the  
>>>> expected type
>>>>
>>>> with "search paragraph 2 of document 1 looking for......etc"  
>>>> highlighted.
>>>>
>>>> Anyone have any ideas what the problem is here? A bug?
>>>>
>>>> Thanks,
>>>>
>>>> RJay

ATOM RSS1 RSS2