Section One BBS

Welcome, Guest.


Subject: Re: Mystic Program Question Date: Thu Jan 05 2023 10:37 pm
From: g00r00 To: Mike Fenton

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)

Previous Message       Next Message
In Reply To: Re: Mystic Program Question (g00r00)