• 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
reading from a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

reading from a file


  • Subject: reading from a file
  • From: Alex Morken <email@hidden>
  • Date: Wed, 5 Dec 2007 14:44:36 -0800

Hello,

I have a very frustrating issue.  I enter this as my script:

try
set fpath to posix file "/private/tmp/p.txt"
set f to open for access file fpath
set r to read f
close access f
display dialog r
end try

When I run this script by itself it works.

If I copy and paste that into a folder action it does not run. Below:

on adding folder items to this_folder after receiving added_item
try
do shell script "command > /private/tmp/p.txt"
try
set fpath to file "Macintosh HD:private:tmp:p.txt"
set f to open for access file fpath
set r to read f
close access f
display dialog r
end try
end try
end adding folder items to

Any reason why this wouldn't work?  

Also interesting is that it doesn't work if I change the 'display dialog r' to 'display dialog " " & r'.  In the script editor the path to the file also changes font ever so slightly when I change that line and try to run it. ???  I really am baffled by this.  I am pretty new to applescript, but I have never experienced an issue like this in other languages.

Thank you,

Alex


 _______________________________________________
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

  • Prev by Date: Re: Two mail.app applescript bugs
  • Next by Date: Re: am I missing something... Numbers
  • Previous by thread: Creating an iCal event from within Filemaker Pro
  • Next by thread: Any way to use "path to me" when a script/app is hidden
  • Index(es):
    • Date
    • Thread