Skip to content

Instantly share code, notes, and snippets.

@espenmn
Last active April 22, 2023 13:30
Show Gist options
  • Select an option

  • Save espenmn/9586f83a696bf907eef8a11e21858447 to your computer and use it in GitHub Desktop.

Select an option

Save espenmn/9586f83a696bf907eef8a11e21858447 to your computer and use it in GitHub Desktop.
--change "Users:gm:Downloads: to "Users:Jan:Desktop" or similar
--folder for files must be chosen one time (?)
tell application "Finder"
global thedate
set thedate to (current date) as string
global bndItems
try
activate
make new folder at folder "audio" of folder "Downloads" of folder "gm" of folder "Users" of startup disk with properties {name:"In"}
make new folder at folder "audio" of folder "Downloads" of folder "gm" of folder "Users" of startup disk with properties {name:"Out"}
end try
set mainFolder to "Users:gm:Downloads:audio" as alias
set inFolder to "Users:gm:Downloads:audio:In" as alias
set outFolder to "Users:gm:Downloads:audio:Out" as alias
move every file of folder mainFolder to inFolder
set modification date of every file of folder inFolder to (current date)
set bndItems to count of files of folder inFolder
--display dialog (bndItems/2)
end tell
tell application "Tracker BND Splitter" to activate
repeat with i from 1 to (bndItems / 2)
delay 10
tell application "System Events" to keystroke "o" using {command down}
tell application "System Events"
--click "audio"
keystroke return
delay 3
keystroke return
--click button "Cancel " of sheet 1 of dialog 1
delay 3
key code 31 using control down
keystroke return
delay 10
keystroke return
delay 1
end tell
tell application "Finder"
delay 2
set nameOfFolder to name of first folder of inFolder
set name of first folder of inFolder to (nameOfFolder & " " & thedate)
move first folder of folder inFolder to outFolder
move first file of folder inFolder to outFolder
move first file of folder inFolder to outFolder
delay 2
end tell
tell application "Tracker BND Splitter" to quit
end repeat
tell application "Finder"
activate
display dialog "Done"
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment