Re: Read for 1000 until nearest space? - Almost
Re: Read for 1000 until nearest space? - Almost
- Subject: Re: Read for 1000 until nearest space? - Almost
- From: Joe <email@hidden>
- Date: Tue, 14 Oct 2008 12:13:06 -0700
Profound thanks to Phillip and Paul for their help. I have a
script that reads a file piece by piece - If I use "display
dialog" to look at each chunk. I have a problem though with
writing the last piece to a file.
This script does read the last piece of a file (as evidenced
by turning on logging) but it doesn't write the last chunk to
a file as it does previous chunks. It seems the error I'm
trapping gets thrown before the last write is done, but I
can't find a way to fix it.
--My script
tell application "Finder"
set myfile to the selection as alias
set flname to name of myfile
end tell
set filcnt to 0
set fr to open for access myfile
try
repeat
set filcnt to filcnt + 1
set rd1 to read fr for 2000
set rd2 to read fr until space
set chunx to (rd1 & rd2) as string
set nfr to open for access file ((path to desktop folder as string) & filcnt & " " & flname) with write permission
write chunx to nfr
close access nfr
end repeat
on error
try
close access fr
end try
end try
Thanks
Joe
_______________________________________________
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