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

Solution: Finder can't count?


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

Thanks all,

On Feb 16, 2011, at 10:35 AM, Robert Poland wrote:

> Hi,
>
> The following script will only count the number of Folders in a Finder window regardless of what's visible or selected. Any ideas?.
>
> tell application "Finder"
> 	activate
> 	set wdw to window 1
> 	tell wdw
> 		tell application "System Events"
> 			keystroke "a" using command down -- select all
> 		end tell
> 		set itemsInWindow to count of items
> 		tell wdw to select {} -- deselect "All"
> 	end tell
> end tell
>
> try
> 	log itemsInWindow
> end try
>
> TIA,
>
>
> Robert Poland - Fort Collins, CO

Here's a script that works;

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 itemsInFolder to the clipboard
		set countOfItems to count of paragraphs in itemsInFolder
		tell wdw to select {} -- deselect "All"
	end tell
end tell

log countOfItems


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>)

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