Page 1 of 1

Question about marco

Posted: Tue Jul 19, 2011 1:18 pm
by huangchenmin
Dear all:
I would like to open .txt file after I created it.So following are my way, of course, it failed.
m_cml:=&('c:\windows\notepad.exe x:\log\'+m_filename)
EVAL(m_cml)
Complier keep tellinf me error about using '&'
Please help!
I thank you in advance.
Best Regards
chen min

Re: Question about marco

Posted: Tue Jul 19, 2011 1:30 pm
by esgici
Hi Chen Min

Have you tried EXECUTE command ?

Regards

--

Esgici

Re: Question about marco

Posted: Wed Jul 20, 2011 2:28 am
by huangchenmin
esgici wrote:Hi Chen Min
Have you tried EXECUTE command ?
Regards
--
Esgici
Thanks for youe supports.
I have been tried followig:
run c:\windows\NOTEPAD.exe filename
The mater reall bother me is the file name, whilch is not fixed but depends on random create.
That is the reason make me want to use '&'

Could you explain more about EXECUTE command ?
I tank you in advance.
Best Regards
chen min

Re: Question about marco

Posted: Wed Jul 20, 2011 6:59 am
by mol
Try something like that:

Code: Select all

cProg	:= 'c:\windows\notepad.exe'
cParam := 'x:\log\'+m_filename
_Execute ( GetActiveWindow() ,, cProg , cparam ,, 5 )
It should help, I think.

Best regards, Marek

Re: Question about marco

Posted: Fri Jul 22, 2011 2:21 am
by huangchenmin
mol wrote:Try something like that:

Code: Select all

cProg	:= 'c:\windows\notepad.exe'
cParam := 'x:\log\'+m_filename
_Execute ( GetActiveWindow() ,, cProg , cparam ,, 5 )
It should help, I think.
Best regards, Marek
Dear Marek
Thanks for your supports.
It realy works.
I replace 'notepad.exe' with 'wordpad.exe', and fail to open .txt file while there is space in path string.
ex. cParam := GetDesktopFolder()+'\'+m_filename
cParam will be 'c:Documents and Settings\...'
please help!
Best Regards
chen min

Re: Question about marco

Posted: Fri Jul 22, 2011 5:54 am
by mol
I've made some test and it works good to me.
I've closed parameter with " characters for sure:

Code: Select all

	cParam := '"' + GetDesktopFolder()+'\' + cFile +'"'
but, it's not necessary, I think.
Are you sure your problems are caused with spaces in file name?
In my Windows XP system, WORDPAD.EXE is NOT placed in WINDOWS directly, but in:
c:\Program Files\Windows NT\Accessories\wordpad.exe
Maybe your problem solution lays here?

Re: Question about marco

Posted: Sat Jul 23, 2011 4:41 am
by huangchenmin
mol wrote:I've made some test and it works good to me.
I've closed parameter with " characters for sure:

Code: Select all

	cParam := '"' + GetDesktopFolder()+'\' + cFile +'"'
but, it's not necessary, I think.
Are you sure your problems are caused with spaces in file name?
In my Windows XP system, WORDPAD.EXE is NOT placed in WINDOWS directly, but in:
c:\Program Files\Windows NT\Accessories\wordpad.exe
Maybe your problem solution lays here?
Mine either.
I will try again later.
Best Regards
chen min