• 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: Shane Stanley <email@hidden>
  • Date: Sat, 22 Mar 2008 09:25:09 +1100
  • Thread-topic: reading a file in an applescript.

On 22/3/08 6:58 AM, "Doug Meade" <email@hidden> wrote:

>    tell application "Finder"
>
>           set theScriptPath to (container of application file (path to me) as
> Unicode text)
>
>     end tell
>
>     set theTextFile to (theScriptPath & replyTemplateName)
>
>     set targetFile to theTextFile
>
>     set readHandle to (open for access targetFile)
>     set fileText to (read readHandle for (get eof readHandle))
>     close access readHandle
>     FileText

The read command requires a file reference or alias, not a path. So:

tell application "Finder"
    set theScriptPath to (container of application file (path to me) as
Unicode text)
end tell
set theTextFile to (theScriptPath & replyTemplateName)
set targetFile to theTextFile
set fileText to (read file readHandle)

--
Shane Stanley <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: Doug Meade <email@hidden>)

  • Prev by Date: Re: getting return from apple event
  • 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