I would like to produce a clip which plays back a 20 second clip with the frames in a totally random order - I have been advised that this can only be done with apple script.
I don't know that
only is the right word, but it's certainly a possibility.
so the action would be to take folder x and to rename each of the files numerically in a random fashion without duplication -
For simplicity's sake, I'd create a new folder and move the files into that folder as you go - it's a far easier way of avoiding duplicates:
tell application "Finder"
set destFolder to (make new folder as desktop with properties {name: "new animation"})
set sourceFolder to (choose folder with prompt "Please select the source images folder")
set numFiles to (number of files of folder sourceFolder)
repeat with i from 1 to numFiles
set newFile to (move some file of folder sourceFolder to folder destFolder)
set name of newFile to (i & ".tiff")
end repeat
end tell
The above script first creates a new folder on your desktop where the random files will go. It asks for the source images folder, then iterates through based on the number of files in that folder.
On each iteration through the loop it grabs 'some file' of the source folder. That's what gives you the random element. Once the file is moved it's renamed based on the current number of files that have been moved.
There are doubtless many more ways of achieving the same result, and this script has no error checking (e.g. makes sure the destFolder can be created, files can be renamed, etc.), but it should be a good starting point.
If you're worried about ending up with a new folder, you could add commands at the end to delete the (now empty) source folder, and rename/move the destFolder into the sourceFolder's location.