11-23-2020, 02:14 PM
try this
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 329 217 "Dialog" "4"
;3 Button 0x54031003 0x0 277 6 48 14 "Start"
;5 QM_Grid 0x56031041 0x200 2 3 272 207 "0x10,0,0,0x0,0x0[]A,,,"
;END DIALOG
;DIALOG EDITOR: "" 0x2040A00 "*" "" "" ""
str controls = "3 5"
str c3Sta qmg5x
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc
function# hDlg message wParam lParam
DlgGrid g.Init(hDlg 5)
sel message
,case WM_INITDIALOG
,int- tHandle
,ICsv z._create
,str csv
,z.FromString(csv)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3 ;; start-stop button
,if(but(lParam))
,,out "Started"
,,tHandle=mac("sub.fill_loop" "" g csv)
,else
,,out "Stopped"
,,EndThread "" tHandle
,SetDlgItemText hDlg wParam iif(but(lParam) "Stop" "Start")
,case IDOK
,case IDCANCEL
ret 1
#sub fill_loop
function gHwnd str'csv
ARRAY(str) files
int i; str name
ICsv z1._create
OpenSaveDialog(0 0 "Video Files[]*.ts;*.mkv;*.mp4;*.mov" "" 0 "" 0 files)
for i 0 files.len
,name=files[0+i]
,__Handle hProcess=run("cmd.exe" F"/c ffmpeg -i ''{name}'' -c:v copy -aspect 16:9 -c:a copy ''{name}-copy.mp4''" "" "" 0x10000)
,wait 0 H hProcess
,z1.Cell(i 0)=name
,z1.ToString(csv)
,z1.ToQmGrid(gHwnd 0)