• 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: applescript-users digest, Vol 2 #1070 - 16 msgs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: applescript-users digest, Vol 2 #1070 - 16 msgs


  • Subject: Re: applescript-users digest, Vol 2 #1070 - 16 msgs
  • From: Greg Sutherland <email@hidden>
  • Date: Tue, 18 Sep 2001 10:31:52 -0400 (EDT)

I got the following script from Marc Myers. It works just fine, but I
want to get the strings from a list rather than prompt for them. I can
create a list and do a repeat with the items, but I don't know how to get
items of the correct type to work in the statement

set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, text returned of theRslt}

I know that the problem is that my list is type text, but I can't find any
documentation or examples to help with this.

TIA, greg

set theFile to (choose file with prompt "Pick the file to analyze:" of type {"TEXT"})
set theRslt to (display dialog "Enter the string whose occurrences you want to count:" default answer "")
set fileID to (open for access theFile)
try
set theText to (read fileID)
close access fileID
on error m number n
try
close access fileID
end try
error m number n
end try
set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, text returned of theRslt}
set theCount to (count text items of theText) - 1
set AppleScript's text item delimiters to od
display dialog "The string occurred " & (theCount as text) & " time(s)" buttons {"OK"} default button 1


  • Prev by Date: Re: Finding the Path to a renamed File
  • Next by Date: Re: Need help with "out of memory Errors" on server script
  • Previous by thread: Re: Finding the Path to a renamed File
  • Next by thread: Ahem... record on the fly
  • Index(es):
    • Date
    • Thread