How to execute a txt file?

 

Hello, in my EA I create a txt file in "File" directory. Now I want to execute this file for showing it in Notepad... can someone tell me how to do it?

I searched a lot but didn't find anything about this.

Thanks a lot

Massy

 
TXT means, as you know, a text file, and you can open it from any program that can read them.  You cannot "execute" a text file, so because of this, I am not sure if you mean what you are posting, or if you mean to actually execute an .ex4 file, or do you want to read the text file?  If you want to read the text file, open notepad, and go to your open file button, and go through your file folders and find it and open it.  If you mean you want to execute your EA, you do that from within your trading platform.
 
JD4:
TXT means, as you know, a text file, and you can open it from any program that can read them.  You cannot "execute" a text file, so because of this, I am not sure if you mean what you are posting, or if you mean to actually execute an .ex4 file, or do you want to read the text file?  If you want to read the text file, open notepad, and go to your open file button, and go through your file folders and find it and open it.  If you mean you want to execute your EA, you do that from within your trading platform.

I''m obviously wanting to open the file from the EA and show it to the user. If I wanted to know how to open a text file as a normal windows user maybe I would ask that in a Windows related forum and not here.... If I posted my question here it is obvious (for me) that I'm trying to achieve to do the action with some code and using my EA...

Thanks anyway

 

I was basing the response on your thread topic, nothing else.  Not everyone that uses this forum uses English as their primary language, so we cannot tell other than what is posted here.  No need for attitude.

If you want to show someone the code from an EA file ex4 or ex5, you can't.  You can only show them the MQ4 or MQ5 (pre-compiled) file, as that is what has the code.  Do not ask how to show code from a compiled EA because that is considered code theft, and I will not help you do that.




 

Hi!


You have to call ShellExecuteW from the the Windows shell32 API.

 
JD4:

I was basing the response on your thread topic, nothing else.  Not everyone that uses this forum uses English as their primary language, so we cannot tell other than what is posted here.  No need for attitude.

If you want to show someone the code from an EA file ex4 or ex5, you can't.  You can only show them the MQ4 or MQ5 (pre-compiled) file, as that is what has the code.  Do not ask how to show code from a compiled EA because that is considered code theft, and I will not help you do that.




JD4 maybe I was not very clear in my question... I am a programmer and I'm talking just about MY CODE and this is not considered theft in my country... and by the way I'm italian... and english is not my primary language. Now I KINDLY ask you to leave this topic as it is obviouse you don't have any idea of what I'm talking about... Thanks any way for your interest.

Peace

Massy

 
eddie:

Hi!


You have to call ShellExecuteW from the the Windows shell32 API.



Hi Eddie! Do you have some lines of code to show me? It would be very much appreciated...
 
Bluebeardit:

JD4 maybe I was not very clear in my question... I am a programmer and I'm talking just about MY CODE and this is not considered theft in my country... and by the way I'm italian... and english is not my primary language. Now I KINDLY ask you to leave this topic as it is obviouse you don't have any idea of what I'm talking about... Thanks any way for your interest.

Peace

Massy

Now that you further explained what you were trying to do, despite the attitude, I will suggest something.  You can keep the attitude and ignore it or not, totally up to you.

This will work if you are using Windows, I do not know how Macs work.

How you can get to it from within the metaeditor is in your navigator pane, open to the file name you want to use, and right click the file name.  It will give you a choice to open the folder.  Select that and your system should open the folder that the code file is in.

You can then either open the MQ4 or MQ5 file in another program other than the metaeditor, notepad or wordpad or another text editor program, or just open the code in the metaeditor, select the code part you want to show to someone else (copy and paste) and copy the section into a text editor program.

 

Hi!

Hope this helps:


#import "shell32.dll"
int ShellExecuteW (int hwnd, string lpOperation, string lpFile, string lpParameters,
                   string lpDirectory, int nShowCmd);
#import

ShellExecuteW (NULL, "edit", TerminalInfoString (TERMINAL_DATA_PATH) + "\\MQL4\\Files\\file.txt", NULL, NULL, 1);

 
eddie:

Hi!

Hope this helps:


#import "shell32.dll"
int ShellExecuteW (int hwnd, string lpOperation, string lpFile, string lpParameters,
                   string lpDirectory, int nShowCmd);
#import

ShellExecuteW (NULL, "edit", TerminalInfoString (TERMINAL_DATA_PATH) + "\\MQL4\\Files\\file.txt", NULL, NULL, 1);


Hi Eddie, sorry for the delay but I've been busy all these days... Thanks for your code... I've tryed it but I get this errors:

2015.07.25 09:19:19.163    unresolved import function call

2015.07.25 09:19:19.163    Cannot call 'shell32.dll::ShellExecuteW', DLL is not allowed

Any clue why I get this?

 
Bluebeardit: Any clue why I get this?
DLL is not allowed.
Enable DLL calls (expert and options)
Reason: