Page 1 of 1

ShellExecute() set as wait run

PostPosted: Tue Oct 24, 2017 9:29 am
by ShumingWang
Hi!
prg:
ShellExecute(...)
msginfo("2")

Msginfo() will be run before shellexecute closed , how to set shellexecute, after it is closed, then run msginfo() ?
TKS!
Shuming Wang

Re: ShellExecute() set as wait run

PostPosted: Tue Oct 24, 2017 10:51 am
by Jack
I think you should use WAITRUN(...)

WaitRun("notepad.exe ERROR.TXT")

Re: ShellExecute() set as wait run

PostPosted: Tue Oct 24, 2017 10:55 am
by mag071
Hi;

MsgRun( "MsgRun() Run Wait", "From FWH 17.05", { || ShellExecute(...), MsgInfo( "2" ) }, oWnd )

Re: ShellExecute() set as wait run

PostPosted: Tue Oct 24, 2017 11:37 am
by richard-service
Hi Mr.Wang
I lose my WeChat account. so my new WeChat ID is fivetech_taiwan. please add it.
I have your TMySQL question.
Thanks a lot.

Re: ShellExecute() set as wait run

PostPosted: Wed Oct 25, 2017 1:48 am
by ShumingWang
wairun() do not execute paraments as " mysqldump --host 192.168.1.200 -u root -p -C mydatabase>d:\back\mysqldatebas0001"
msgrun still run msginfo() before shellexecute() closed.
Thanks all!
Regards!
Shuming Wang

Re: ShellExecute() set as wait run

PostPosted: Wed Oct 25, 2017 7:26 am
by Enrico Maria Giordano
ShumingWang wrote:wairun() do not execute paraments as " mysqldump --host 192.168.1.200 -u root -p -C mydatabase>d:\back\mysqldatebas0001"


Yes, it does:

Code: Select all  Expand view
WaitRun( "mysqldump --host 192.168.1.200 -u root -p   -C mydatabase>d:\back\mysqldatebas0001" )


I'm not sure about redirection, though...

EMG

Re: ShellExecute() set as wait run

PostPosted: Thu Oct 26, 2017 1:59 am
by ShumingWang
With aitrun() not success , seems immediatley closed.
Shuming Wang

Re: ShellExecute() set as wait run

PostPosted: Mon Oct 30, 2017 11:34 am
by sreerajklm
Try this,

Code: Select all  Expand view
MsgWait("Mysql database backup","Backup",Winexec( "c:\mysql\mysqldump --host 192.168.1.200 -u root -p   -C mydatabase>d:\back\mysqldatebas0001"))

Re: ShellExecute() set as wait run

PostPosted: Tue Oct 31, 2017 3:54 am
by ShumingWang
Still not success , after input mysql password, seems immediatley closed.
Shuming Wang

Re: ShellExecute() set as wait run

PostPosted: Tue Oct 31, 2017 9:54 am
by MGA
Try this,


cArquivoBAT := 'filebat.bat'
cComando := 'mysqldump --host 192.168.1.200 -u root -p -C mydatabase > "d:\back\mysqldatebas0001" '

MsgRun( 'Aguarde...',, { || ExecutaComando( cArquivoBAT, cComando ) )

/******************************************************************************/
static procedure ExecutaComando( cArquivoBAT, cComando )
/*
*/
if !CriaArquivoBatLocal( cArquivoBAT, cComando )

MsgStop('Não foi possível criar o arquivo !', 'Atenção!')

else
WaitRun(cArquivoBAT,.f.)
endif

Ferase(cArquivoBAT)

return



/******************************************************************************/
function CriaArquivoBatLocal( cArquivo, cComando )
/*
*/
local oArquivo

Ferase(cArquivo)

oArquivo := TTxtFile():Create( cArquivo )

if !oArquivo:Open()
return .f.
endif

oArquivo:add('@echo off:')
oArquivo:add(cComando)
oArquivo:Close()

return .t.