Page 1 of 1

AppleScript/HandbrakeCLI help - Change new file label

PostPosted: Fri Oct 18, 2013 11:00 am
by oconnorbz
I'm creating Hazel workflow to do video encoding.

I'm using the applescript from this thread: (code below)
viewtopic.php?p=3447#p3447

I'm trying to change the label color of the newly created video file. The script changes the labels of the input file with no problem, but I can't get the new file to change.

I've added:

--Set the label to 5 for new file
set label index of newFilepath to 5

but I'm guessing it's an issue with the path to the newFilepath variable.

Any idea how I can fix this?





Code: Select all
tell application "Finder"
   try
      --Set to red label to indicate processing
      set label index of theFile to 2
      
      --Assemble original and new file paths
      set origFilepath to quoted form of POSIX path of (theFile as alias)
      set newFilepath to (characters 1 thru -5 of origFilepath as string) & "m4v'"
      
      --Start the conversion
      set shellCommand to "nice /usr/sbin/HandBrakeCLI -i " & origFilepath & " -o " & newFilepath & " --preset=\"Universal\" 2> log.txt;"
      do shell script shellCommand
      
      --Set the label to orange
      set label index of theFile to 3

                --Set the label to 5 for new file
      set label index of newFilepath to 5
      
   
      
      
      
   end try
end tell
tell application "Finder"
   set movieName to name of item theFile
end tell