why wont my loop terminate?

I am sure there is something simple i am overlooking
be kind (you all are very patient) i am new to the use of handlers
and my script will not exit the repeat loop
My code

on open theFolder
	repeat with thisItem in theFolder
		makethumb(theFolder) of me
	end repeat
end open

on run
	set f to choose file -- choose an image
	tell application "X-Commands"
		create thumbnail icon for f
	end tell
end run

on makethumb(theFolder)
	tell application "Finder"
		set theseFolderItems to every item in theFolder
		repeat with thisItem in theseFolderItems
			tell application "X-Commands"
				activate
				create thumbnail icon for thisItem
			end tell
		end repeat
		--tell application "X-Commands" to quit
	end tell
end makethumb

again thanks in advance for all your much appreciated help

When you tell the Finder:

set theseFolderItems to every item in theFolder

The result is a list of Finder references, such as:

file "bird.tif" of folder "bird images" of disk "My Big Disk"

Only the Finder recognizes this type of reference. Everything else needs a path, such as:

"My Big Disk:bird images:bird.tif

Does this work?

on open theFolder
	repeat with thisItem in theFolder
		makethumb(theFolder) of me
	end repeat
end open

on run
	set f to choose file -- choose an image
	tell application "X-Commands"
		create thumbnail icon for f
	end tell
end run

on makethumb(theFolder)
	tell application "Finder"
		set theseFolderItems to every item in theFolder
		repeat with thisItem in theseFolderItems
		set thisItemAlias to thisItem as alias
			tell application "X-Commands"
				activate
				create thumbnail icon for thisItemAlias
			end tell
		end repeat
		--tell application "X-Commands" to quit
	end tell
end makethumb

I’m guessing that your run handler works as is. If so, it’s because the Finder isn’t generating the reference to the file.

Joe:

I believe the problem with your never-ending loop is that your ‘on open’ handler (with a repeat loop) is passing off the folder items to the ‘on makethumb’ handler… which also repeats.

By changing ‘on makethumb(theFolder)’ to ‘on open(theFolder)’ I think you’ll get the droplet behavior you want… and you can toss the first handler altogether. Be sure to close the ‘on open’ handler with a simple ‘end open’.

No guarantees.

Peter B.