Arranging Icons in Finder Icon View

An intermediate task to the overall OP task of rearranging the icons is to determine the target positions and determine the order of the files. Major progress on both of those has been achieved in another thread.

This macro uses the KBM Get File Attribute action to get the comment property of each file, make a list entry with that number and the filename, sort the resulting list, and the extract just the filename from each line.

This list will be the list of files in Mission Control Desktop order.

This macro uses the AppleScript constructions above to create a list of positions and filenames, uses the UNIX sort command to do the two-level sort. It shows the resulting list of filenames sorted by icon position.

As I explained in the OP of that thread:

The update described is the ultimate goal of this thread's question.