• Mystic Program Question

    From Mike Fenton@1:229/310 to g00r00 on Wed Jan 4 20:59:08 2023
    I'm in the process of creating a program and the following works perfect under linux but under windows it cuts out the length of the command.

    I basically have menucmd('DD','command ' + var + var1 + var2 +var3 + 'something ' + var4 + '')

    So the length of this command sent to the command line is very long and works fine under linux, but gets cut short under windows.

    Is there some type of limitation on the windows side?

    ... A program is used to turn data into error messages.

    --- Mystic BBS v1.12 A48 (Linux/64)
    * Origin: Clutch BBS * telnet://bbs.clutchbbs.com (1:229/310)
  • From g00r00@1:129/215 to Mike Fenton on Thu Jan 5 10:15:38 2023
    I'm in the process of creating a program and the following works perfect under linux but under windows it cuts out the length of the command.

    I basically have menucmd('DD','command ' + var + var1 + var2 +var3 + 'something ' + var4 + '')

    There shouldn't be any difference between Linux and Windows. I am assuming this is MPL? Are you talking about the MIDE editor or where are you seeing this?

    I do think there is a limit to the length of the menu command data and its around 200 characters, but that also exists in Linux as well. I can expand on that limit if needed though.

    ... (A)bort, (R)etry, (I)nfluence with large hammer.

    --- Mystic BBS v1.12 A48 (Windows/64)
    * Origin: Sector 7 * Mystic WHQ (1:129/215)
  • From Mike Fenton@1:229/310 to g00r00 on Thu Jan 5 12:31:44 2023

    There shouldn't be any difference between Linux and Windows. I am assuming this is MPL? Are you talking about the MIDE editor or where
    are you seeing this?

    No, not mide. It's the output I see in the logs and the fact the full command is not sent. It works under linux, same command, but not under windows.

    The easiest way to probably recreate this is to create a MPL with a menucmd('DD', 'input a very long line') and run that from windows and then from linux. Watch the logs and you will see that it gets cut short on the windows end.

    ... I am NOT a tagline THIEF. I am a tagline CONSERVATIONIST.

    --- Mystic BBS v1.12 A48 (Linux/64)
    * Origin: Clutch BBS * telnet://bbs.clutchbbs.com (1:229/310)
  • From g00r00@1:129/215 to Mike Fenton on Thu Jan 5 13:16:22 2023
    The easiest way to probably recreate this is to create a MPL with a menucmd('DD', 'input a very long line') and run that from windows and
    then from linux. Watch the logs and you will see that it gets cut short
    on the windows end.

    Seems ok to me in Windows. The text I did is probably about 150 characters long and it seems to be executing fine. Do you have any other ideas on how I could reproduce the problem?

    ------------------- Node 1 (Mystic v1.12 A48 2023/01/04)
    2023.01.05 13:14:19 Connect from local (local)
    2023.01.05 13:14:20 g00r00 logged in
    2023.01.05 13:14:20 Setting time left to 1400
    2023.01.05 13:14:20 Setting menu to "prelogin" (Default start menu)
    2023.01.05 13:14:23 MPL execute: \mystic\test1.mpx
    2023.01.05 13:14:23 Executing: This is a very long string operation and it might cause an issue in windows with the text getting cut off so we will have to execute and find out what happens
    2023.01.05 13:14:23 Execution complete: 1
    2023.01.05 13:14:24 User logged off
    2023.01.05 13:14:24 Shutting down

    ... Intelligence tests are biased toward the literate.

    --- Mystic BBS v1.12 A48 (Windows/64)
    * Origin: Sector 7 * Mystic WHQ (1:129/215)
  • From Mike Fenton@1:229/310 to g00r00 on Thu Jan 5 19:18:52 2023
    Seems ok to me in Windows. The text I did is probably about 150 characters long and it seems to be executing fine. Do you have any
    other ideas on how I could reproduce the problem?


    Unless I'm pushing over 200 characters under windows not realizing. The command is slightely different.

    Is there anyway to get this character limit increased? I can then test on my end?

    ... Why is the man who invests all your money called a broker?

    --- Mystic BBS v1.12 A48 (Linux/64)
    * Origin: Clutch BBS * telnet://bbs.clutchbbs.com (1:229/310)
  • From g00r00@1:129/215 to Mike Fenton on Thu Jan 5 20:55:50 2023
    Unless I'm pushing over 200 characters under windows not realizing. The command is slightely different.

    Is there anyway to get this character limit increased? I can then test
    on my end?

    Ok so I did a review of code now that I am not at work. Here's the deal:

    The menu editor is limited to 250 characters now (up from 200) for the optional data field. In MPL there is a hard limitation of 255 characters which is an MPL limitation on all OSes that I cannot easily extend.

    If you need to go longer than 255 from MPL then you'd have to write the command(s) to a .bat file in the node's temp directory and then execute the .bat file. It'd probably be good to delete the .bat after running as well.

    You can also use Mystic Python which has the same MenuCmd function that should be able to handle the full 8000 character command line length that Windows allows.

    Sorry I don't have better news on this one. I do want to expand on MPL 255 limit someday, but honestly its a pretty low priority these days.

    ... Just another prisoner of gravity!

    --- Mystic BBS v1.12 A48 (Windows/64)
    * Origin: Sector 7 * Mystic WHQ (1:129/215)
  • From g00r00@1:129/215 to Mike Fenton on Thu Jan 5 22:21:04 2023
    I did attempt to write this to a file using appendtext and when I did it this way, the information contained in the bat file was also cut off. It wasn't passing all the information. Seemed like a limit there too....

    Yep AppendText would have the same limit. Strings in MPL are limited to 255 characters everywhere.

    To do it in MPL you have to break it up into small chunks and then write it to the file. Here is a quick example I whipped up for you (you could also check the OSID function and make it create a .sh in Unix and .bat in Windows):

    Uses CFG

    Var
    F : File;
    Cmd1 : String;
    Cmd2 : String;
    Cmd3 : String;
    BatchName : String;
    Begin
    Cmd1 := 'REM This is the first part of a long command. ';
    Cmd2 := 'And this is part two of a long commmand. ';
    Cmd3 := 'And this is part three of a long command';

    Write ('Command line: ');
    Write (Cmd1)
    Write (Cmd2)
    WriteLn (Cmd3)

    fAssign (F, CfgTempPath + 'mybat.bat', 66);
    fReWrite (F);
    fWriteStr (F, Cmd1);
    fWriteStr (F, Cmd2);
    fWriteLn (F, Cmd3);
    fClose (F);

    WriteLn ('Batch file created. Press any key to execute and delete: |PN');

    MenuCmd('DD', CfgTempPath + 'mybat.bat');

    FileErase (CfgTempPath + 'mybat.bat');
    End.

    ... The dog ate my .REP packet

    --- Mystic BBS v1.12 A48 (Windows/64)
    * Origin: Sector 7 * Mystic WHQ (1:129/215)
  • From g00r00@1:129/215 to Mike Fenton on Thu Jan 5 22:37:02 2023
    Here is a cleaner example of executing a command line up to 1000 characters if you split it into 4 chunks of 255:

    Uses CFG

    Function LargeCommand (Name: String; C1, C2, C3, C4: String) : String;
    Var
    F : File;
    Begin
    If OSType = 0 or OSType = 4 Then // Windows or OS/2
    Name := Name + '.bat'
    Else
    Name := Name + '.sh';

    fAssign (F, CfgTempPath + Name, 66);
    fReWrite (F);
    fWriteStr (F, C1);
    fWriteStr (F, C2);
    fWriteStr (F, C3);
    fWriteLn (F, C4);
    fClose (F);

    LargeCommand := CfgTempPath + Name;
    End;

    Var
    Command : String;
    Begin

    Command := LargeCommand(
    'mybatch', // Filename (.bat or .sh will be added)
    'Large command line part 1', // Part 1 of long command
    'Large command line part 2', // Part 2 of long command
    '', // Part 3 of long command
    '' // Part 4 of long command
    );

    // Large command returns the path and filename of the batch file so we can
    // take that and execute then delete it:

    //MenuCmd ('DD', Command);
    //FileErase (Command);
    End.

    ... A book misplaced is a book lost

    --- Mystic BBS v1.12 A48 (Windows/64)
    * Origin: Sector 7 * Mystic WHQ (1:129/215)
  • From Mike Fenton@1:229/310 to g00r00 on Fri Jan 6 05:33:12 2023
    On 05 Jan 2023, g00r00 said the following...

    I did attempt to write this to a file using appendtext and when I did this way, the information contained in the bat file was also cut off. wasn't passing all the information. Seemed like a limit there too....

    Yep AppendText would have the same limit. Strings in MPL are limited to 255 characters everywhere.

    To do it in MPL you have to break it up into small chunks and then write it to the file. Here is a quick example I whipped up for you (you could also check the OSID function and make it create a .sh in Unix and .bat
    in Windows):

    Uses CFG

    Var
    F : File;
    Cmd1 : String;
    Cmd2 : String;
    Cmd3 : String;
    BatchName : String;
    Begin
    Cmd1 := 'REM This is the first part of a long command. ';
    Cmd2 := 'And this is part two of a long commmand. ';
    Cmd3 := 'And this is part three of a long command';

    Write ('Command line: ');
    Write (Cmd1)
    Write (Cmd2)
    WriteLn (Cmd3)

    fAssign (F, CfgTempPath + 'mybat.bat', 66);
    fReWrite (F);
    fWriteStr (F, Cmd1);
    fWriteStr (F, Cmd2);
    fWriteLn (F, Cmd3);
    fClose (F);

    WriteLn ('Batch file created. Press any key to execute and delete: |PN');
    MenuCmd('DD', CfgTempPath + 'mybat.bat');

    FileErase (CfgTempPath + 'mybat.bat');
    End.


    Awesome. I will give this a shot today.

    ... "No comment" is a comment.

    --- Mystic BBS v1.12 A48 (Linux/64)
    * Origin: Clutch BBS * telnet://bbs.clutchbbs.com (1:229/310)
  • From Mike Fenton@1:229/310 to g00r00 on Fri Jan 6 12:50:50 2023
    On 05 Jan 2023, g00r00 said the following...

    I did attempt to write this to a file using appendtext and when I did this way, the information contained in the bat file was also cut off. wasn't passing all the information. Seemed like a limit there too....

    Yep AppendText would have the same limit. Strings in MPL are limited to 255 characters everywhere.

    To do it in MPL you have to break it up into small chunks and then write it to the file. Here is a quick example I whipped up for you (you could also check the OSID function and make it create a .sh in Unix and .bat
    in Windows):

    Uses CFG

    Var
    F : File;
    Cmd1 : String;
    Cmd2 : String;
    Cmd3 : String;
    BatchName : String;
    Begin
    Cmd1 := 'REM This is the first part of a long command. ';
    Cmd2 := 'And this is part two of a long commmand. ';
    Cmd3 := 'And this is part three of a long command';

    Write ('Command line: ');
    Write (Cmd1)
    Write (Cmd2)
    WriteLn (Cmd3)

    fAssign (F, CfgTempPath + 'mybat.bat', 66);
    fReWrite (F);
    fWriteStr (F, Cmd1);
    fWriteStr (F, Cmd2);
    fWriteLn (F, Cmd3);
    fClose (F);

    WriteLn ('Batch file created. Press any key to execute and delete: |PN');
    MenuCmd('DD', CfgTempPath + 'mybat.bat');

    FileErase (CfgTempPath + 'mybat.bat');
    End.


    This worked great! Thanks.

    ... Marriage is one of the chief causes of divorce

    --- Mystic BBS v1.12 A48 (Linux/64)
    * Origin: Clutch BBS * telnet://bbs.clutchbbs.com (1:229/310)