• 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: read a file - Lion vrs Tiger
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read a file - Lion vrs Tiger


  • Subject: Re: read a file - Lion vrs Tiger
  • From: Jim Brandt <email@hidden>
  • Date: Wed, 26 Sep 2012 14:09:21 -0500

On 26-Sep-2012, at 1:41 PM, Christopher Stone wrote:

You have compiled this on the Lion box - yes?


Yes, I've recompiled. I've had to change how I picked up all my Library locations - a week for editing scripts    ;>)

Note to self - don't wait 12 years to upgrade machines in the future...


You are using TextCommands on the Lion box?  And you've tested it?  It's sort of long-in-the-tooth, but then again Hamish wrote it.

There's a better way, that handles regex expressions? Pray tell, enlighten me.


   tell application "Finder" to set nm to name of eachFile
   tell application "Finder" to set knd to kind of eachFile as text 

Tell the Finder once in a block.  Don't make multiple calls unless necessary.

tell application "Finder"
set nm to name of eachFile
set knd to kind of eachFile as text
end tell

I asked this question several months ago (or was it years?) and was told it was not a significant time hit. The faster the processor the less significant?


         set FileRef to open for access theFile

Don't open the file for access.  Just read it.  Opening is only necessary for writing.

I don't know how many files you're dealing with but if more than a few I'd probably grab a list of paths and then use regex to filter them rather than looping in the Finder.



Just following the example in Matt Neuburg's book Applescript, the Definitive Guide, page 371. Never said read meant open for access was optional. In Fact, it says under "open for access" :
Opens a file for read access – optionally, for write access …
I understood that to mean the open was for read and, if needed, for write.

I make changes and report back.

Thanks.
 _______________________________________________
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: 
 >read a file - Lion vrs Tiger (From: Jim Brandt <email@hidden>)

  • Prev by Date: Re: read a file - Lion vrs Tiger
  • Next by Date: Re: read a file - Lion vrs Tiger
  • Previous by thread: Re: read a file - Lion vrs Tiger
  • Next by thread: Re: read a file - Lion vrs Tiger
  • Index(es):
    • Date
    • Thread