L-I-V / MQL-Tools

51 stars 20 forks source link

Copy mq4/ex4/mq5/ex5 files on compile to MQL4/MQL5 folder #18

Open leacostae opened 1 year ago

leacostae commented 1 year ago

Thank you very much for the extension, the truth is greatly appreciated, it is possible in future updates to copy mq4/ex4/mq5/ex5 files on compile to MQL4/MQL5 folder in MT4/MT5 path when the project is out of the MT4/MT5 terminal folder

L-I-V commented 1 year ago

Do the files have to be copied at each compilation? If the project will be located in a standard directory, for example: C:\Users\AppData\Roaming\MetaQuotes\Terminal\D2E7219F73C8BF37CD8BF550E55FF075\MQL5, do the files also have to be copied? And why can’t the project be manually copied to the MQL4/MQL5 folder at the MT4/MT5 path and then worked on without copying?

leacostae commented 1 year ago
L-I-V commented 1 year ago

Ok, I'll think about how to implement it in the future.

peschu123 commented 1 year ago

Just in case someone finds this here, I use the following code in my workspace .vscode/tasks.json

{
  // See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
  "tasks": [
    {
      "label": "mql compile",
      "type": "shell",
      "command": "${command:mql_tools.compileFile}",
      "presentation" : {
      "clear": true
      }
    },
    {
      "label": "mql copy expert",
      "type": "shell",
      "command": "cp",
      "args": [
        "${workspaceFolder}/*.ex5", // fileBasenameNoExtension does not give the correct file name when on OUTPUT tab
        "'${config:mql_tools.Metaeditor.Metaeditor5Dir}\\..\\MQL5\\Experts\\'" // target MQL5 folder configured in extension config, can also be an absolute path
      ],
      "presentation" : {
       "clear": true,
       "reveal": "silent",
       "showReuseMessage": true
        }
    },
      {
      "label": "mql build",
      "dependsOrder": "sequence",
      "dependsOn": ["mql compile", "mql copy expert"],
      "group": {
        "kind": "build",
        "isDefault": false
      }
    },
  ]
}

Don't forget to adjust the paths to your environment. This can then be executed with ctrl+shift+B (default build task).

It is a very simple script. It just copies all .ex5, even when the compilation fails. It is sufficient for my use case.

I also tried some triggers, but it did not work properly or they need nodjs etc.. I guess a trigger to check if "${fileDirname}/${fileBasenameNoExtension}.ex5" changed would be nice.

icebob commented 9 months ago

Hi, +1 I would like the same feature. @leacostae Do you plan to implement it, or do you accept PR?