and again dll and market - page 11

 

Have you learned how to upload a file via WebRequest?

The only thing left to learn is PlaySound (which might make sense in a separate advisor/service),

but"The file must be located in the terminal_directory\Sounds or its subdirectory. Only audio files in WAV format can be played." make a link in advance from one directory to another (from Files/Sound to Sound/Files, for example).

and voila - without exceeding MT capabilities and without external DLLs everything should work.

 
Nikolai Karetnikov:

And another thing, the WebRequest doc says that there are 2 variants of this function. The first one works with Content-Type: application/x-www-form-urlencoded, which is obviously not suitable, because IBM asks for "header "Content-Type: application/json"

But that's all I've understood so far

Why do you need this cheesy WebRequest?Socket functions have been available for some time, including with TLS.
 

that's how interesting it is

   string cookie=NULL,headers;
   char   post[],result[];
   string url="https://c.mql5.com/3/321/voice.bat.txt";
//--- для работы с сервером необходимо добавить URL "https://finance.yahoo.com"
//--- в список разрешенных URL (Главное меню->Сервис->Настройки, вкладка "Советники"):
//--- обнуляем код последней ошибки
   ResetLastError();
//--- загрузка html-страницы с Yahoo Finance
   int res=WebRequest("GET",url,cookie,NULL,500,post,0,result,headers);
   if(res==-1)
     {
      Print("Ошибка в WebRequest. Код ошибки  =",GetLastError());
      //--- возможно, URL отсутствует в списке, выводим сообщение о необходимости его добавления
      MessageBox("Необходимо добавить адрес '"+url+"' в список разрешенных URL во вкладке 'Советники'","Ошибка",MB_ICONINFORMATION);
     }
   else
     {
      if(res==200)
        {
         //--- успешная загрузка
         PrintFormat("Файл успешно загружен, размер %d байт.",ArraySize(result));
         //PrintFormat("Заголовки сервера: %s",headers);
         //--- сохраняем данные в файл
         int filehandle=FileOpen("voice.bat",FILE_WRITE|FILE_BIN);
         if(filehandle!=INVALID_HANDLE)

Photo by

Photo by

bat will give an error - if in bin and then somehow from bin

Snapshot2

 
Serhii Shevchuk:
Why do you need this cheesy WebRequest? Socket functions have been available for a long time now, including with TLS.

I see you are an experienced person, can you help me write a socket reference example?

The documentation is herehttps://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-usingWebSocket

I understandinstance_id is GR1bb3zVMs9fcNKL6pA9-5zj9ptWliCu6eh9oupUnpZB

While smoking the doc...

 
Реter Konow:
The task is very complicated, almost impossible because the target boundaries are undefined. What exactly should the EA announce? If only the price, then we can integrate a set of vocalized numbers that can be combined. If you need the option of recording a custom reminder, which the Expert Advisor will turn on at the right time, then it is not really impossible, but VERY difficult. I almost don't see the point of spending so much energy on a dubious chip.

Be very clear about what you want to do.

the task is not very complicated. Basically, everything is already done and the Expert Advisor works fine with the DLL call, pronouncing in English or Russian the names of instruments and their current prices and, if necessary, hitting the price in the region.

The built-in capabilities of the Windows operating system are used


With a simple https://www.mql5.com/ru/forum/342293#comment_16626455 class it is possible to pronounce arbitrary text, even run-time errors or printf output, if someone needs it ))))

And the implementation using multiple wav files is very complicated, you're quite right

и снова dll и маркет
и снова dll и маркет
  • 2020.05.30
  • www.mql5.com
День добрый! Правило №1 dll на Маркете запрещен...
 
nkaretnikov:

the task is not very difficult. Basically, everything is already done and the Expert Advisor works fine with the DLL call, pronouncing in English or Russian both the names of instruments and their current prices, and, if necessary, hitting the price in the region.

The built-in capabilities of the Windows operating system are used


With a simple https://www.mql5.com/ru/forum/342293#comment_16626455 class it is possible to pronounce arbitrary text, even run-time errors or printf output, if someone needs it ))))

And the implementation using multiple wav files is very complicated, you're quite right

You don't have a formulated task and hence it is not clear what needs to be done. To make the councillor say whatever he/she wants? But, what exactly is he supposed to say? How do you tell it to read the name of the symbol? :) You won't be able to communicate with the advisor even if he formally "speaks" the text. You can't make him read a text that is relevant to an event. How do you instruct him to read the prints or logs?)
 
OK, suppose the EA writes the text to be spoken to a file and sends it via web-quest or sockets to the server, and the server, in obedience, speaks it. Theoretically possible, but not an easy task...

Take time delays into account.
 
Реter Konow:
You don't have a formulated problem and hence it's not clear what needs to be solved. Make the Expert Advisor say whatever you want it to say? But what exactly should it say? How do you tell it to read the name of the symbol? :) You won't be able to communicate with the advisor, even if he formally "speaks" the text. You can't make him read the text that is relevant to an event. How do you instruct him to read the prints or logs?)

I need to solve the problem of transforming arbitrary text into a wav file without using DLL calls )

Everything else is already solved

 
Реter Konow:
Suppose our EA writes a text to be spoken to a file and sends it to the server through WebRequest or sockets, and the server talks to it. Theoretically possible, but not an easy task...

there is no need to write to the file. WebRequest method formats

и снова dll и маркет
и снова dll и маркет
  • 2020.05.31
  • www.mql5.com
День добрый! Правило №1 dll на Маркете запрещен...
 
nkaretnikov:

I need to solve the problem of transforming arbitrary text into a wav file without using DLL calls )

Everything else is already solved

I don't know... this is the unsolvable problem... You need a special web service that takes a text file from you, converts it to wav, sends it back to your Sounds folder and rewrites the old file. Or simply, receive it and speak it out without converting it to .wav