Read my answer to this topic Duplicate, rename and increment the name of a file which has all the tools needed.
Basically, assuming you have exactly two files selected in the Finder, the first thing is to extract the two paths, do something like this:
- Set Variable One to NOTHING
- Set Variable Two to NOTHING
- For Each file Path in the Finder’s Selection
- Set Variable Two to %Variable%One%
- Set Variable One to %Variable%Path%
Now it is a simple matter of renaming one file out of the way and the other file to the first, and then finally the temp file to the second name.
Assuming the files are always on your local harddisk, you can just do something like:
Move file %Variable%One% to ~/kmtempfile
Move file %Variable%Two% to %Variable%One%
Move file ~/kmtempfile to %Variable%Two%
If the files might be on a remote disk, then you will want to use the Get File Attribute action to get the parent path of one of the files and then use %Variable%Parent%/kmtempfile instead of ~ (~ is just your home directory).