Re: difficulties with read file applescript
Re: difficulties with read file applescript
- Subject: Re: difficulties with read file applescript
- From: Christopher Nebel <email@hidden>
- Date: Sat, 19 Dec 2009 09:35:50 -0800
On Dec 17, 2009, at 12:33 AM, TSK Gmail wrote:
> I am a newbie to MAC and just learning the AppleScripts.. I have a strange problems
>
> While using the following script i get the following output
>
> "{\\rtf1\\ansi\\ansicpg1252\\cocoartf1038\\cocoasubrtf250
> {\\fonttbl\\f0\\fswiss\\fcharset0 Helvetica;}
> {\\colortbl;\\red255\\green255\\blue255;}
> \\paperw11900\\paperh16840\\margl1440\\margr1440\\vieww9000\\viewh8400\\viewkind0
> \\pard\\tx566\\tx1133\\tx1700\\tx2267\\tx2834\\tx3401\\tx3968\\tx4535\\tx5102\\tx5669\\tx6236\\tx6803\\ql\\qnatural\\pardirnatural
>
> \\f0\\fs24 \\cf0 this is a test page\\
> \\
> regards}"
>
> ...
> What am i doing wrong, how do i just get the below and not the ouput?
>
> this is a test page
Others have pretty well answered your specific question, but to give you the higher-level picture:
"read" (and its associated friends, "write", "open for access", etc.) are much lower-level than you're giving them credit for: they give you direct access to the raw bytes of the file. This works fine for plain text (no styles, no markup, nothin' but text), but if the file is structured in any way (such as RTF, a Word document, a FileMaker database, etc.), you'll have to pick through the structure yourself, which is probably more trouble than you want. In such cases, you need to ask the owning application to open the document, and then you can ask it about the document in a structured fashion.
--Chris Nebel
AppleScript Engineering
_______________________________________________
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