Re: Creating/saving/appending to files the Cocoa way
Re: Creating/saving/appending to files the Cocoa way
- Subject: Re: Creating/saving/appending to files the Cocoa way
- From: Robert DuToit <email@hidden>
- Date: Sun, 17 Jan 2010 20:09:56 -0500
Hi John,
It's not OBJ-C but I use 'echo' to write my log files...
set somestring to "stat info"
set filePath to (POSIX path of (path to desktop)) & "newfile.txt"
set oldtext to do shell script "cat " & quoted form of filePath
set newtext to oldtext & tab & somestring
do shell script "echo " & newtext & " >" & quoted form of filePath
Rob
On Jan 17, 2010, at 2:23 PM, John C. Welch wrote:
> Okay, so I know how to create/save/append to files via the standard Applescript methods. However, I’d like to do it the “Proper” AppleScriptObjC way, (if there really is such a thing), as if nothing else, it expands my knowledge. My application is not a document-based application, but if the user wants, they can save the wireless stats they’re observing into a tab-delimited text file, so they can make pretty pictures of it, etc. in other applications, Excel, Numbers, what have you.
>
> It looks like the quick & dirty way to create a file is to useNSFileManager’s createFileAtPath, but that seem to be more for a one time dump, whereas I’m looking at a set of writes over time. There also doesn’t seem to be much in the way of appending data to an existing file there, other than slurping the entire file, jamming new data on the end, and rewriting it.
>
> I’m guessing/hoping that I’m missing something here?
>
> --
> Love:
>
> A temporary insanity curable by marriage.
>
> Ambrose Bierce
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> applescriptobjc-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden