Hello fellow scripters (who are way better than I),
I would like to gather all images on my desktop, and open a new finder window with only the images so that I may do what I would like to do with them. Maybe I, in the future, can bend the script to gather other types of files for future use.
This is what I have so far.
set imgs to false
tell application "Finder"
set findimages to every item of desktop
repeat with thisItem in findimages
if name extension of thisItem is "jpg" or "png" then
set imgs to thisItem as alias
exit repeat
end if
end repeat
end tell
tell application "Finder"
activate
select window of desktop
end tell
The code won’t work 
Thanks for all your help people 
Model: MacBook
AppleScript: 2.2
Browser: Safari 525.13
Operating System: Mac OS X (10.5)
Well here’s how you create the list if images
set extList to {"jpg", "png"}
tell application "Finder"
try
set imgs to (every file of desktop whose name extension is in extList) as alias list
on error
set imgs to (every file of desktop whose name extension is in extList) as alias as list
end try
end tell
Now as to the second question your guess is as good as mine. You would have to figure out how to generate a find window and just display the results you want, but I found no elegant way to do so. The question though is what are you trying to do that you need them in a lone finder window? You already have the list generated in the script, can’t the the next step be performed there?
Ah your script is so simple yet so amazing, I am definitely learning from this.
The reason I would utilize such a script would be to find the mass clutter of desktop images, gather only the images of the sort, and allow me to choose which ones to keep or delete.
Would there be away to make this happen? Also be able to put into a dialog box list with the option to delete the image/images chosen (using CMD as the select feature or something similar?)
Model: MacBook
AppleScript: 2.2
Browser: Safari 525.13
Operating System: Mac OS X (10.5)
Hey Chris, give this a try =)
set extList to {"jpg", "png"}
set {tid, text item delimiters} to {text item delimiters, return}
tell application "Finder"
try
set imgs to paragraphs of ((every file of desktop whose name extension is in extList) as Unicode text)
set imgs2delete to choose from list imgs with prompt "Please select the images to delete." with multiple selections allowed
repeat with aImg in imgs2delete
move aImg to trash
end repeat
end try
end tell
set text item delimiters to tid
Oh man that sure did the trick !
I have an idea - What if I clicked one image in the list, and a drawer opened up showing the contents of that image? - That would have to be done in Xcode though.
man, Thank you for your help ! It looks so easy when I read it but it is like wow when you think about doing it 
Always glad to help 
You’re right though it would require Xcode, but it actually shouldn’t be very difficult! Give it a crack and see what happens!