I made a script that arranges the Puzzle Pieces in correct order and position.
Consider it a "cheat" script or a final arrangement script since manual placement of puzzle pieces is difficult.
Code: Select all
on mouseUp
local tMaxColNum, tMaxRowNum, tNumPieces
local tCollect, tShortImgName, tExpectedNumPieces, tStartTL, tStartLeft, tStartTop
local tPieceSize = 60, tPuzzleWidth, tPuzzleHeight
local tImgColumn, tImgRow, tFudge, tTempLeft, tTempTop
repeat with i = 1 to the number of images
put the short name of image i into tShortImgName
if tShortImgName begins with "PP" then
put tShortImgName & return after tCollect
put max(char 3 to -1 of item 1 of tShortImgName, tMaxColNum) into tMaxColNum
put max(char 1 to -1 of item 2 of tShortImgName, tMaxRowNum) into tMaxRowNum
end if
end repeat
delete char -1 of tCollect
if tCollect is empty then
answer "No Puzzle Pieces found"
exit mouseUp
end if
put tMaxColNum * tMaxRowNum into tExpectedNumPieces
## check for number of Puzzle Pieces and bail out if there are too few or too many
if the number of lines of tCollect <> tExpectedNumPieces then
answer "Not all or too many Puzzle Pieces found"
exit mouseUp
end if
## format of name is "PP" & column & comma & row
## this sorts the images by column and then by row
## PP1,1; PP2,1 etc
## PP1,2; PP2,2 etc
sort tCollect numeric by char 3 to -1 of item 1 of each
sort tCollect numeric by char 1 to -1 of item 2 of each
put the topLeft of image line 1 of tCollect into tStartTL
put item 1 of tStartTL into tStartLeft
put item 2 of tStartTL into tStartTop
## check for space to arrange Puzzle Pieces; otherwise they could be placed beyond the card boundaries
if tStartLeft + (tMaxColNum * tPieceSize) > the width of this card or \
tStartTop + (tMaxRowNum * tPieceSize) > the height of this card then
answer "Place top-left Puzzle Piece near the top left of the card"
exit mouseUp
end if
repeat for each line anImage in tCollect
put char 3 to -1 of item 1 of anImage into tImgColumn
put char 1 to -1 of item 2 of anImage into tImgRow
put the uMarginFudge of image anImage into tFudge
put tStartLeft + ((tImgColumn - 1) * tPieceSize) into tTempLeft
put tStartTop + ((tImgRow -1) * tPieceSize) into tTempTop
put tTempLeft - item 1 of tFudge into tTempLeft
put tTempTop - item 2 of tFudge into tTempTop
set the topLeft of image anImage to tTempLeft, tTempTop
end repeat
end mouseUp
use this script in a button on a card that contains all the pieces of one puzzle. Not more not less.
Kind regards
Bernd
PS if you are still using the outerglow for the script of the puzzle pieces when they are move by the mouse then I changed "outerglow" to "innerglow" because the outerglow overlaps the neighboring pieces whereas "innerglow" does not but still marks the moving piece.