Hey y’all, I wrote this AppleScript to swap alias files with their original (I have a huge sample library for Logic Pro X, and I’m often relocating individual files; LPX doesn’t do well with aliased samples, but I like keeping them organized!).
The script works well, however, there are several things I would like to do that I have zero idea how to even begin implementing.
The biggest, fattest, juiciest question of them all: Is there a more efficient way to accomplish batch swapping aliases with the originals?
Thanks a ton guys
Code:
on run {input, parameters}
tell application "Finder"
set theSelection to selection
repeat with theAlias in theSelection
if class of theAlias is alias file then
try
set originalFile to original item of theAlias
set originalName to name of originalFile
set originalFolder to container of originalFile
set aliasName to name of theAlias
set aliasFolder to container of theAlias
set newName to aliasName & " _"
set newName2 to originalName & " _1"
set name of theAlias to newName
set name of originalFile to newName2
move item newName of aliasFolder to originalFolder
move item newName2 of originalFolder to aliasFolder
set name of item newName of originalFolder to originalName
set name of item newName2 of aliasFolder to aliasName
end try
end if
end repeat
end tell
return input
end run
The script works well, however, there are several things I would like to do that I have zero idea how to even begin implementing.
- Multithreading. As it is, each file is renamed and moved one after the other, and the “dropped file” sound is spammed for ages. I’ve found that running multiple instances of the script on small groups of files is faster than one instance on a single group. How can I have the script build a list of all the files selected, then swap them all at once or split the selection into smaller selections and have the script run multiple instances of itself?
- The AppleScript monitor reads 0% when running, then jumps to 100% once finished. Is there a way see an accurate %?
- Is there a way to have each “alias swap” be recorded into a log file?
The biggest, fattest, juiciest question of them all: Is there a more efficient way to accomplish batch swapping aliases with the originals?
Thanks a ton guys