• 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
Finder Scripting Qusetion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finder Scripting Qusetion


  • Subject: Finder Scripting Qusetion
  • From: "S. J. Cunningham" <email@hidden>
  • Date: Mon, 23 Feb 2015 17:08:04 -0500

How can I get list_4 to be {file1,file2,file3} in the below example?

(I know I can just use set list_4 to list_3 or copy list_3 to list_4 but that doesn't work if I just want to extract parts of list_3 for example)

tell application "Finder"
	set list_1 to {1, 2, 3, 4, 5}
	set list_2 to {}
	repeat with nn in list_1
		set list_2 to list_2 & nn
	end repeat
	--> list_2 = {1,2,3,4,5}  -- Yes!

	set list_3 to files of folder someolder
	--> list_3 = {file 1,file 2, file 3}

	set list_4 to {}
	repeat with nn in list_3
		set list_4 to list_4 & {nn}
	end repeat

	--> list_4 = {item 1 of {file 1,file 2, file 3}, item 2 of {file 1,file 2, file 3}, item 3 of {file 1,file 2, file 3}}   -- NO!

-- This works but it's ugly

	set list_4 to {}
	repeat with nn from 1 to (count of list_3)
		set list_4 to list_4 & {item nn of list_3}
	end repeat

	--> list_4 = {file 1,file 2, file 3}

end tell
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


  • Follow-Ups:
    • Re: Finder Scripting Qusetion
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: Re: UTC time with milliseconds
  • Next by Date: Re: Finder Scripting Qusetion
  • Previous by thread: Re: UTC time with milliseconds
  • Next by thread: Re: Finder Scripting Qusetion
  • Index(es):
    • Date
    • Thread