Support Board
Date/Time: Sun, 30 Mar 2025 02:22:48 +0000
Run Program When This Alert Triggered: cmd.exe disrupts windows
View Count: 221
[2025-03-20 00:22:01] |
virtualcointrading - Posts: 45 |
Hello, whenever a program is run on an alert trigger, the cmd.exe prompt SC launches shifts the focus, i.e. if a full screen application is launched the command prompt will reduce it, if I'm typing something characters that I type when the alert was triggered will miss because cmd.exe was in focus, etc... Is there a way for "Run Program When This Alert Triggered" to quietly execute the specified program? Regards, |
[2025-03-20 01:52:53] |
user_xyz - Posts: 460 |
Interesting I briefly looked into solving this issue this past weekend and got side tracked. Often I'm typing on a screen overlay and when the alert gets triggered all my text / work disappears
|
[2025-03-20 06:54:59] |
Sierra_Chart Engineering - Posts: 18989 |
We see why this issue occurs. We will solve this. But this will still happen if you are running an operating system batch file. It cannot be avoided to open the command window when running a batch file.
Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2025-03-20 08:26:22] |
virtualcointrading - Posts: 45 |
In my case I'm running a Python script.
|
[2025-03-22 15:38:14] |
user_xyz - Posts: 460 |
SC could you make a note here when / what version you solve this so we can test out. Thanks
|
[2025-03-22 16:29:35] |
Sierra_Chart Engineering - Posts: 18989 |
Update to version 2748. The issue should be resolved as long as you are not running an operating system batch file.
Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2025-03-23 15:22:09] |
user_xyz - Posts: 460 |
I just ran through a few tests in replay mode. Prior I would see the cmd.exe flash and then my python script would launch. Alert is triggering as expected but external program doesn't appear to get called. "C:/.../python.exe" "C:/.../alerts.py" |
[2025-03-24 08:21:59] |
Sierra_Chart Engineering - Posts: 18989 |
Check the Message Log for errors: Message Log Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2025-03-24 10:00:32] |
user_xyz - Posts: 460 |
Sorry missed error code earlier in log. Error creating process "C:/.../python.exe" "C:/...alerts.py" Windows error code 87: The parameter is incorrect. Also in case it wasn't clear in SC in Run Program when this Alert Triggered field I have "C:/.../python.exe" "C:/...alerts.py" Would think other user similar since both of us running python scripts. Date Time Of Last Edit: 2025-03-24 12:54:44
|
[2025-03-25 17:20:38] |
Sierra_Chart Engineering - Posts: 18989 |
With the changes which support a direct call to CreateProcess, do not use any quote marks. And for now parameters are not supported. You can only specify the executable path and filename. Parameters will be supported in the next release of Sierra Chart. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2025-03-28 00:53:41
|
[2025-03-26 20:37:55] |
virtualcointrading - Posts: 45 |
I get the following errors with the different configs I made: 2025-03-26 21:36:27.373 | Error creating process python.exe "E:/ToDiscord.py". Windows error code 267: Nom de répertoire non valide.
2025-03-26 21:36:27.373 | Alert #14 is running: python.exe "E:/ToDiscord.py" 2025-03-26 21:30:32.339 | Error creating process python.exe E:\ToDiscord.py. Windows error code 2: Le fichier spécifié est introuvable.
2025-03-26 21:30:32.339 | Alert #14 is running: python.exe E:\ToDiscord.py 2025-03-26 21:33:17.935 | Error creating process python.exe E:/ToDiscord.py. Windows error code 2: Le fichier spécifié est introuvable.
2025-03-26 21:33:17.935 | Alert #14 is running: python.exe E:/ToDiscord.py Version 2748. |
[2025-03-27 15:19:00] |
User719512 - Posts: 306 |
Sierra Chart Engineering, To allow people to run something more than just a single program with no arguments, what are your thoughts/plans to add a new field/setting to allow for both: Run Program when this Alert Triggered Arguments for Run Program when this Alert Triggered These would map to CreateProcess API parameters: lpApplicationName lpCommandLine Right now, the solution I have is adding a level of indirection and writing my own single exe to spawn my own process with arguments which might be more advanced than many people might want or be technical enough to do especially if they don't have a c++ compiler installed. To speed my development/solution I asked Grok: Generate a c++ program that reads a well-known config file to call create process API with a program and args as 2 config values.
Result was simple program that is a single exe, reads from a .ini file for lpApplicationName and lpCommandLine in same directory, and launches my desired program with arguments. |
[2025-03-27 15:34:30] |
user_xyz - Posts: 460 |
SC BTW same > Error creating process C:/...python.exe C:/...alerts.py. Windows error code 2: The system cannot find the file specified. The quotes were used to call python which in turn called the script. You mentioned earlier batch files not supported. I'm assuming calling a batch file with the "python.exe > alerts.py" script call will work but then we are back to OS shifting focus. |
[2025-03-27 18:46:25] |
virtualcointrading - Posts: 45 |
Run Program When This Alert Triggered: cmd.exe disrupts windows | Post: 413072 How did you pass those arguments? /Number: The alert number.
/Type: The alert type. /Source:"" The alert source within the quote marks. /Message:"" The alert message within the quote marks. /DateTime:"" The Date-Time including milliseconds of the alert within the quote marks. |
[2025-03-27 23:39:01] |
User719512 - Posts: 306 |
Just add them to the command line you build for your own CreateProcess call. Grok, or ChatGPT, can help you a lot here. // Function to quote an argument if it contains spaces std::wstring quoteArg(const std::wstring& arg) { if (arg.find(L" ") != std::wstring::npos && arg[0] != L'"') { return L"\"" + arg + L"\""; // Add quotes if spaces exist and not already quoted } return arg; // Return as-is if no spaces or already quoted } int wmain(int argc, wchar_t* argv[]) { ... // Append Sierra Chart arguments (skip argv[0] and optional config path) int startArg = 1; for (int i = startArg; i < argc; ++i) { commandLine += L" "; commandLine += quoteArg(argv[i]); // Quote args with spaces } With this, you can call python.exe with a script and pass the args to said script as part of the command line. |
[2025-03-28 00:55:05] |
Sierra_Chart Engineering - Posts: 18989 |
The supporting of parameters will be in the next release of Sierra Chart. We did not mention that but we already implemented this. Anything after .exe and a space character will be considered part of the parameters and will be properly supported.
Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
To post a message in this thread, you need to log in with your Sierra Chart account: