How to run another program from PowerLanguage  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
swz168
Posts: 120
Joined: 30 Sep 2010
Location: Germany
Has thanked: 47 times
Been thanked: 32 times

How to run another program from PowerLanguage

Postby swz168 » 09 Feb 2013

Does anyone know an easy way how I can run a program from inside PowerLanguage?

My Strategy creates csv files. The strategy should send them to my ftp adress using the command line program cURL (http://curl.haxx.se/)

Any help very appreciated. Thanks

User avatar
swz168
Posts: 120
Joined: 30 Sep 2010
Location: Germany
Has thanked: 47 times
Been thanked: 32 times

Re: How to run another program from PowerLanguage  [SOLVED]

Postby swz168 » 09 Feb 2013

For Multicharts 32 Bit Version, this thread would be the solution: viewtopic.php?f=1&t=8895&p=41983#p41970
Fury trader developed a 32bit dll for sending commands to the windows command shell.
Anyone knows about a 64bit dll for the same purpose?

arjfca
Posts: 1282
Joined: 23 Nov 2010
Has thanked: 724 times
Been thanked: 222 times

Re: How to run another program from PowerLanguage

Postby arjfca » 18 Nov 2015

swz168 wrote:For Multicharts 32 Bit Version, this thread would be the solution: viewtopic.php?f=1&t=8895&p=41983#p41970
Fury trader developed a 32bit dll for sending commands to the windows command shell.
Anyone knows about a 64bit dll for the same purpose?


This is an old tread, but did you resolve the problem?

Martin

User avatar
fbertram
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 37 times
Been thanked: 73 times
Contact:

Re: How to run another program from PowerLanguage

Postby fbertram » 19 Nov 2015

This is code I successfully used on a 64 bit system:

Code: Select all

Input:
   message(StringSimple);

//------------------------------------------------------------------------------
// declare ShellExecuteA

DEFINEDLLFUNC: "shell32.dll", int, "ShellExecuteA",
    lpstr, // HWND
    LPSTR, // lpOperation,
    LPSTR, // lpFile,
    LPSTR, // lpParameters,
    LPSTR, // lpDirectory,
    INT;   // nShowCmd

//------------------------------------------------------------------------------

variables:
    HWND        (""),
    lpOperation ("open"),
    lpFile      (""),
    lpParameters(""),
    lpDirectory (""),
    nShowCmd    (0);
   
//------------------------------------------------------------------------------

lpFile       = "SendSMTP";
lpParameters = "/SUBJECT mySubject /BODY " +DoubleQuote + message + DoubleQuote;
lpDirectory  = "C:\Program Files (x86)\SendMail";   
   
_fub_Alert = ShellExecuteA(
        HWND,
        lpOperation,
        lpFile,
        lpParameters,
        lpDirectory,
        nShowCmd);


This example shows how to implement a function named '_fub_Alert' which calls an external program named 'SendSMTP' with a few parameters.

Cheers, Felix
These users thanked the author fbertram for the post (total 2):
arjfcaiildm


Return to “MultiCharts”