Re: shameless begging
Re: shameless begging
- Subject: Re: shameless begging
- From: Emmanuel <email@hidden>
- Date: Thu, 21 Sep 2006 14:29:40 +0200
At 7:44 AM -0400 9/21/06, Tom Burke wrote:
I'm running OS 10.4.7 on an intel-based iMac, with AppleScript
1.10.7. I am a complete novice so far as AppleScript goes, but I'm
a quick learner if someone can get me booted in the right direction.
Here is my problem:
I have a plain-text TextEdit file with N lines of ascii text. I
need to write each of these N lines into its own file, using a file
name based on the first few symbols on the respective line.
Might someone out there have a script that does this task?
-- untested!!!
set thePath to "Macintosh HD:Users:You:Documents:Whatever"
set theText to read (file thePath) -- a string
set theLines to paragraphs of theText -- a list of N strings
set theFolder to "Macintosh HD:Users:You:Documents:files:" -- the
folder for the new files
repeat with theLine in theLines
set theLine to contents of theLine -- evaluate reference to item in list
set theBeginning to text 1 thru 20 of theLine -- will error is
theLine is shorter than 20 chars
set theRefNum to open for access file (theFolder & theBeginning) with
write permission -- this creates the file and returns a reference
number to it
write theLine to theRefNum
close access theRefNum
end repeat
Emmanuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden