help with multilinea macro in not delayed
Posted: 22 Sep 2024 06:06
unfortunately with macros and the various /escape/ etc substitutions I have never been able to.
I am making a "Lite" version of the "automacro" program that Terry T3rror made viewtopic.php?f=3&t=11339. This is because I need to keep the macros also in the form of subprocedures callable with call: (I don't know if I will succeed).
I have reached a point where it seems impossible to cross the endlocal tunnel/barrier on a ready-made macro that contains LF. I have prepared a small example of the point that I cannot overcome.
Basically the automacro version of T3rror wants Delayed enabled. I am trying to enable it inside the automacroLite sub and therefore I have to overcome the barrier. I managed to overcome the barrier without LF and now I am in non-delayed mode.
And I wanted to know if it was possible to do the final part of the character substitution in non-delayed mode. The first substitution that I am trying is that of the LF. I am not succeeding and perhaps it is not possible as I was told.
But never say never....
is it possible to replace the [LF] with the var LF and have a multiline macro in not delayed mode?
Francesco Poscetti aka esintein1969
I am making a "Lite" version of the "automacro" program that Terry T3rror made viewtopic.php?f=3&t=11339. This is because I need to keep the macros also in the form of subprocedures callable with call: (I don't know if I will succeed).
I have reached a point where it seems impossible to cross the endlocal tunnel/barrier on a ready-made macro that contains LF. I have prepared a small example of the point that I cannot overcome.
Basically the automacro version of T3rror wants Delayed enabled. I am trying to enable it inside the automacroLite sub and therefore I have to overcome the barrier. I managed to overcome the barrier without LF and now I am in non-delayed mode.
And I wanted to know if it was possible to do the final part of the character substitution in non-delayed mode. The first substitution that I am trying is that of the LF. I am not succeeding and perhaps it is not possible as I was told.
But never say never....
Code: Select all
@echo on
setlocal disabledelayedexpansion
echo 1.
rem simple one line macro
set "macro1=set/a a=a+1"
set a=1
echo a=%a%
%macro1%
echo a=%a%
pause
echo 2.
rem multilinea macro
set "macro2=set/a a=a+1 [LF] set/a b=b+1 "
rem define \n
(Set LF=^
%= this line required =%
)
rem is it possible to replace the [LF] with the var LF and have a multiline macro in not delayed mode?
rem set macro2=%macro2:[LF]=.....%
rem use macro in delayed/not delayed , is it possible?
%macro2%
rem OR
setlocal enabledelayedexpansion
%macro2%
pause
is it possible to replace the [LF] with the var LF and have a multiline macro in not delayed mode?
Francesco Poscetti aka esintein1969