Script stops for no reason?

I am writing a perfectly normal script which takes a list of image names and than checks a folder to make sure all of the names have corresponding image files. Anyway, the script just stops executing after four lines. I check the event log and there is an “end tell” in the window, but there isn’t one in the script. The last of the four lines is just a “list folder” command, and the line after than just defines a variable. Nothing remarkable and I have no idea why it would stop like this. I don’t know if this is a common problem or not…I asked and experienced scripter friend of mine and he said he had never encountered such a thing. Then, the next day, it happened to him! Help?

It’s hard to say what’s happening without seeing your code.

There may be other problems with this script, but since I haven’t been able to get it to execute past the first four lines, I haven’t been able to work on them…

tell application "Finder"
set batchbox to display dialog "Which batch do you want to check?" default answer ""
set batch to text returned of batchbox
set batchfolder to choose folder with prompt "Choose the corresponding folder of images..."
set folderlist to (list folder batchfolder)
set y to {} --sets y to a list for handling by next chunk
set oldelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to {".jpg"}
set v to (count items in folderlist)
repeat with vr from 1 to v
set listitem to item vr of folderlist as string
set listitemminusjpg to the first text item of listitem
set y to y & listitemminusjpg
end repeat
end tell
set x to {} --sets x to a list for handling by next chunk
(*tell application "FileMaker Pro"
open "INVENTORY"
show (every record of database "INVENTORY" whose cell "ebay Batch" is batch)
set counter to count records
repeat with k from 1 to counter
set ebinam to cell "ebay Item Name" of record k of (every record of database "INVENTORY" whose cell "ebay Batch" is batch)
set x to x & ebinam
end repeat
end tell*)

It seems to execute fine for me. It returns a list of items in the selected folder.
How do you know where it’s stopping? Does it return an error or finish quietly?

I have the event log open and it shows “end tell” right after it returns the list in the fourth line.

I have the event log open and it shows “end tell” right after it returns the list in the fourth line.

Yes. I know I commented the rest out.
I figured out the end tell. I was expecting to see the variables get manipulated in the event log, so I didn’t think the script was executing line five and beyond. When I added a return statement to one of them and the result I wanted showed up in the window, I realized that the script was working fine. Duh!
Thank you your help. Next time I will wait two days before I go to the trouble of posting, making a fool of myself, and wasting your time!