Actually, that 1 second was just to simulate. I am using a Wait for handle to run and waiting for a CLI to exit, and in the time that is waiting the dialog become unresponsive. And basically I was trying to make the loop stop when pressing a button at the dialog. Using a subfuntion worked a bit because I was able to stop the loop using EndThread, but like above I was not able to pass the loop to the subfuction. Sorry if I couldn't explain it right. And thanks for the help.
[/code]
Macro [b]Macro2[/b] [help1][/help1]
[code]
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 329 217 "Dialog" "4"
;3 Button 0x54032000 0x0 277 6 48 14 "Start"
;4 Button 0x54032000 0x0 277 23 48 14 "Stop"
;5 QM_Grid 0x56031041 0x200 2 3 272 207 "0x10,0,0,0x0,0x0[]A,,,"
;END DIALOG
;DIALOG EDITOR: "" 0x2040B00 "*" "" "" ""
str controls = "5"
str qmg5x
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc
function# hDlg message wParam lParam
ARRAY(str) files
int i
str name csv
DlgGrid g.Init(hDlg 5)
sel message
,case WM_INITDIALOG
,ICsv+ z._create
,z.FromString(csv)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,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
,,z.Cell(i 0)=name
,,z.ToString(csv)
,,z.ToQmGrid(g 0)
,case 4
,
,case IDOK
,case IDCANCEL
ret 1