• 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: "info for"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "info for"


  • Subject: Re: "info for"
  • From: JollyRoger <email@hidden>
  • Date: Tue, 28 May 2002 06:50:16 -0500

On 5/27/2002 10:41 PM, "David Crowe" <email@hidden> wrote:

> The following toy script ('toy' because you don't need 'info for' to
> get the name of files!) works (on OS X at least):

If all you want to do is get the name of a file or folder, then I would
suggest that you parse it out of the path:

-- begin script
on FilenameFromPath(thePath)
set oldDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set pathAsList to text items of (thePath as text)
if the last character of (thePath as text) is ":" then
set idx to -2 -- (the number of text items in thePath) - 1
else
set idx to -1
end if
set |filename| to item idx of pathAsList
set AppleScript's text item delimiters to oldDelimiters
return |filename|
end FilenameFromPath
-- end script

This is the fastest and least-problematic way to go.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >"info for" (From: David Crowe <email@hidden>)

  • Prev by Date: Re: Write a prefs file
  • Next by Date: Re: Write a prefs file
  • Previous by thread: "info for"
  • Next by thread: Re: "info for"
  • Index(es):
    • Date
    • Thread