MACSCRPT Archives

May 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Mark Lively <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 12 May 2006 11:44:40 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (132 lines)
On May 12, 2006, at 11:10 AM, Christopher Green wrote:
> Hello everyone.
>  After bloodied knuckles (from knocking on wood) and many fistfuls  
> of hai=
> r,
> I have discovered that doing something like <files of anAlias whose  
> name
> ends with ".xxx"> in a Finder tell block is broken. It breaks  
> randomly,
> which makes it very frustrating. You can have a script look in a  
> folder o=
> f
> 50 files and it works, but with a few hundred it will randomly break,
> returning a "cannot get every file of foo of alias bar" error.
>  Anyone else seeing this? I've tested this on three machines (one  
> G4 and =
> two
> G5s).
>
> -cg
>

Entire Contents used to be broken for large folders but that was  
fixed back a while ago.

It seems to work for me


--generate test case

set nameparts1 to {"top", "bottom", "left", "behind", "right", "now",  
"front", "then"}
set nameparts2 to {"man", "bear", "pig", "dog", "cat", "yak"}
set endlist to {".foo", ".bar", ".xml", ".txt"}
set mainfolder to choose folder
set mainpath to quoted form of POSIX path of mainfolder
repeat with i from 1 to 100
	repeat with anitem in endlist
		set aname to "" & mainpath & some item of nameparts1 & some item of  
nameparts2 & i & anitem
		do shell script "touch " & aname
	end repeat
end repeat

--- test

tell application "Finder"
	
	--empty
	
	set filelist to every file of mainfolder whose name ends with ".xxx"
	log filelist
	log (count filelist)
	log (count (every file of mainfolder whose name ends with ".xxx"))
	
	log ""
	set filelist to every file of mainfolder whose name ends with ".xml"
	log filelist
	log (count filelist)
	log (count (every file of mainfolder whose name ends with ".xml"))
	
	log ""
end tell

Yields....

	(**)
	(*0*)
	(*0*)
	(**)
	(*document file behindbear99.xml, document file behindcat30.xml,  
document file behinddog20.xml, document file behinddog3.xml, document  
file behinddog59.xml, document file behinddog95.xml, document file  
behinddog98.xml, document file behindman28.xml, document file  
behindman61.xml, document file behindman94.xml, document file  
behindpig50.xml, document file behindpig8.xml, document file  
behindyak35.xml, document file behindyak4.xml, document file  
behindyak5.xml, document file behindyak86.xml, document file  
bottombear60.xml, document file bottomcat39.xml, document file  
bottomcat75.xml, document file bottomdog55.xml, document file  
bottomdog7.xml, document file bottomdog71.xml, document file  
bottomman19.xml, document file bottompig15.xml, document file  
bottompig32.xml, document file bottompig33.xml, document file  
bottompig84.xml, document file bottomyak97.xml, document file  
frontbear51.xml, document file frontdog100.xml, document file  
frontdog11.xml, document file frontdog14.xml, document file  
frontdog90.xml, document file frontman68.xml, document file  
frontpig92.xml, document file frontyak40.xml, document file  
frontyak58.xml, document file frontyak73.xml, document file  
leftbear70.xml, document file leftbear88.xml, document file  
leftcat17.xml, document file leftcat65.xml, document file  
leftdog46.xml, document file leftdog64.xml, document file  
leftdog91.xml, document file leftman1.xml, document file  
leftman21.xml, document file leftman42.xml, document file  
leftpig48.xml, document file leftpig56.xml, document file  
leftyak13.xml, document file nowbear34.xml, document file  
nowbear79.xml, document file nowbear89.xml, document file  
nowcat44.xml, document file nowcat80.xml, document file nowdog18.xml,  
document file nowdog53.xml, document file nowman9.xml, document file  
nowyak85.xml, document file rightbear57.xml, document file  
rightbear66.xml, document file rightbear72.xml, document file  
rightcat62.xml, document file rightcat87.xml, document file  
rightdog26.xml, document file rightdog6.xml, document file  
rightman37.xml, document file rightman45.xml, document file  
rightpig63.xml, document file rightyak81.xml, document file  
thenbear38.xml, document file thenbear67.xml, document file  
thenbear96.xml, document file thencat2.xml, document file  
thencat29.xml, document file thendog31.xml, document file  
thendog36.xml, document file thendog74.xml, document file  
thendog77.xml, document file thenman83.xml, document file  
thenman93.xml, document file thenpig12.xml, document file  
thenpig43.xml, document file thenpig69.xml, document file  
thenpig82.xml, document file thenyak10.xml, document file  
thenyak49.xml, document file topbear16.xml, document file  
topbear41.xml, document file topcat23.xml, document file  
topcat76.xml, document file topdog54.xml, document file topdog78.xml,  
document file topman47.xml, document file toppig22.xml, document file  
toppig25.xml, document file toppig52.xml, document file topyak24.xml,  
document file topyak27.xml*)
	(*100*)
	(*100*)
	(**)

It found all 100 files named with a .xml

I ran it again with 1000 and it was not a happy camper but it ran.   
It just barely avoided a timeout.

-Mark
"It doesn't mean anything.  Its like 'ramma lamma ding dong' or 'give  
peace a chance'"

ATOM RSS1 RSS2