ZTree.com  | ZEN  | About...  

 Index   Back

adding 1 more %, doubling it, still dont work, so i was wondering if it was bug   [Q]

By: Ryan       
Date: Aug 28,2017 at 23:59
In Response to: [Q] N=20, ECHO %%%P1:~0,%%N%%%%, how can i make it work? [Bug?] (Nick Williams)

> Is the gap in "P1" intentional?
yes, it simulates as spaces

> SET "N=20"
> CALL ECHO:%%P1:~0,%N%%%
it was the same thing.

BB=works in command line (i meant as in batch)
SET N=20
ECHO %%P1:~0,%N%%%
it worked in a batch, so it must work in F9(=ztreemenu script)... but

>must double-up all those percent
but i have this problem, not a problem but more of the definitions that are going around
1. sometimes % works in F9 without adding more %
2. sometimes % works in F9 with adding 1 more %
3. sometimes % works in F9 with doubling it
i always try 1. 2. 3.

in batch %%P1:~0,%N%%% (2 1 3)
4. in F9, zero % adding it = %%P1:~0,%N%%% (2 1 3)
5. in F9, 1 more % adding it = %%%P1:~0,%%N%%%% (3 2 4)
6. in F9, doubling it = %%%%P1:~0,%%N%%%%%% (4 2 6)

4. 5. 6. didnt work in F9, this was so odd, it worked in a batch but not in F9.
so i had to ask if this was maybe a bug?

in batch "For %%X IN ()"
7. in F9, For %%X () doesnt work with 0 adding
8. in F9, For %%%X () works with 1 more adding
9. in F9, For %%%%X () works with doubling

F9 just shows %P1:~0,50% as a final echo-answer, but it doesnt run it.
so i am not sure which beat i need to dance with, so i am starting to add %s blindly after this point, sometimes it seemed to work for some joined variables A%%%B%%C

SetLocal EnableExtensions EnableDelayedExpansion
ECHO !P1:~0,%%AA%%!
it worked in F9, but DelayedExpansion interferes with the data with "!" so badly, this is my last resort to use.

>advice I can give you is to use batch (.BAT or .CMD) files for your code, not ZTreeMenu.
i have no skill to bring in the external variables called from a different batch
call batchname.bat %1

> using it SET "A=123" instead of SET A=123
i dont know what to say about this one.
if i have to change one now, i may have to change all of my scripts, then it would take 6 months, besides i have not encountered the interferences yet associated with Set A=123, but if they show the interference by squeezing everything into 1 line batch, then i may intentionally avoid it for a personal use only. Set A=123 works nicely in my brian, it comes so naturally with LET A=123 in basic compiler. i need to find the interference natually, so i always strip off "" from set "a=123" from others coding for my search.

Thread locked

Messages in this Thread

95,067 Postings in 11,984 Threads, 350 registered users, 76 users online (1 registered, 75 guests)
Index | Admin contact |   Forum Time: Aug 7, 2020 - 12:02 pm EDT  |  Hits:32,931,790  (14,831 Today )
RSS Feed