• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: string count in log file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string count in log file


  • Subject: Re: string count in log file
  • From: Nigel Garvey <email@hidden>
  • Date: Fri, 21 Sep 2001 23:10:27 +0100

Greg Sutherland wrote on Fri, 21 Sep 2001 06:28:56 -0400 (EDT):

>I thought I was beginning to understand. Wrong. I get a count of 0 every
>time. Even when I use the same file which just has one line with one word
>I still get a count of zero. :(
>I've displayed the values of theText and srchStrng and they look correct.
>What am I doing wrong??

[snip]
>set od to AppleScript's text item delimiters
>repeat with srchStrng in srchTbl
> set AppleScript's text item delimiters to srchStrng

srchStrng is a reference in this kind of repeat, not a string, so you're
setting the delimiters to the reference rather than the string to which
it refers. The 'text items of theText' is therefore a list containing
just one item (the whole of 'theText'), so the count - 1 is 0. You need
either to get the 'contents' of the reference:

set AppleScript's text item delimiters to srchStrng's contents

... or to do a pretend coercion:

set AppleScript's text item delimiters to srchStrng as string

or:

set AppleScript's text item delimiters to srchStrng as item

> set theCount to (count text items of theText) - 1
> set rsltText to rsltText & srchStrng & tab & (theCount as text) & return
>end repeat
>
>display dialog rsltText

Don't forget to set the delimiters back to 'od' afterwards. :-)

NG


  • Prev by Date: Re: setting paper size to 'custom' in quark
  • Next by Date: Re: Import a picture into FileMaker without osax
  • Previous by thread: Re: What's the biggest barrier to wider AS adoption?
  • Next by thread: Re: string count in log file
  • Index(es):
    • Date
    • Thread