• 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: Texand Lists Continued
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Texand Lists Continued


  • Subject: Re: Texand Lists Continued
  • From: Yvan KOENIG <email@hidden>
  • Date: Wed, 2 Sep 2009 12:57:25 +0200


Le 2 sept. 2009 à 12:11:46, Peter Baxter a écrit :

try set fileRef to open for access theFile set textTo to read fileRef
--missing close theFile
set myWords to {}

repeat with myWord in words of textTo
if myWord is in includedStaff then copy return to the end of myWords
if myWord is in includedWords then copy contents of myWord to the end of myWords
end repeat
on error errString
display dialog "There was an error reading the file because:" & errString ¬
buttons {"OK"}
return
end try
myWords

(1) I was fooled because a close theFile is missing

(2) I just edited the last instruction as:
words of (myWords as text)

I made some other changes for the fun.

try
	set includedlist to ""
	set fileRef to open for access includedFile
	set includedlist to read fileRef
	close includedFile
end try
try
	set includedStaff to ""
	set fileRef to open for access teacherCodes
	set includedStaff to read fileRef
	close teacherCodes
end try

set includedWords to every word in (includedlist & includedStaff)
try
set fileRef to open for access theFile
set textTo to read fileRef from 1
close theFile
set myWords to {}

repeat with myWord in words of textTo
if myWord is in includedStaff then copy return to the end of myWords
if myWord is in includedWords then copy contents of myWord to the end of myWords
end repeat
on error errString
display dialog "There was an error reading the file because:" & errString ¬
buttons {"OK"}
return
end try
words of (myWords as text)


Yvan KOENIG (VALLAURIS, France) mercredi 2 septembre 2009 12:57:21



_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Texand Lists Continued (From: Peter Baxter <email@hidden>)

  • Prev by Date: Texand Lists Continued
  • Next by Date: Re: Script Fails in Snow Leopard - Adobe Unit Types.osax - SOLVED
  • Previous by thread: Texand Lists Continued
  • Next by thread: Re: Texand Lists Continued
  • Index(es):
    • Date
    • Thread