Topic: flie_save(9 and file date (1 of 3), Read 28 times
Conf: VEDIT Macro Language Support
From: Fritz Heberlein
Date: Friday, December 28, 2001 05:19 PM

I have a macro that saves a file to disk and vice versa provided directory structures are identical. Is works fine so far, but it has a serious shortcoming, viz. it doesn't check whether the target file is newer than the source file. How could I accomplish that?

Thanks,
Fritz

-------------------------
here is the macro:


// File save a:\{PATHNAME} -> c:\{PATHNAME} and vice versa
if(#1==5){ //if button #5
#20=BufNum
regset(101,PATHNAME) //put ful pathname into TReg 101
Bufswitch(buffree)
regins(101)
BOF()
if(search("a:\",noerr)==1) // switch drive letter
{r("a:\","c:\",BEGIN)}
else {r("c:\","a:\",BEGIN)}
BOF()
RCB(102,0,EOL_Pos) //put new pathname to TReg 102
Buf_Quit(ok)
Buf_switch(#20)
file_save_as("|@(102)") //save file with new pathname
file_close(nomsg)
file_open("|@(101)") //open original file
Breakout(extra)}

 


Topic: Re: flie_save(9 and file date (2 of 3), Read 28 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Saturday, December 29, 2001 10:39 AM

Fritz:

The file date etc. are not so easy to determine in VEDIT.

You can have a look at the thread "FileInfo.vdm" in the forum
'vedit-macros' from 16 May 2001.

There I introduced a little macro to get those infos. Maybe you can
use it as example for your task and check the file date this way.

Christian

 


Topic: Re: file_save() and file date (3 of 3), Read 29 times
Conf: VEDIT Macro Language Support
From: Fritz Heberlein
Date: Saturday, December 29, 2001 05:51 PM

Christian:

> The file date etc. are not so easy to determine in VEDIT.
>
> You can have a look at the thread "FileInfo.vdm" in the forum
> 'vedit-macros' from 16 May 2001.

thanks for the tipp!
You are right: it's much easier to do it via the sys() command. I have
exchanged the file_save_as() command against the TakeCommand32
copy command, which unlike Win98 has a /update switch (what about
XP: has it got command extensions like that?). Now everything goes
well.

Fritz

-------------------------------
// File save a:\{PATHNAME} -> c:\{PATHNAME} and vice versa
if(#1==5){ //if button #5
#20=BufNum
regset(101,PATHNAME) //put pathname into TReg 101
Bufswitch(buffree)
regins(101)
BOF()
if(search("a:\",noerr)==1) // switch drive letter
{r("a:\","c:\",BEGIN)}
else {r("c:\","a:\",BEGIN)}
BOF()
RCB(102,0,EOL_Pos) //put new pathname to TReg 102
Buf_Quit(ok)
Buf_switch(#20)
sys("c:\tc2\tcmd32 copy/u |@(101) |@(102 &
exit)",SIMPLE+NOWAIT) //call tcmd32 copy/update and exit
Breakout(extra)}

Dr. Friedrich Heberlein, Akad. Direktor
Seminar für Klassische Philologie
KU Eichstaett
Universitaetsallee 1
D-85071 Eichstaett / Bayern

email: sla019@...
Tel.: +49 8421 93 1544 / 93 3544