Setting a variable (file location) within a shell script

Hi,

at the end of my shell script is the location of the file. I want to replace this string with a variable.

I want to turn: Users/Alex/Movies/Wall-E.avi

Into a variable defined earlier in the script

do shell script “usr/local/bin/mediainfo ‘–Inform=Video;%Width%,%Height%,%DisplayAspectRatio%,%FrameRate%’ /Users/Alex/Movies/Wall-E.avi”

thanks in advance

Just set it to a variable, then add that outside the ending quotes of the do shell script. You can also insert variables within the do shell script command(s). You just have to end the quotes, add the variable, then start the quotes again, paying attention to spaces when needed.

set file_path to quoted form of “/Users/Alex/Movies/Wall-E.avi”

do shell script "usr/local/bin/mediainfo ‘–Inform=Video;%Width%,%Height%,%DisplayAspectRatio%,%FrameRate%’ " & file_path

– quoted form is not needed in this case, but is if there are spaces in the path

Hmm im getting the error:
The command exited with a non-zero status.

set file_path to (choose file)

set IDf to do shell script “usr/local/bin/mediainfo ‘–Inform=Video;%Width%,%Height%,%DisplayAspectRatio%,%FrameRate%’” & file_path

Any Ideas?

Oops! In my haste I forgot to translate it to a safe Unix (POSIX) path:

set file_path to quoted form of POSIX path of (choose file)

set IDf to do shell script “usr/local/bin/mediainfo ‘–Inform=Video;%Width%,%Height%,%DisplayAspectRatio%,%FrameRate%’” & file_path