MACSCRPT Archives

January 2011

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Daniel A. Shockley" <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Thu, 20 Jan 2011 23:48:24 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (31 lines)
> I recommend that, in spite of its apparent verbosity, you _always_ use
>
> AppleScript's text item delimiters
>
> JD

I agree with John. I would also say this whole thing is a good
candidate for a handler (function).

Another thing: I'm a firm believer in restoring the AppleScript's text
item delimiters to their previous state when I'm done with them:


on removeExtension(somePath)
	
	set {oldDelims, AppleScript's text item delimiters} to {AppleScript's
text item delimiters, "."}
	set pathWithoutExtension to (text items 1 through -2 of somePath) as string
	set AppleScript's text item delimiters to oldDelims
	
	return pathWithoutExtension
	
end removeExtension

Note also that one of the previous posters left off the "as string"
(or "as text"), which would result in a list of the parsed strings -
not what you want here.


Dan Shockley

ATOM RSS1 RSS2