[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: running python programs from StrongED



In message <7288024b58.John@xxxxxxxxxxxxxxxxxxxxxx>
          John Rickman <rickman@xxxxxxxxxxxxx> wrote:

> I would like to be able to run python programs from StrongED by clicking 
> the Run icon in a similar way to running BASIC and Obey files.
> 
> At the moment to run a Python program I use the  following obey:
> 
>    dir <obey$dir>
>    python3 pgm 1>a 2>b
> 
> I can see how StrongED might invoke : python3 pgm
> but not how to pass the other parameters.

Normally one would use the 'Run' function to call an external program.
For your example above this might look something like this:

  Functions
    SetTmp() Run("Dir <StrongED$Tmp_FilePath>")
    Run("python3 <StrongED$Tmp_FileName> 1>a 2>b")
  End

Note that the functions should all be on the same line.

Whether that works depends on what 'a' and 'b' are, and if they are
static or not.


If it doesn't work then it would be best to use an intermediate Obey
file and call that from StrongED.

  Functions
    SetTmp() Run("Run Obey-filename <StrongED$Tmp_FileName>")
  End

Where <Obey-filename> is the filename of the Obey file to run. The Obey
file should pass the filename given in the Run command to python:

  dir <obey$dir>
  python3 %*0 1>a 2>b


It may take a bit of experimentation to get things to work properly but
at least one of above methods should work.

Cheers,
Fred.

-- 
StrongED Developer
http://www.stronged.iconbar.com/