• 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: Replace slash by underscroe in file name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replace slash by underscroe in file name


  • Subject: Re: Replace slash by underscroe in file name
  • From: "Adam Bell" <email@hidden>
  • Date: Thu, 23 Mar 2006 12:33:29 -0400

And to add to Paul's excellent explanation, the reason Kai's script has "set d to text item delimiters" at the front of his handler is to preserve whatever they might have been when the handler was called, and then restore them before returning. Because TIDs are global, a change in a handler will persist otherwise.

On 3/23/06, Paul Berkowitz <email@hidden> wrote:
On 3/23/06 6:48 AM, "kai" <email@hidden> wrote:

> set text item delimiters to storedDelimiters
> -- restore the value of AppleScript's text item delimiters
> -- to whatever they were on entering the subroutine
>


The context of this is that AppleScript's text item delimiters is a true
global across all scripts in your current session of Script Editor or
whatever application is running your script. It's actually a list (because
once upon a time there was the thought that it night be extended to more
than one delimiter) but in fact there can only be one delimiter and it's
never been extended to more than one and isn't likely to be ever.

The default value is {""}. I.e. the default delimiter is "". You need to
reset (restore) AppleScript's text item delimiters so that you aren't left
with "_" between every text item next time you you coerce a list to text in
some other script. Some people (including myself) explicitly reset
AppleScript's text item delimiters to {""} after every replace operation,
just in case some other script has forgotten to reset them. Other people
say, correctly, that it's your responsibility to set  AppleScript's text
item delimiters any time you want to coerce a list to text, so it shouldn't
actually matter whether anyone resets them or not after replace. I prefer to
be careful, and always reset them explicitly to {""}.

--
Paul Berkowitz


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription: email@hidden



--
Some minds remain open long enough for a truth to both enter and leave without processing.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Replace slash by underscroe in file name (From: kai <email@hidden>)
 >Re: Replace slash by underscroe in file name (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Donald M Rossi/US/DNY is out of the office.
  • Next by Date: Folder Sizes
  • Previous by thread: Re: Replace slash by underscroe in file name
  • Next by thread: Re: Replace slash by underscroe in file name
  • Index(es):
    • Date
    • Thread