Re: Verify if name contains an element of a list
Re: Verify if name contains an element of a list
- Subject: Re: Verify if name contains an element of a list
- From: "Adam Bell" <email@hidden>
- Date: Wed, 19 Apr 2006 17:53:45 -0300
I didn't realize that a statement like: "set name_list to name_list's text items" was possible with a list. Learn something every day.
Adam
On 4/19/06,
kai <email@hidden> wrote:
On 19 Apr 2006, at 20:14, Adam Bell wrote:
> My variation on this (Kai is too quick for me) replaces the
> offending character in a list of filenames with an underscore "_"
Sorry, Adam. I'll try to slow down a bit in future. ;-)
Here's another routine to convert a list of filenames, involving only
a single repeat loop:
---------------
to switch_chars of name_list from search_list to replace_char
set tid to text item delimiters
set text item delimiters to return
set name_list to name_list as Unicode text
repeat with search_char in search_list
set text item delimiters to search_char
set name_list to name_list's text items
set text item delimiters to replace_char
set name_list to name_list as Unicode text
end repeat
set text item delimiters to tid
name_list's paragraphs
end switch_chars
set name_list to {"My?File.scpt", "m/yF|le.txt", "my*File.txt"}
set search_list to {"/", "|", "\\", "*", "?"}
set replace_char to "_"
switch_chars of name_list from search_list to replace_char
--> {"My_File.scpt", "m_yF_le.txt", "my_File.txt"}
---------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden
This email sent to 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