• 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: reading a file in an applescript.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reading a file in an applescript.


  • Subject: Re: reading a file in an applescript.
  • From: "Mark J. Reed" <email@hidden>
  • Date: Fri, 21 Mar 2008 16:31:46 -0400

I think you must have a syntax error earlier in your script or
something.  This works for me, at least saved as text and run via
osascript; it cats the contents of the file "repl.txt" in the same
folder as the script:

set replyTemplateName to "repl.txt"

set myPath to (path to me)

tell application "Finder" to set myFolder to (container of myPath) as text

set targetFile to myFolder & replyTemplateName

set readHandle to open for access targetFile

set fileText to read readHandle for get eof readHandle

close access readHandle

fileText


--
Mark J. Reed <email@hidden>
 _______________________________________________
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

  • Follow-Ups:
    • Re: reading a file in an applescript.
      • From: Doug Meade <email@hidden>
    • Re: reading a file in an applescript.
      • From: KOENIG Yvan <email@hidden>
References: 
 >Re: reading a file in an applescript. (From: "Mark J. Reed" <email@hidden>)
 >Re: reading a file in an applescript. (From: Doug Meade <email@hidden>)

  • Prev by Date: Re: reading a file in an applescript.
  • Next by Date: Re: reading a file in an applescript.
  • Previous by thread: Re: reading a file in an applescript.
  • Next by thread: Re: reading a file in an applescript.
  • Index(es):
    • Date
    • Thread