• 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: Simple newbie question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple newbie question


  • Subject: Re: Simple newbie question
  • From: Paul Scott <email@hidden>
  • Date: Thu, 18 Jun 2009 11:06:45 -0700

Or this:

tell application "Finder" to set fn to alias "Macintosh HD:Users:Shared:Helvetica.Neu.zip"
tell application "Finder" to set ext to name extension of fn
set fne to (do shell script "S=\"" & fn & "\";/bin/echo -n ${S%.\"" & ext & "\"}") as text

Paul

On Jun 18, 2009, at 10:51 AM, CYB wrote:

On Jun 18, 2009, at 9:50 AM, CYB wrote:

As you can see there are many ways to solve a task, in my opinion is more easy this one

tell
application "Finder"
  set MyFile to alias "Lipstick:Users:g5:Desktop:HelveticaNeu.zip"
  set oldTID to AppleScript's text item delimiters
  set AppleScript's text item delimiters to {"."}
  set NameNoExtension to text item 1 of (get name of MyFile)
  set AppleScript's text item delimiters to oldTID
end tell

 
The problem with that is that a file's name may have more than one period in it.  So instead of "text item 1 of ...", use "(text items 1 through -2 of ...) as text"

-- Michelle


Michelle
Well you're right, I never consider that possibility because I think that in not a good idea to use a period into the name of a file, but that doesn’t means that you can’t, so your approach is good enough to solve that point. Thanks

Carlos Ysunza B.
Director
Ysunza/Santiago
Comunicación Visual • Automatización
Tel. (52)55 5256-0336
email@hidden

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: Simple newbie question (From: CYB <email@hidden>)

  • Prev by Date: Re: Simple newbie question
  • Next by Date: Re: Simple newbie question
  • Previous by thread: Re: Simple newbie question
  • Next by thread: Re: Simple newbie question
  • Index(es):
    • Date
    • Thread