Questions and discussion about using ProcessMaker 2: user interface, running cases and functionality
Forum rules: Please search to see if a question has already been asked before posting. Please don't ask the same question in multiple forums.
#15184
Firstly, I would like to mention the point that the ProcessMaker has been installed on Linux machine and I am accessing this processmaker account on a Windows machine currently.

I have created a workflow and the aim is to call the basic calculator of Linux to do some calculation in a dynaform.

I have used the following code in the trigger(accessing the account on windows machine):
exec("/usr/bin/bc [-1]");

But on execution of the trigger, nothing seems to happen. Can someone please tell me is it a problem with the syntax or conflict of OS or the method is itself wrong?
And if so, please give a detailed(since I am just a beginner) procedure of how to call an external program using a trigger.

Please reply as soon as possible. My work is really urgent.
#15217
I suspect that your problem is the [-1] part because you are using a referencer to a file, but that referencer doesn't exist in this context. You need to use a real filename, not a reference. Also, you need to have a second parameter to capture what is returned by the function.

exec("/usr/bin/bc path/somefile", @@ret);
#15233
Thanks amosbatto for your prompt help. I would be grateful to you if you can explain in detail the method you have specified by giving an example.

Like if I have three case variables @@part_cost, @@labor_cost and @@miscellaneous_cost and I want to call the linux basic calculator to calculate the sum of values of these variables and return that into @@total_cost (all of these variables being defined in the dynaform), what commands will I have to write in trigger and file(that you specified).

I have tried a lot of times but somehow I am not able to get the required result. Please reply.

Thanks in advance!
Last edited by akashjain on Thu Sep 22, 2011 5:34 pm, edited 1 time in total.
#15254
I suggest that you use this trigger code instead:
Code: Select all
@#total_cost = @#part_cost + @#labor_cost + @#miscellaneous_cost;
I have no idea how bc works. All I know is that if I enter "bc [-1]" in the normal command line, Linux says:
$ bc [-1]
File [-1] is unavailable.
So bc is expecting a file. Obviously you are using the command wrong.
#21265
divyladha wrote:Can a .exe file stored on the server be called using a PM trigger ? and also the .exe file is coded in VBA.
If the file is stored on the processMaker server, you can use exec() or passthru() in a Trigger to execute your .exe program. The tricky part is if you need to get output from the program. If the output is text and one line:
Code: Select all
$output = exec("C:\MyDirectory\MyProgram.exe");
If more than one line:
Code: Select all
$output = "";
exec("C:\MyDirectory\MyProgram.exe", $output);
$line1 = $output[1];
$line2 = $output[2];
Best to debug it this way:
Code: Select all
$output = "";
exec("C:\MyDirectory\MyProgram.exe", $output);
var_dump($output);
die;
Also not the bug about Windows paths if using PP before version 5.3.0:
alvaro at demogracia dot com 27-Dec-2010 05:27
In Windows, exec() issues an internal call to "cmd /c your_command". This implies that your command must follow the rules imposed by cmd.exe which includes an extra set of quotes around the full command:

- http://ss64.com/nt/cmd.html

Current PHP versions take this into account and add the quotes automatically, but old versions didn't.

Apparently, the change was made in PHP/5.3.0 yet not backported to 5.2.x because it's a backwards incompatible change. To sum up:

- In PHP/5.2 and older you have to surround the full command plus arguments in double quotes
- In PHP/5.3 and greater you don't have to (if you do, your script will break)

If you are interested in the internals, this is the source code:

sprintf(cmd, "%s /c \"%s\"", TWG(comspec), command);

It can be found at http://svn.php.net/viewvc/ (please find php/php-src/trunk/TSRM/tsrm_win32.c, the comment system doesn't allow the direct link).
User avatar
By SwondeR
#781157
I'd like to be able to trigger my predefined lighting and media scenarios with external scripts

I've read a bit about /usr/pluto/bin/MessageSend

but I'm not sure if that is what I am looking for or if that can only be used to update status rather than make the events happen

can anyone offer me any advice on how this is best accomplished?
#784288
You would need to either execute the command as sudo or login via su root and execute the command.

You would need to typically put in the root password, so it would probably be easier to write a shell script that does this and simply call it in the manner that you are doing it.
#788225
The suspect that your problem is the [-1] part because you are using a referencer to a file, but that referencer doesn't exist in this context. You need to use a real filename, not a reference. Also, you need to have a second parameter to capture what is returned by the function.

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]