News About Us Support Bugs & Tasks Links
dklfgj dfgjmpsdklg dfgjdsklfg dfjglksdfjg sdfgjokdfjg dfgjoksdfjg sdfgjksdlfgjsdf gdgjopksdfgj

Using Notepad++ to compile and run APSIM

RSS
This page demonstates how to use the freely available Notepad++ to compile APSIM source code and run APSIM simulations.

Installing Notepad++

  • Install Notepad++ from the Notepad++ web site.
  • Ensure the NppExec plugin is installed by going to the Plugins | Plugin Mangaer | Show Plugin Manger menu and selecting NppExec:
    Image


Setting up Notepad++ to run APSIM simulations

  • To configure Notepad++ to execute external programs go to the Plugins | NppExec | Execute (F6) menu and type the command: cmd /c C:\Apsim\Model\ApsimRun.exe "$(FULL_CURRENT_PATH)", replacing c:\Apsim with your APSIM development path if you have it located in a different directory. Click Save and give it the name Run APSIM.
    Image


  • To assign this RunAPSIM command to a menu, go to PlugIns | NppExec | Advanced options. Enter a menu item name Run. Select the associated script Run APSIM. Click Add. This will add a new menu to the Macro menu in Notepad ++.
    Image


  • To assign this menu item to a key press (so that you can simply press F5 to run APSIM, go to Settings | Shortcut mapper, find the Run menu item under the Plugin commands tab and click Modify to give it the key press of your choice. F5 is a fairly standard run key press.
    Image


  • Also because F5 is already mapped to the generic Run feature of Notepad++ you will have to disable this other F5 shortcut. To do this, under the Main menu tab in Settings | Shortcut mapper find Run (usually number 184) and change the shortcut to "None". So now we only have one F5 shortcut which is our Apsim Run shortcut. You can still access the generic Run feature of Notepadd++ from the main menu in Notepad++. You just don't have the F5 shortcut to it anymore.

Now whenever you have a simulation file loaded in Notepad++ (e.g. .apsim file), you can press F5 to run it.


Setting up Notepad++ to compile APSIM source code

  • To compile APSIM source code follow the steps above setting up an Execute command of:
    C:\Apsim\Model\Build\RunMake.bat $(CURRENT_DIRECTORY) with a name of Compile APSIM
    and a menu command Compile. I use a shortcut key of CTRL SHIFT B which is the same as Microsoft Visual Studio.

  • To get Notepad++ to highlight error messages from the compile, go to PlugIns | NppExec | Console Output Filters and enter these 2 filter lines:
    *"%FILE%", line %LINE%:*
    
    %FILE%(%LINE%) : *

    Image


Now you can compile the file that you have open in Notepad++ by pressing CTRL SHIFT B. Any error message will be displayed in the window at the bottom. Double clicking an error message will take the editor to that line.
  Name Size
- AdvancedOptions.png 40.68 KB
- ConsoleFilters.png 182.36 KB
- Execute.png 19.29 KB
- Execute2.png 19.27 KB
- PluginManager.png 25.39 KB
- ShortcutMapper.png 49.46 KB
SiteSearch, Login/Logout, Account Settings, Create a new Page