Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
I am having a problem with starting a script via CODESYS. My goal is to create a screenshot via a button click or via an input. For doing this I am using the
"Sys Process Execute Command" command (no spaces of course, but it screws up the layout somehow). I altered the CODESYSControl.cfg to
[SysProcess]Command=AllowAll
and I created a script named takeScreenshot which looks like:
\#!/bin/shDISPLAY=:0scrot-d1'screenshot.png'
I made it executable with
sudochmod+x/usr/bin/takeScreenshot
Finally I tested the script with typing ```
takeScreenshot
``` in the terminal and it works like a charm.
So I started to implement the command in Codesys like this:
Now the problem: It does not work
As a result I get "0" and no screenshot. But if I am trying another command like "reboot" or "ifdown" it works without any problems. I dont have a clue. Can someone help?
Thanks and Greetings
Andy
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
thank you for your reply.
Unfortunatly the command is not executed by the Raspberry Pi (unlike a reboot command or similar). So no log is being created. Although it works when I am typing the exact same command in the Raspi terminal.
Greetings
Andreas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello together,
I am having a problem with starting a script via CODESYS. My goal is to create a screenshot via a button click or via an input. For doing this I am using the
"Sys Process Execute Command" command (no spaces of course, but it screws up the layout somehow). I altered the CODESYSControl.cfg to
and I created a script named takeScreenshot which looks like:
I made it executable with
Finally I tested the script with typing ```
takeScreenshot
``` in the terminal and it works like a charm.
So I started to implement the command in Codesys like this:
Now the problem: It does not work
As a result I get "0" and no screenshot. But if I am trying another command like "reboot" or "ifdown" it works without any problems. I dont have a clue. Can someone help?
Thanks and Greetings
Andy
You could pipe the console output to a file and see what turns up. Perhaps something like this
Hi Rick,
thank you for your reply.
Unfortunatly the command is not executed by the Raspberry Pi (unlike a reboot command or similar). So no log is being created. Although it works when I am typing the exact same command in the Raspi terminal.
Greetings
Andreas
In the Codesys Log (cat /tmp/codesyscontrol.log) I get the following message
I tried to use "" as sCommand as well with the same result.