a_freyer wrote:The line...
- Code: Select all
set origFilepath to quoted form of POSIX path of (theFile as alias)
...is likely what is causing the problem.
I anticipate that you are potentially sending a folder, or something similar to the script, causing
origFilepath to be (null).
What are the rule conditions you have for this particular rule? To you include only certain file types? This this rule part of a "run rules on folder contents" group?
Oddly enough you helped me get this procedure working a while back. here's my current set of rules viewtopic.php?f=4&t=1885#p7797One last bit of info. all these files are on my networked synology drive that I mount to via afp://
1.0 TV Shows - Handbrake
Run Handbrake CLI
• If <all> conditions met for <the file or folder being matched>
<Date Added> is after <Date Last Matched>
<Extension> is not <m4v>
• Do the following
<Run AppleScript>
- 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 /Applications/HandBrakeCLI -i " & origFilepath & " -o " & newFilepath & " --preset=\"AppleTV 3\" ;"
do shell script shellCommand
--Set the label to orange
set label index of theFile to 3
end try
end tell
tell application "Finder"
set movieName to name of item theFile
end tell
tell application "Growl"
set the allNotificationsList to {"Handbrake convert complete"}
set the enabledNotificationsList to {"Handbrake convert complete"}
register as application "Handbrake Encode Growler" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "HandBrake"
notify with name "Handbrake convert complete" title "Handbrake conversion complete" description "The video \"" & movieName & "\" has been converted." application name "Handbrake Encode Growler"
--Remove the old file
set shellCommand to "rm -f " & origFilepath
do shell script shellCommand
end tell
Move to be Renamed (This works, but I'm not sure how low I can make the trigger such as 3 mins?)
• If <all> conditions met for <the file or folder being matched>
<Extension> is <m4v>
<Date Last Modified> is not in the last <30 minutes>
• Do the following
<Move> to folder <2.0 TV Shows - Rename>