Skip to content

07 Execute code

Gilles Querret edited this page Sep 11, 2024 · 3 revisions
  1. Code can be executed using the F2 keyboard shortcut. This runs the current procedure with _progres -b, using the Propath and set of database connections configured for the project. However, this might not be very useful in the context of a real application, especially when different database connections or specific startup parameters are required.

    Visual Studio Code allows you to configure external tasks and store them as JSON files. These configurations can be stored in the code repository and shared with all developers. For more details, refer to the full documentation.

    ℹ️ Ctrl + 1 in VSCode puts the focus back to the editor (if the focus was on the output view for example).

  2. Create a file named .vscode/tasks.json in the current project directory. This file will store the task configurations for running your code:

     {
       "version": "2.0.0",
       "tasks": [
         {
           "label": "My TTY Application",
           "type": "process",
           "command": "/path/to/nowhere",
           "args": [
             "-basekey",
             "INI",
             "-ininame",
             "conf/empty.ini",
             "-db",
             "sports2000",
             "-H",
             "localhost",
             "-S",
             "12345",
             "-cpinternal",
             "iso8859-15",
             "-p",
             "test2.p"
           ],
           "windows": {
             "command": "C:\\Progress\\OpenEdge-12.8\\bin\\_progres.exe"
           },
           "presentation": {
             "reveal": "silent",
             "panel": "new",
             "focus": true
           },
           "options": {
             "env": {
               "DLC": "C:\\Progress\\OpenEdge-12.8",
               "PROPATH": "target/build,C:\\Progress\\OpenEdge-12.8\\tty\\netlib\\openedge.net.pl,C:\\Progress\\OpenEdge-12.8\\tty\\openedge.core.pl"
             }
           },
           "problemMatcher": []
         }
       ]
     }
  3. Open a Proenv terminal in Visual Studio Code, navigate to the C:\Workshop\db directory, and run startDb.bat. This will start a database broker on port 12345.

  4. You can execute tasks from the Terminal menu by selecting "Run Task". Choose the task you want to execute (there should be only one at this stage). A new terminal will open with your _progres application running.

    If you remove the QUIT statement from test2.p and execute the same task again, you will enter the Procedure Editor, similar to starting it from the command line.

  5. We will now add a GUI application startup task. Add the following section to the existing .vscode/tasks.json file:

         {
             "label": "My GUI Application",
             "type": "process",
             "command": "/path/to/nowhere",
             "args": [
                 "-basekey",
                 "INI",
                 "-ininame",
                 "conf/gui.ini",
                 "-db",
                 "sports2000",
                 "-H",
                 "localhost",
                 "-S",
                 "12345",
                 "-cpinternal",
                 "iso8859-15",
                 "-p",
                 "test2.p",
                 "-nosplash"
             ],
             "windows": {
                 "command": "C:\\Progress\\OpenEdge-12.8\\bin\\prowin.exe"
             },
             "presentation": {
                 "reveal": "silent",
                 "panel": "new",
                 "focus": true
             },
             "options": {
                 "env": {
                     "DLC": "C:\\Progress\\OpenEdge-12.8"
                 }
             },
             "problemMatcher": []
         }
  6. Then execute the GUI application using the same shortcut as for the TTY application.


Next chapter

Clone this wiki locally