Because of the large number of files the OP wants to process, I thought a script utilizing System Events might be faster. Given the OPās further explanation of what he wants to accomplish, the only way I could envision this working is to add a sort command to the Finder tell block, as shown in the script below. To compare, I slightly modified Yvonās script in post 13, and Iāve also included that below.
To time these scripts, I created a test folder with 300 files and ran both scripts using Script Geek. The results were:
System Events Script: 0.661 second
Finder Script: 0.417 second
Normally, System Events is significantly faster and more capable when dealing with a large number of files. In this particular case, because of the need for a sorted list, the Finder script is faster.
Just as an aside, I temporarily disabled the sort command and reran the System Events script. It did not select every other file as the OP Wants and instead selected blocks of files ranging from 2 to 6 consecutive selected files. The timing result reported by Script Geek was 0.270 second, reflecting the significant time it takes for the sort command to do its work.
āSYSTEM EVENTS SCRIPTā
set x to the "Save:Temp:" as alias
set z to {}
tell application id "com.apple.SystemEvents"
set y to the path of every file in x whose visible = true
end tell
tell application id "com.apple.Finder"
set y to (sort y by name) -- creation date rather than name might be a useful alternative
repeat with i from 1 to (count y) by 2
set the end of z to item i of y
end repeat
select z
end tell
āFINDER SCRIPTā
set x to "Save:Temp:"
set z to {}
tell application "Finder"
set y to files of folder x as alias list
repeat with i from 1 to (count y) by 2
set end of z to item i of y
end repeat
select z
end tell