Login Page - Create Account

Support Board


Date/Time: Sat, 19 Apr 2025 09:45:12 +0000



[Programming Help] - [ACSIL] How select Path only like Set(get)PathAndFileName?

View Count: 373

[2024-08-28 17:39:03]
TedMar - Posts: 191
I would like selct in imput only Path without filie select?
[2024-12-06 20:59:09]
Sierra_Chart Engineering - Posts: 19276
This is not supported but can be added.
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
[2024-12-07 10:11:11]
User351137 - Posts: 14
Its a good feature ,please add them quickly.. thank +1
[2025-03-15 07:47:42]
User351137 - Posts: 14
Do you have any idea how long it will take until implementation "Set(get)Path" ?
[2025-03-16 12:55:31]
cmet - Posts: 689
In what context do you want to use this? What are you trying to do?
[2025-03-16 14:14:35]
User351137 - Posts: 14
To set/get in studie phat of i.e Logs, images, csv or scripts to load levels. I made studie needed a phat to save temp images.
[2025-03-16 18:31:27]
cmet - Posts: 689
Not sure if that's a translation, but if it is, try posting a detailed description in your native language.
[2025-03-16 20:45:33]
User351137 - Posts: 14
Example :
I currently use the following in the input field:
Input_SaveDirectory.SetPathAndFileName(GetUserPicturesFolder().c_str());

The issue is that the user must select a folder that contains at least one file for the "Open" button in the dialog to become active. After selecting a file, the user can manually delete the filename so that only the path remains in the input field.

However, this is an unnecessary extra step. The Browse dialog itself is perfect, and it would be great if we could select just the folder without needing to choose a file.

Would it be possible to add a function like SetPath and GetPath that allows selecting only the directory? This would simplify workflows when working with log files, images, CSV files, and scripts.

I need the ability to set and get only the path (without selecting a file) in a study because I work with different types of files in Sierra Chart.

For example:

Logs: I want to specify a directory where my study writes log files for debugging or data tracking.
Images: My study generates temporary images that need to be stored in a specific folder.
CSV files: I load external data such as support/resistance levels or market statistics from CSV files, and I need to define the folder where these files are stored.
Scripts: I execute external scripts for additional calculations, and these scripts are stored in a specific directory.
[2025-03-17 01:52:27]
cmet - Posts: 689
Got it. Not sure if this is what you're looking for, but this lets you explicitly set your path, and then stores it in sc.input. Set it up so you can verify the paths in message log.

#include "sierrachart.h"

SCDLLName("SetPathOnly")

void SetPathOnly(SCInputRef Input, const char* DefaultPath)
{
Input.SetString(DefaultPath);
}

SCSFExport scsf_SetPathOnly(SCStudyInterfaceRef sc)
{
if (sc.SetDefaults)
{
sc.GraphName = "Set Path Only";

//inputs
sc.Input[0].Name = "Log Files Directory";
SetPathOnly(sc.Input[0], "C:\\Logs\\");

sc.Input[1].Name = "Images Directory";
SetPathOnly(sc.Input[1], "C:\\Images\\");

sc.Input[2].Name = "CSV Data Directory";
SetPathOnly(sc.Input[2], "C:\\CSV\\");

sc.Input[3].Name = "Scripts Directory";
SetPathOnly(sc.Input[3], "C:\\Scripts\\");

return;
}

//update on changes only
if (!sc.IsFullRecalculation)
return;

SCString LogsDirectory = sc.Input[0].GetString();
SCString ImagesDirectory = sc.Input[1].GetString();
SCString CSVDirectory = sc.Input[2].GetString();
SCString ScriptsDirectory = sc.Input[3].GetString();

//messages
SCString logMessage;
logMessage.Format("Logs Directory: %s", LogsDirectory.GetChars());
sc.AddMessageToLog(logMessage, 0);

logMessage.Format("Images Directory: %s", ImagesDirectory.GetChars());
sc.AddMessageToLog(logMessage, 0);

logMessage.Format("CSV Directory: %s", CSVDirectory.GetChars());
sc.AddMessageToLog(logMessage, 0);

logMessage.Format("Scripts Directory: %s", ScriptsDirectory.GetChars());
sc.AddMessageToLog(logMessage, 0);
}

Date Time Of Last Edit: 2025-03-17 03:28:39
[2025-03-17 07:05:04]
User351137 - Posts: 14
Thanks for your response! However, this solution sets the path statically in the code, which is not what I need.
I need the user to be able to select a folder dynamically using a dialog, similar to SetPathAndFileName(), but without requiring a file selection.

Currently, with SetPathAndFileName(), the user must select a file in the folder for the "Open" button to become active. This is inconvenient because the user often just wants to select a directory.

Would it be possible to have a function that opens the folder selection dialog, allowing the user to select a directory without choosing a file?
[2025-03-17 12:57:15]
cmet - Posts: 689
My guess is, you would need to include this step but remove the file name programmatically:

the user must select a folder that contains at least one file for the "Open" button in the dialog to become active. After selecting a file, the user can manually delete the filename so that only the path remains in the input field.

Or go through Windows to access folder structure.
[2025-03-17 16:35:01]
User351137 - Posts: 14
Thanks for your response!

Yes, the first option (removing the filename programmatically) is the workaround I currently use. But it still forces the user to select a file first, which is not ideal.

A proper solution would be a function that directly opens a folder selection dialog instead of a file selection dialog.

Is there any way to implement this directly within Sierra Chart, or would I need to handle this via a Windows API call (e.g., SHBrowseForFolder or IFileDialog)?

mybe easly way is add from SC new funktion to ACSIL like SetPath() ?
[2025-03-17 18:23:30]
cmet - Posts: 689
If there's away to do that in ACSIL, I don't know what it is.

As they mentioned above, it's not supported (and likely has to be added internally).
[2025-03-17 20:19:06]
John - SC Support - Posts: 39362
I feel like I am missing something in the conversation, but why aren't you using the "SetString()" Input:
ACSIL Interface Members - sc.Input Array: sc.Input[].SetString()
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2025-03-17 22:54:17]
User351137 - Posts: 14

I feel like I am missing something in the conversation, but why aren't you using the "SetString()" Input:
ACSIL Interface Members - sc.Input Array: sc.Input[].SetString()

Thanks for your response John...

Yes, sc.Input[].SetString() allows the user to manually enter a path as a text string. However, this is not user-friendly, because:

No Browse Option: The user has to type the entire path manually instead of selecting it via a dialog.
High Risk of Errors: Manually entered paths are prone to typos or incorrect formatting (e.g., missing backslashes, wrong drive letters, etc.).
Inconsistent User Experience: Other inputs (like file selection) provide a dialog, but here, the user would have to open Windows Explorer separately to find and copy the correct path.
What I need is a folder selection dialog, just like SetPathAndFileName(), but without forcing the user to select a file.

Would it be possible to add this as a new function in ACSIL?

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account