Merging pdfs with automator
I didn't really test this, but you could use a shell script instead.

#!/bin/bash

join="/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py"
date=$(date '+%Y-%m-%d')
last=$(ls ~/Desktop/$date*.pdf 2&gt; /dev/null | tail -n1 | sed -E 's/.* 0*(.*)\.pdf$/\1/g' || 0)

cd ~/Documents/Scanned/
for f in scanf*.pdf; do
    ((last++))
    output="$HOME/Desktop/$date $(printf %03d $last).pdf"
    python "$join" -o "$output" "$f" "${f/scanf/scanb}"
    osascript -e 'on run {f}
tell app "Finder" to set label index of (posix file f as alias) to 2
end' "$output"
done