x, y coordinates randomly change

I’ve written a script to generate job folders, and at the end of the script, it opens the newly created job folder to a specific folder so that we can copy client disks into it. For some unknown reason, (at least unknown to me!)… my x-y coordinates in the open command randomly reverse and the window that opens displays as a vertical rectangle, instead of a horizontal one. I hope that makes sense… Here’s the code of the section that opens the folder:


property x1 : 50
property y1 : 50
property xSize : 1100
property ySize : 400

on gridFolder(folder_loc, folderName, jobnumber)
	tell application "Finder"
		activate
		try
			open folder folderName of folder folder_loc
		on error errmsg number errnum
			if errnum ≠ -128 then
				beep
				display dialog "Error: " & errnum & return & errmsg buttons {"OK"} with icon stop
			end if
		end try
		
		try
			set bounds of window of folder (folderName) of folder folder_loc to {x1, y1, x1 + xSize, y1 + ySize}
			set current view of window of folder (folderName) of folder folder_loc to column view
			set orig_path to (folder_loc & ":" & folderName) as string
			select folder (jobnumber & "_Originals") of folder orig_path
			set dFolder to list folder (orig_path & ":" & jobnumber & "_Originals")
			set orig_path to (orig_path & ":" & (jobnumber & "_Originals")) as string
			select folder ((last text item of dFolder) as text) of folder orig_path
		end try
	end tell
	
end gridFolder

Any suggestions would be greatly appriciated.

Thanks
Brian

Seems to work OK for me, I don’t see anthying inherintly wrong with you method either - If I had to guess - I might say that perhaps something is failing in the second ‘try’ you have and simply not resizing the window, and you’re thinking it’s resizing it wrong?

Just a guess - try commenting out the 'try’s and you might see something. Also - take a look at the event log and see if you’r values are being swapped for some reason.

ie: you should see something like this:

set bounds of window of folder (alias “Macintosh HD:Users:me:Documents:Agency_Jobs:Custom:”) to {50, 50, 1150, 450}
{50, 50, 1150, 450}

brian, had the very same problem only 1 or 2 weeks ago with what I thought would be a simple finder script it’s drove me mad. Works fine after a start-up but if run later X&Y start transposing values have found no solution yet.