Support Board
Date/Time: Tue, 24 Dec 2024 14:02:45 +0000
retrieving string file name from settings to be played in playfile
View Count: 1050
[2015-10-19 12:10:49] |
KhaosTrader - Posts: 128 |
Hi, I am having problems, figuring out how to make the filename a setting for the alert. sc.PlaySound(SoundFileName.GetString(), 1);
is having problems, what must I do to make this work? Thank you for your help on this. |
[2015-10-19 17:39:03] |
Sierra Chart Engineering - Posts: 104368 |
You need to use the SCString data type.
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, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2015-10-21 05:58:55] |
KhaosTrader - Posts: 128 |
Hi, I tried this but with no luck.... sc.PlaySound("c:\\!TradeAlert_Sounds\\%s_Long.wav", EntryAlert_RootFileName.GetString(), 1);
|
[2015-10-21 18:18:28] |
Sierra Chart Engineering - Posts: 104368 |
You are not using the SCString type. Also, the function is called GetChars(). It is documented here: https://www.sierrachart.com/index.php?page=doc/doc_ACSILProgrammingConcepts.html#WorkingWithStrings 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, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2015-10-23 03:41:52] |
KhaosTrader - Posts: 128 |
I cant access a getchars from the SCInputRef... where I define the root file name... All I can do is the getstring. So my Buffer.Format line throws an error.. Here is code... SCInputRef EntryAlert_RootFileName = sc.Input[18]; ... ... ... EntryAlert_RootFileName.Name = "Root File Name for Entry Alert"; EntryAlert_RootFileName.SetString("QCL"); .. .. .. SCString Buffer; Buffer.Format("c:\\!TradeAlert_Sounds\\%s_Long.wav", EntryAlert_RootFileName.GetString); sc.PlaySound("c:\\!TradeAlert_Sounds\\%s_Long.wav", Buffer.GetChars(), 1); |
[2015-10-23 11:46:08] |
KhaosTrader - Posts: 128 |
Actually, I found out a way to do it, is this an appropriate way? if ( (sc.DownloadingHistoricalData == 0) && (sc.Index > sc.ArraySize - 5) ) { char * RootFileName = new char[std::strlen(EntryAlert_RootFileName.GetString())]; std::strcpy(RootFileName, EntryAlert_RootFileName.GetString()); SCString Buffer; Buffer.Format("c:\\!TradeAlert_Sounds\\%s_Long.wav", RootFileName); sc.PlaySound(Buffer.GetChars(), 1); } |
[2015-10-23 18:09:19] |
Sierra Chart Engineering - Posts: 104368 |
For a study input you do need to use the GetString function. sc.PlaySound("c:\\!TradeAlert_Sounds\\%s_Long.wav", Buffer.GetChars(), 1);
The above line of code does not make sense. Specifically the use of "%s".
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, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2015-10-23 18:13:02] |
Sierra Chart Engineering - Posts: 104368 |
char * RootFileName = new char[std::strlen(EntryAlert_RootFileName.GetString())]; In general we strongly recommend doing something like this unless you really know what you are doing. 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, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2015-10-24 06:34:20] |
KhaosTrader - Posts: 128 |
Ok, I tried an alternate method, is this a correct way to achieve this? SCString Buffer; Buffer = "c:\\!TradeAlert_Sounds\\"; Buffer += EntryAlert_RootFileName.GetString(); Buffer += "_Short.wav"; sc.PlaySound(Buffer.GetChars(), 1); Date Time Of Last Edit: 2015-10-24 06:48:57
|
[2015-10-26 09:19:16] |
Sierra Chart Engineering - Posts: 104368 |
Yes, this will work and is safe.
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, *change* to 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: