• 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: Finder can't count?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finder can't count?


  • Subject: Re: Finder can't count?
  • From: Robert Poland <email@hidden>
  • Date: Wed, 16 Feb 2011 13:23:51 -0700

On Feb 16, 2011, at 1:04 PM, KOENIG Yvan wrote:

> Maybe this quick and dirty script may help :
>
> tell application "Finder"
> 	set finderAlias to (target of first Finder window) as text
> 	set nb_items to (count items of folder finderAlias)
> 	set the_folders to name of every folder of folder finderAlias
> 	set other_items to 0
> 	repeat with f in the_folders
> 		try
> 			get visible of window of folder f of folder finderAlias (* fails if the folder isn't open *)
> 			set other_items to other_items + (count items of folder (finderAlias & f))
> 		end try
> 	end repeat
> end tell
> log nb_items & return & other_items
>
>
> Yvan KOENIG (VALLAURIS, France) mercredi 16 février 2011 21:03:19

Thanks Yvan,

That gives a result of "{2, "
", 0}
"

I'm working on a new idea;

tell application "Finder"
	activate
	set wdw to window 1
	tell wdw
		set current view to list view
		tell application "System Events"
			keystroke "a" using command down -- select all
			keystroke "c" using command down -- select all
		end tell
		set x to the clipboard
		tell wdw to select {} -- deselect "All"
		-- parse out count
		set countOfItems to my parseCount(x)
	end tell
end tell

try
	log countOfItems
end try

on parseCount(x)
	set originalDelimiters to AppleScript's text item delimiters
	set AppleScript's text item delimiters to return -- parse off ".app"
	set countOfItems to count of lines in x
	set AppleScript's text item delimiters to originalDelimiters
	display dialog countOfItems
	return countOfItems
end parseCount


Robert Poland - Fort Collins, CO





 _______________________________________________
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

References: 
 >Finder can't count? (From: Robert Poland <email@hidden>)
 >Re: Finder can't count? (From: Michelle Steiner <email@hidden>)
 >Re: Finder can't count? (From: Robert Poland <email@hidden>)
 >Re: Finder can't count? (From: KOENIG Yvan <email@hidden>)

  • Prev by Date: Re: Finder can't count?
  • Next by Date: Solution: Finder can't count?
  • Previous by thread: Re: Finder can't count?
  • Next by thread: Re: Finder can't count?
  • Index(es):
    • Date
    • Thread