I have two functions (browseForMovie_ and browseForOutputFolder_) which are supposed to do exactly what they are called (browse for a movie, and get an output folder). But, I need it to give me the POSIX path to actually pass it off to ffmpeg. currently, both functions are as follows:
on browseForMovie_(sender)
set thePath to (choose file with prompt "Please select a movie for encoding:" without invisibles of type {"mov"})
log(thePath as string)
setMoviePath_(thePath as string)
end browseForMovie_
on browseForOutputFolder_(sender)
set theOutPath to (choose folder with prompt "Please select an output folder:" without invisibles)
log(theOutPath as string)
set OutputPath to (theOutPath as string)
setMoviePath_(theOutPath as string)
end browseForOutputFolder_
Any way I can fix this? Thanks for all your help again.
Edit: I’m going to include the processMovie function… Hopefully this’ll help.
on processMovie_(sender)
set bundlePath to current application's NSBundle's mainBundle's resourcePath() as string
set ffPath to (bundlePath as text) & "/binaries/ffmpeg "
set theMovie to POSIX path of MoviePath as string
set theOutputFolder to POSIX path of theOutPath as string
set the finalExtension to (popupPOP's titleOfSelectedItem()) as string
if theMovie = "" then display dialog "theMovie is required."
if theOutPath = "" then display dialog "theOutPath is undefined."
if the finalExtension is "mp3" then
--display dialog "mp3 has been selected... let's see what we can do."
log do shell script ffPath & quoted form of "-i " & theMovie & quoted form of "-ab 160k -ac 2 -ar 44100 -vn" & theOutPath & quoted form of "test.mp3"
else if finalExtension is "Item 2" then
display dialog "Item 2 has been selected"
else if finalExtension is "Item 3" then
display dialog "Item 3 has been selected"
end if
end processMovie_
set openPanel to current application's NSOpenPanel's openPanel()
openPanel's setAllowedFileTypes_({"mov"})
set panelResult to openPanel's runModal()
if (panelResult is current application's NSOKButton) then
set thePath to openPanel's URLs()'s objectAtIndex_(0)'s |path|()
log thePath
else
-- do error handling
end if
Thanks for that, but I believe the problem is within the function I edited above. Can you please review my code, I can’t figure out what’s wrong with it.