我想從Python傳遞文件路徑到n個Applescript,不知道如何實現它。下面的代碼顯示了正在運行的Applescript代碼,它提示打開文件或文件,然後重新分配音頻通道,保存和關閉。我不想提示文件或文件,而是想將文件路徑傳遞給osascript Applescript,我已經設置了參數,但不知道如何讓它工作。Python使用osascript將文件路徑變量傳入Applelescript
from subprocess import Popen, PIPE
scpt = '''
on run
open (choose file with prompt ("Choose movie file(s)") ¬
with multiple selections allowed)
end run
on open aa
set channel_layouts_map1 to {¬
{"Sound Track 1", "Sound Track 1", {"Left"}}, ¬
{"Sound Track 2", "Sound Track 2", {"Right"}}, ¬
{"Sound Track 3", "Sound Track 3", {"Center"}}, ¬
{"Sound Track 4", "Sound Track 4", {"LFE Screen"}}, ¬
{"Sound Track 5", "Sound Track 5", {"Left Surround"}}, ¬
{"Sound Track 6", "Sound Track 6", {"Right Surround"}}, ¬
{"Sound Track 7", "Sound Track 7", {"Left Total"}}, ¬
{"Sound Track 8", "Sound Track 8", {"Right Total"}} ¬
}
set channel_layouts_map2 to {¬
{"Sound Track 1", "Sound Track 1", {"Left"}}, ¬
{"Sound Track 2", "Sound Track 2", {"Right"}}, ¬
{"Sound Track 3", "Sound Track 3", {"Center"}}, ¬
{"Sound Track 4", "Sound Track 4", {"LFE