• 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: Getting file suffix
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting file suffix


  • Subject: Re: Getting file suffix
  • From: KOENIG Yvan <email@hidden>
  • Date: Mon, 13 Sep 2010 16:05:09 +0200

Le 13 sept. 2010 à 12:27, LuKreme a écrit :

>
> I have a folder action I'm working on where I am trying to get the suffix of a file name that has been dropped into the folder
>
> I have the following bit of code in the main routine:
>
> display dialog "Getting File Suffix"
> if this_item contains "." then
> 	set oldDelims to AppleScript's text item delimiters
> 	set AppleScript's text item delimiters to "."
> 	set item_suffix to text item -1 of this_item
> 	set AppleScript's text item delimiters to oldDelims
> end if
> display dialog "Suffix is " & item_suffix


display dialog "Getting File Suffix"
set this_item_txt to "" & this_item
if this_item_txt contains "." then
	set oldDelims to AppleScript's text item delimiters
	set AppleScript's text item delimiters to "."
	set item_suffix to text item -1 of this_item_txt
	set AppleScript's text item delimiters to oldDelims
end if
display dialog "Suffix is " & item_suffix

will do the trick.

The important thing is that the instruction

set this_item_txt to "" & this_item
will give you a text item which will be accepted by the text item delimiters code.

Yvan KOENIG (VALLAURIS, France) lundi 13 septembre 2010 16:05:01



 _______________________________________________
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: 
 >Getting file suffix (From: LuKreme <email@hidden>)

  • Prev by Date: Re: Getting file suffix
  • Next by Date: Re: InDesign Server speed?
  • Previous by thread: Re: Getting file suffix
  • Next by thread: Re: Getting file suffix
  • Index(es):
    • Date
    • Thread