• 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: Doug Meade <email@hidden>
  • Date: Fri, 21 Mar 2008 16:58:09 -0400
  • Thread-topic: reading a file in an applescript.

I don't think it's earlier because If I remove the block it runs fine.

When I add the block it fails to compile.

Ugh...

Thanks though - I appreciate the input.



> From: "Mark J. Reed" <email@hidden>
> Date: Fri, 21 Mar 2008 16:31:46 -0400
> To: Doug Meade <email@hidden>
> Cc: <email@hidden>
> Subject: Re: reading a file in an applescript.
>
> 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

References: 
 >Re: reading a file in an applescript. (From: "Mark J. Reed" <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