I know this is probably obvious but...

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 to convert both to POSIX paths easily?


choose file returns an alias specifier, which has a POSIX path property

set thePath to POSIX path of (choose file with prompt "Please select a movie for encoding:" without invisibles of type {"mov"})

Thanks Stefan! One more thing though. Now it’s saying “Can’t make POSIX path of missing value into type string.” Any ideas?

Normally choose file returns an alias specifier or throws error -128 in case the user presses Cancel

Maybe the command behaves different in Xcode/ASOC

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_

use the Cocoa way

        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
            -- 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.

Wrap it in a try block.

no output, just the same errors through the console

Back in your first post, you’re using setMoviePath_ in both handlers. That doesn’t make sense to me…