Re: reading a file in an applescript
Re: reading a file in an applescript
- Subject: Re: reading a file in an applescript
- From: "Stockly, Ed" <email@hidden>
- Date: Fri, 21 Mar 2008 15:58:15 -0700
- Thread-topic: reading a file in an applescript
Here's how I would do it ...
set replyTemplateName to "testText"
--there must be a file with this name in the location
tell application "Finder"
set theScriptPath to (container of (path to me)) as alias
set targetFile to file replyTemplateName of theScriptPath as alias
end tell
--or, if you have other reasons for coercing string to alias
-- set targetFile to ((theScriptPath as string) & replyTemplateName) as
alias
set readHandle to (open for access targetFile)
set fileText to (read readHandle for (get eof readHandle))
close access readHandle
fileText
> "the", "a", and some other articles are totally ignored by Applescript.
"a" is not ignored by applescript and can actually be used as a variable.
the file "foo"
--compiles
a file "foo"
--doesn't compile
I don't believe any words other than "the" are ignored by AppleScript.
HTH,
ES
_______________________________________________
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