Re: Need a fast answer to a basic finder prob.
Re: Need a fast answer to a basic finder prob.
- Subject: Re: Need a fast answer to a basic finder prob.
- From: Adam Wuellner <email@hidden>
- Date: Wed, 31 Aug 2005 09:46:40 -0500
On 8/31/05, Jay Louvion <email@hidden> wrote:
>
> Sorry for the panic but I just can't seem to work this one out by trial.
>
> I got a variable, localfiles that returns an alias list:
>
> {alias "Groucho:Users:ptilu:Desktop:dev AScript:scan renamer:short
> test:51.10.jpg", alias "Groucho:Users:ptilu:Desktop:dev AScript:scan
> renamer:short test:51.11.jpg", alias "Groucho:Users:ptilu:Desktop:dev
> AScript:scan renamer:short test:51.12.jpg", alias
> "Groucho:Users:ptilu:Desktop:dev AScript:scan renamer:short test:51.13.jpg",
> alias "Groucho:Users:ptilu:Desktop:dev AScript:scan renamer:short
> test:51.14.jpg", alias "Groucho:Users:ptilu:Desktop:dev AScript:scan
> renamer:short test:51._1.jpg", alias "Groucho:Users:ptilu:Desktop:dev
> AScript:scan renamer:short test:51._2.jpg", alias
> "Groucho:Users:ptilu:Desktop:dev AScript:scan renamer:short test:51._3.jpg",
> alias "Groucho:Users:ptilu:Desktop:dev AScript:scan renamer:short
> test:51._4.jpg", alias "Groucho:Users:ptilu:Desktop:dev AScript:scan
> renamer:short test:51._5.jpg", alias "Groucho:Users:ptilu:Desktop:dev
> AScript:scan renamer:short test:51._6.jpg", alias
> "Groucho:Users:ptilu:Desktop:dev AScript:scan renamer:short test:51._7.jpg",
> alias "Groucho:Users:ptilu:Desktop:dev AScript:scan renamer:short
> test:51._8.jpg", alias "Groucho:Users:ptilu:Desktop:dev AScript:scan
> renamer:short test:51._9.jpg"}
>
> I need to return a shorter alias list from this list of only the aliases
> containing "_", in order to replace those "_" by "0" (zeros).
> And I just can't get it right. And I feel downright stoopid.
>
> Tried: (wrapped in a "tell Finder")
>
> set thelist to (every item of localfiles whose name contains "_") as alias
> list
>
> But hey, that would be just _too_ simple.
Yes, unfortunately you can't (yet?) filter lists using 'whose'.
Instead, you must test the list items iteratively, and if the items
match a condition you can add them to a new list.
something like this: (untested)
set newlist to {}
repeat with i from 1 to count localfiles
if name of info for item i of localfiles contains "_" then
set end of newlist to contents of item i of localfiles
end if
end repeat
_______________________________________________
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