• 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: logging to a file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: logging to a file?


  • Subject: Re: logging to a file?
  • From: kai <email@hidden>
  • Date: Sat, 13 Nov 2004 00:28:10 +0000


On Fri, 12 Nov 2004 18:52:49 -0500, Aaron Rosenblum wrote:

Two quick questions. I have this code that I want to log to a file. (Basically like NSLog) How do I insert a newline at the end of the line I am writing to a file, and also how to I dynamically resolve the path to the users home folder instead of hard coding it.

sorry if these are simple questions, but im an AS newbie...

Aaron

set theTargetFile to ("Macintosh HD:Users:myuser:output.txt" as string) as file specification
try
open for access theTargetFile with write permission
write ((current date) & "Working on " & this_item as string) to theTargetFile starting at eof
close access theTargetFile
end try

-----------------

set theTargetFile to (path to "cusr" as Unicode text) & "output.txt"
set f to open for access file theTargetFile with write permission
write return & (current date) & ". Working on " & this_item to f starting at eof
close access f


-----------------

---
kai

_______________________________________________
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


  • Follow-Ups:
    • Re: logging to a file?
      • From: kai <email@hidden>
  • Prev by Date: logging to a file?
  • Next by Date: Re: Count lines
  • Previous by thread: Re: logging to a file?
  • Next by thread: Re: logging to a file?
  • Index(es):
    • Date
    • Thread