• DOS Batch files

    From Spectre@21:3/101 to Somebody on Saturday, December 21, 2019 21:04:00
    I have this exceedingly ugly batchfile...

    random errorlevel
    if errorlevel 1 copy \goodbye\5.ans \sbbs\txt\goodbye.ans
    if errorlevel 2 copy \goodbye\4.ans \sbbs\txt\goodbye.ans
    if errorlevel 3 copy \goodbye\3.ans \sbbs\txt\goodbye.ans
    if errorlevel 4 copy \goodbye\2.ans \sbbs\txt\goodbye.ans
    if errorlevel 5 copy \goodbye\1.ans \sbbs\txt\goodbye.ans
    if errorlevel 6 copy \goodbye\6.ans \sbbs\txt\goodbye.ans
    if errorlevel 7 copy \goodbye\7.ans \sbbs\txt\goodbye.ans
    if errorlevel 8 copy \goodbye\8.ans \sbbs\txt\goodbye.ans
    if errorlevel 9 copy \goodbye\9.ans \sbbs\txt\goodbye.ans


    It occured to me, if I could pass a parameter to a procedure I guess you'd ¨call it, I could use far few lines and stop copying larger numbers of ansi ¨files for no good reason.

    Ergo

    random errorlevel
    goto copy %errorlevel

    :copy
    copy %something.ans goodbye.ans

    Anyone got any ideas? I don't remember having to do anything like this ¨before,
    and offhand can't come up with a better idea.

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Spectre@21:3/101 to Somebody on Saturday, December 21, 2019 21:04:00
    I have this exceedingly ugly batchfile...

    random errorlevel
    if errorlevel 1 copy \goodbye\5.ans \sbbs\txt\goodbye.ans
    if errorlevel 2 copy \goodbye\4.ans \sbbs\txt\goodbye.ans
    if errorlevel 3 copy \goodbye\3.ans \sbbs\txt\goodbye.ans
    if errorlevel 4 copy \goodbye\2.ans \sbbs\txt\goodbye.ans
    if errorlevel 5 copy \goodbye\1.ans \sbbs\txt\goodbye.ans
    if errorlevel 6 copy \goodbye\6.ans \sbbs\txt\goodbye.ans
    if errorlevel 7 copy \goodbye\7.ans \sbbs\txt\goodbye.ans
    if errorlevel 8 copy \goodbye\8.ans \sbbs\txt\goodbye.ans
    if errorlevel 9 copy \goodbye\9.ans \sbbs\txt\goodbye.ans


    It occured to me, if I could pass a parameter to a procedure I guess you'd call
    it, I could use far few lines and stop copying larger numbers of ansi files for no good reason.

    Ergo

    random errorlevel
    goto copy %errorlevel

    :copy
    copy %something.ans goodbye.ans

    Anyone got any ideas? I don't remember having to do anything like this before, and offhand can't come up with a better idea.

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From maskreet@21:1/114 to Spectre on Saturday, December 21, 2019 10:39:48
    On 21 Dec 2019, Spectre said the following...

    I have this exceedingly ugly batchfile...

    Anyone got any ideas? I don't remember having to do anything like this before, and offhand can't come up with a better idea.

    Could probably just use the random number for the number of the ansi.

    Like:

    SET /a anum=(%RANDOM%*10/32768)+1
    copy \goodbye\%anum%.ans \sbbs\txt\goodbye.ans

    That'll do a random number between 1 and 10. Just change the number
    multiplied by %RANDOM% to whatever your max number of ansis are.

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: throwbackbbs.com -\- meriden, ct -\- (21:1/114)
  • From Digital Man@21:1/183 to Spectre on Saturday, December 21, 2019 13:44:50
    Re: DOS Batch files
    By: Spectre to Somebody on Sat Dec 21 2019 09:04 pm

    I have this exceedingly ugly batchfile...

    random errorlevel
    if errorlevel 1 copy \goodbye\5.ans \sbbs\txt\goodbye.ans
    if errorlevel 2 copy \goodbye\4.ans \sbbs\txt\goodbye.ans
    if errorlevel 3 copy \goodbye\3.ans \sbbs\txt\goodbye.ans
    if errorlevel 4 copy \goodbye\2.ans \sbbs\txt\goodbye.ans
    if errorlevel 5 copy \goodbye\1.ans \sbbs\txt\goodbye.ans
    if errorlevel 6 copy \goodbye\6.ans \sbbs\txt\goodbye.ans
    if errorlevel 7 copy \goodbye\7.ans \sbbs\txt\goodbye.ans
    if errorlevel 8 copy \goodbye\8.ans \sbbs\txt\goodbye.ans
    if errorlevel 9 copy \goodbye\9.ans \sbbs\txt\goodbye.ans

    I'm not sure if you realize it, but "if error level 1" means "if errorlevel is greater or equal to 1". I think you mean to use "if %errorlevel% equ 1" instead.
    https://ss64.com/nt/errorlevel.html

    digital man

    Synchronet/BBS Terminology Definition #57:
    RIP = Remote Imaging Protocol (e.g. RIPscrip)
    Norco, CA WX: 71.7ųF, 33.0% humidity, 0 mph WNW wind, 0.00 inches rain/24hrs --- SBBSecho 3.10-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (21:1/183)
  • From Spectre@21:3/101 to maskreet on Sunday, December 22, 2019 08:59:00
    SET /a anum=(%RANDOM%*10/32768)+1 copy \goodbye\%anum%.ans \sbbs\txt\goodbye.ans

    Didn't know there was one in ANSI.SYS.. means I'll have to load it.. its not ¨presently although it does wonders for display nothing actually needs it. ¨I'll give it a try see how it goes.

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Spectre@21:3/101 to maskreet on Sunday, December 22, 2019 09:18:00
    SET /a anum=(%RANDOM%*10/32768)+1

    This isn't supported, I end up with

    set

    "/A ANUM=(%RANDOM%*10/32768)+1"

    don't mind the quotes, / A is a abort message in my message editor.

    Spec


    *** THE READER V4.50 [freeware]
    --- SuperBBS v1.17-3 (Eval)
    * Origin: Scrawled in haste at The Lower Planes (21:3/101)
  • From Spectre@21:3/101 to maskreet on Sunday, December 22, 2019 08:59:00
    SET /a anum=(%RANDOM%*10/32768)+1 copy \goodbye\%anum%.ans \sbbs\txt\goodbye.ans

    Didn't know there was one in ANSI.SYS.. means I'll have to load it.. its not presently although it does wonders for display nothing actually needs it. I'll give it a try see how it goes.

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Spectre@21:3/101 to Digital Man on Sunday, December 22, 2019 10:42:00
    random errorlevel if errorlevel 1 copy \goodbye\5.ans

    I'm not sure if you realize it, but "if error level 1" means "if errorlevel is greater or equal to 1". I think you mean to use "if

    Thats the only way I've ever used errorlevels, basic bbs batch file work, and ¨why the errorlevels are always listed low to high... equal would certainly ¨cut down the work...

    I found this which looks like it should work too.. I can easily add extra ¨levels when and if they're needed. And just bang one copy command on the end.

    IF ERRORLEVEL 1 SET ERRORLEV=1
    IF ERRORLEVEL 2 SET ERRORLEV=2
    IF ERRORLEVEL 3 SET ERRORLEV=3
    IF ERRORLEVEL 4 SET ERRORLEV=4
    *
    *
    *
    IF ERRORLEVEL 254 SET ERRORLEV=254
    IF ERRORLEVEL 255 SET ERRORLEV=255
    ECHO ERRORLEVEL = %ERRORLEV%

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Spectre@21:3/101 to Digital Man on Sunday, December 22, 2019 10:46:00
    One of the problems I've kept running into is batch commands that do not work ¨in DOS. They might work under a windows command shell of some version but ¨not the old DOS command.com :/

    Spec


    *** THE READER V4.50 [freeware]
    --- SuperBBS v1.17-3 (Eval)
    * Origin: Scrawled in haste at The Lower Planes (21:3/101)
  • From Spectre@21:3/101 to Digital Man on Sunday, December 22, 2019 10:42:00
    random errorlevel if errorlevel 1 copy \goodbye\5.ans

    I'm not sure if you realize it, but "if error level 1" means "if errorlevel is greater or equal to 1". I think you mean to use "if

    Thats the only way I've ever used errorlevels, basic bbs batch file work, and why the errorlevels are always listed low to high... equal would certainly cut down the work...

    I found this which looks like it should work too.. I can easily add extra levels when and if they're needed. And just bang one copy command on the end.

    IF ERRORLEVEL 1 SET ERRORLEV=1
    IF ERRORLEVEL 2 SET ERRORLEV=2
    IF ERRORLEVEL 3 SET ERRORLEV=3
    IF ERRORLEVEL 4 SET ERRORLEV=4
    *
    *
    *
    IF ERRORLEVEL 254 SET ERRORLEV=254
    IF ERRORLEVEL 255 SET ERRORLEV=255
    ECHO ERRORLEVEL = %ERRORLEV%

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From maskreet@21:1/114 to Spectre on Saturday, December 21, 2019 23:11:03
    On 22 Dec 2019, Spectre said the following...

    SET /a anum=(%RANDOM%*10/32768)+1

    This isn't supported, I end up with

    set

    "/A ANUM=(%RANDOM%*10/32768)+1"

    don't mind the quotes, / A is a abort message in my message editor.

    What OS are you running? If I remember right, %RANDOM% should work in everything from Windows 95 and up, maybe earlier.

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: throwbackbbs.com -\- meriden, ct -\- (21:1/114)
  • From maskreet@21:1/114 to Spectre on Saturday, December 21, 2019 23:13:25
    On 22 Dec 2019, Spectre said the following...

    SET /a anum=(%RANDOM%*10/32768)+1 copy \goodbye\%anum%.ans \sbbs\txt\goodbye.ans

    Didn't know there was one in ANSI.SYS.. means I'll have to load it.. its not presently although it does wonders for display nothing actually
    needs it. I'll give it a try see how it goes.

    Also, not sure what setting a random number to a variable has to do with ANSI.SYS. =) The example I gave just cleans up the multipart batch you
    posted. It should pick a pseudo-random number from the %RANDOM% var, set it
    to the variable anum, multiply by 10, divide by the max of 32768, and add 1
    to it to make it 1-10, instead of 0-9. Then your copy command just uses the random number in the variable in place of the ansi name, like 1.ans, 2.ans,
    etc

    What's the DOS message you're getting, or not getting when you use this?

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: throwbackbbs.com -\- meriden, ct -\- (21:1/114)
  • From Spectre@21:3/101 to maskreet on Sunday, December 22, 2019 15:24:00
    What OS are you running? If I remember right, %RANDOM% should work
    in everything from Windows 95 and up, maybe earlier.

    MS-DOS 6.22

    For the time being I've run with the set ENV=x method and just copy %ENV%.ans ¨at the end of them... it might be setting the variable up to 8 times, but its ¨better than copying a file 8 times. :)

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Spectre@21:3/101 to maskreet on Sunday, December 22, 2019 15:26:00
    Also, not sure what setting a random number to a variable has to do
    with ANSI.SYS. =) The example I gave just cleans up the multipart

    My bad, misinterpretation of something you covered. All I get from.... ¨%RANDOM% is a variable that is literally set with %RANDOM% in it as a text ¨string. No errors per se.

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Spectre@21:3/101 to maskreet on Sunday, December 22, 2019 15:24:00
    What OS are you running? If I remember right, %RANDOM% should work
    in everything from Windows 95 and up, maybe earlier.

    MS-DOS 6.22

    For the time being I've run with the set ENV=x method and just copy %ENV%.ans at the end of them... it might be setting the variable up to 8 times, but its better than copying a file 8 times. :)

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Spectre@21:3/101 to maskreet on Sunday, December 22, 2019 15:26:00
    Also, not sure what setting a random number to a variable has to do
    with ANSI.SYS. =) The example I gave just cleans up the multipart

    My bad, misinterpretation of something you covered. All I get from.... %RANDOM%
    is a variable that is literally set with %RANDOM% in it as a text string. No errors per se.

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Vk3jed@21:1/109 to Digital Man on Sunday, December 22, 2019 17:28:00
    On 12-21-19 13:44, Digital Man wrote to Spectre <=-

    Re: DOS Batch files
    By: Spectre to Somebody on Sat Dec 21 2019 09:04 pm

    I have this exceedingly ugly batchfile...

    random errorlevel
    if errorlevel 1 copy \goodbye\5.ans \sbbs\txt\goodbye.ans
    if errorlevel 2 copy \goodbye\4.ans \sbbs\txt\goodbye.ans
    if errorlevel 3 copy \goodbye\3.ans \sbbs\txt\goodbye.ans
    if errorlevel 4 copy \goodbye\2.ans \sbbs\txt\goodbye.ans
    if errorlevel 5 copy \goodbye\1.ans \sbbs\txt\goodbye.ans
    if errorlevel 6 copy \goodbye\6.ans \sbbs\txt\goodbye.ans
    if errorlevel 7 copy \goodbye\7.ans \sbbs\txt\goodbye.ans
    if errorlevel 8 copy \goodbye\8.ans \sbbs\txt\goodbye.ans
    if errorlevel 9 copy \goodbye\9.ans \sbbs\txt\goodbye.ans

    I'm not sure if you realize it, but "if error level 1" means "if errorlevel is greater or equal to 1". I think you mean to use "if %errorlevel% equ 1" instead.
    https://ss64.com/nt/errorlevel.html

    In the old DOS days, one had to check the highest errorlevel value first and work down, to make sure the right action was taken. And of course, in one like the above, a GOTO would be needed to skip any unwanted errorlevel checks.

    But as is, the above batch file would work, but it would generate a heap of unnecessary copying, before the correct file was left. Yep, ugly is the word. :D

    Id the "equ" part something relatively new to Windows?


    ... I distinctly remember forgetting that.
    === MultiMail/Win v0.51
    --- SBBSecho 3.10-Linux
    * Origin: Freeway BBS Bendigo,Australia freeway.apana.org.au (21:1/109)
  • From Vk3jed@21:1/109 to Spectre on Sunday, December 22, 2019 17:30:00
    On 12-22-19 10:42, Spectre wrote to Digital Man <=-

    random errorlevel if errorlevel 1 copy \goodbye\5.ans

    I'm not sure if you realize it, but "if error level 1" means "if errorlevel is greater or equal to 1". I think you mean to use "if

    Thats the only way I've ever used errorlevels, basic bbs batch file
    work, and why the errorlevels are always listed low to high... equal
    would certainly cut down the work...

    I recall having to go from high to low, not low to high.


    ... Avoid off topic messages. Start conversations with the Moderator!
    === MultiMail/Win v0.51
    --- SBBSecho 3.10-Linux
    * Origin: Freeway BBS Bendigo,Australia freeway.apana.org.au (21:1/109)
  • From ryan@21:1/168 to Spectre on Sunday, December 22, 2019 01:29:13
    Hey Spectre,

    Just FYI, I'm getting a bunch of dupe messages from you :)

    I'm not sure what (if anything) changed recently on fsxNet but wanted to flag.

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: monterey bbs (21:1/168)
  • From poindexter FORTRAN@21:4/122 to Spectre on Sunday, December 22, 2019 08:05:00
    Spectre wrote to Somebody <=-

    I have this exceedingly ugly batchfile...

    random errorlevel
    if errorlevel 1 copy \goodbye\5.ans \sbbs\txt\goodbye.ans

    I replaced a similar batch file with a bit of javascript that runs in the
    BBS, would this work for you? This code block should do the same thing.
    I used this to randomize the taglines under the main menu from the telnet interface and on the web site. I didn't write this, credit goes to someone else who I've long since forgotten (maybe DM?).


    [code]
    // Print one of text/menu/random*.*, picked at random
    // e.g. random1.asc, random2.asc, random3.asc, etc.
    var random_list = directory(system.text_dir + "menu/random*.*");

    if(random_list.length) bbs.menu(file_getname(random_list[random(random_list.length)]).slice(0,-4)); printf(""+(random_list[random(random_list.length)]).slice(0,-4));

    if(random_list.length > 0) {
    var f = file_getname(random_list[random(random_list.length)]).slice(0,-4); if(f.length > 0)
    bbs.menu(f);
    }

    [/code]
    --- SBBSecho 3.09-Win32
    * Origin: http://realitycheckbbs.org (21:4/122)
  • From Black Panther@21:1/186 to ryan on Sunday, December 22, 2019 12:39:46
    On 22 Dec 2019, ryan said the following...

    Just FYI, I'm getting a bunch of dupe messages from you :)

    I'm not sure what (if anything) changed recently on fsxNet but wanted to flag.

    Yep, there are some dupes coming through from him. Avon changed over to HPT mail tosser, like hub 4 is, and it doesn't remove the soft CRs like Mystic does...

    Deon, you might want to either only crash to Hub 2, or crash to Hubs 1 & 4... I'm not sure if there is another solution at this point...


    ---

    Black Panther(RCS)
    Castle Rock BBS

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)
  • From Al@21:4/106 to Black Panther on Sunday, December 22, 2019 14:57:56
    Hello Black,

    Yep, there are some dupes coming through from him. Avon changed over
    to HPT mail tosser, like hub 4 is, and it doesn't remove the soft CRs
    like Mystic does...

    I haven't seen any dupes (recently) in net 4. My guess is that ryan is seeing them arrive in net 1 changed via net 2. :(

    Ttyl :-),
    Al

    --- GoldED+/LNX 1.1.5-b20180707
    * Origin: The Rusty MailBox - Penticton, BC Canada (21:4/106)
  • From Spectre@21:3/101 to Vk3jed on Monday, December 23, 2019 09:30:00
    I recall having to go from high to low, not low to high.

    That is true, but you normally leave the list at the first match, so high ¨numbers have to be checked first. In my case each successive match operates ¨until there are no matches left, functional but messy...

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Spectre@21:3/101 to poindexter FORTRAN on Monday, December 23, 2019 09:35:00
    I replaced a similar batch file with a bit of javascript that runs
    in the BBS, would this work for you? This code block should do the

    I don't think I can run php under dos. :)

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Spectre@21:3/101 to ryan on Monday, December 23, 2019 09:36:00

    Just FYI, I'm getting a bunch of dupe messages from you :)

    I haven't changed anything here, are the messages originating here or ¨messages
    from somewhere else getting exported again?

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Spectre@21:3/101 to Vk3jed on Monday, December 23, 2019 09:30:00
    I recall having to go from high to low, not low to high.

    That is true, but you normally leave the list at the first match, so high numbers have to be checked first. In my case each successive match operates until there are no matches left, functional but messy...

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Spectre@21:3/101 to ryan on Monday, December 23, 2019 09:36:00

    Just FYI, I'm getting a bunch of dupe messages from you :)

    I haven't changed anything here, are the messages originating here or messages from somewhere else getting exported again?

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From ryan@21:1/168 to Spectre on Sunday, December 22, 2019 15:40:30
    I haven't changed anything here, are the messages originating here or messages from somewhere else getting exported again?

    Not sure, I'll have to investigate in a bit when I hopefully have more time later (pre-holidy "honey do" list is out of control at the moment).

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: monterey bbs (21:1/168)
  • From Alterego@21:2/116 to Black Panther on Monday, December 23, 2019 11:03:33
    Re: Re: DOS Batch files
    By: Black Panther to ryan on Sun Dec 22 2019 12:39 pm

    Deon, you might want to either only crash to Hub 2, or crash to Hubs 1 & 4... I'm not sure if there is another solution at this point...

    Done, I've re-enabled mail to Hub 4 and removed Hub 2.

    I just notice a heap go out to Hub 4 (when I re-enabled the filebox) - forgot to remove those - so if they all come in as dupes - Oops sorry :)

    But after this one, the dupes should stop - and I'll keep Mystic out of the loop until we know its been fixed.
    ...deon


    ... I have a new philosophy. I'm only going to dread one day at a time.
    --- SBBSecho 3.10-Linux
    * Origin: I'm playing with ANSI+videotex - wanna play too? (21:2/116)
  • From Black Panther@21:1/186 to Al on Sunday, December 22, 2019 18:32:14
    On 22 Dec 2019, Al said the following...

    Yep, there are some dupes coming through from him. Avon changed over to HPT mail tosser, like hub 4 is, and it doesn't remove the soft CRs like Mystic does...

    I haven't seen any dupes (recently) in net 4. My guess is that ryan is seeing th em arrive in net 1 changed via net 2. :(

    Yes, now the Paul changed Hub 1 over to HPT, these messages are now getting duped in net 1. :(


    ---

    Black Panther(RCS)
    Castle Rock BBS

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)
  • From Black Panther@21:1/186 to Alterego on Sunday, December 22, 2019 18:37:28
    On 23 Dec 2019, Alterego said the following...

    I just notice a heap go out to Hub 4 (when I re-enabled the filebox) - forgot to remove those - so if they all come in as dupes - Oops sorry :)

    It looks like hpt caught about half of them as dupes. Not a problem. :)

    But after this one, the dupes should stop - and I'll keep Mystic out of the loop until we know its been fixed.

    Hopefully, g00r00 will be back soon and can take care of the issue.


    ---

    Black Panther(RCS)
    Castle Rock BBS

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)