set numberOfItemsInWindow to "error"
try
with timeout of 2 seconds
tell application "Finder"
activate
tell application "System Events"
tell process "Finder"
tell menu 1 of menu bar item "Edit" of menu bar 1
click menu item "Select All"
end tell
end tell
end tell
tell application "Smile" to chrono
set itemsInWindow to selection -- selection is a large folder, over 220 items.
tell application "Smile" to set x to chrono
set x to "A - " & x
set numberOfItemsInWindow to count of itemsInWindow
end tell
end timeout
on error
beep 3
tell application "Smile" to set x to chrono
set x to "B - " & x
end try
tell application "Finder" to select {} -- deselect choice(s)
tell application "System Events"
activate
display dialog x & return & numberOfItemsInWindow as text
end tell