Re: carriage return trouble
Re: carriage return trouble
- Subject: Re: carriage return trouble
- From: Andrew Oliver <email@hidden>
- Date: Wed, 04 Feb 2004 22:13:45 -0800
Your problem is simple.
The EOF of a file indicates the last character in the file.
When you 'write' to a file starting at the EOF, you overwrite the last
character in the file (in this case, the last return from the previous
write) with the string that you're writing.
You need to start writing at the EOF + 1:
write ("-------" & "alma" & "-------" & return) to openfile starting at
(theeof + 1)
Andrew
:)
On 2/4/04 9:49 PM, "Matyas Ferenc Farkas" <email@hidden> wrote:
>
hi,
>
>
i want to make a file, and write the current time and date in it closed
>
by a return of course. at the end result is does not work, the textedit
>
wraps the text, and the return is not there.
>
>
here is the script and the event log and the result in textedit:
>
tell application "iCal" to set thename to summary of urgentTodo
>
tell application "Finder"
>
try
>
set todofolder to (outputFolder as string) & thename as string as
>
alias
>
set anitems to items in todofolder
>
on error
>
set todofolder to make new folder at outputFolder with properties
>
{name:thename}
>
end try
>
try
>
set filepath to (todofolder as string) & thename & " log.txt" as
>
+class furl;
>
set openfile to open for access filepath with write permission
>
set theeof to get eof of openfile
>
write ("-------" & "alma" & "-------" & return) to openfile
>
starting at theeof
>
close access openfile
>
on error
>
close access openfile
>
end try
>
end tell
>
>
tell application "iCal"
>
get todo 1 of calendar 1
>
--> todo 1 of calendar 1
>
get summary of todo 1 of calendar 1
>
--> "www.apple.com/applescript csekk"
>
end tell
>
tell application "Finder"
>
get every item of alias "Work:output:_my
>
projects:www.apple.com/applescript csekk:"
>
--> {
>
document file "www.apple.com/applescript csekk log.txt" of folder
>
"www.apple.com/applescript csekk" of folder "_my projects" of folder
>
"output" of disk "Work"
>
}
>
open for access file "Work:output:_my
>
projects:www.apple.com/applescript csekk:www.apple.com/applescript
>
csekk log.txt" with write permission
>
--> 61
>
get eof 61
>
--> 127.0
>
write "-------alma-------
>
" to 61 starting at 127.0
>
close access 61
>
end tell
>
>
-------alma--------------alma--------------alma--------------
>
alma--------------alma--------------alma--------------
>
alma--------------alma--------------alma-------
>
>
i am using the latest panther, and i hope i miss something...
>
>
thanks
>
--
>
matyas
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.