I want to get a file once and only once at the start of a coding session. Then, whenever I save the file in the Wolfram Workbench, have it be gotten automatically. How can I construct such a utility?
|
When you create an Application project in Wolfram Workbench named for example Test, a Test\Test.m file is created that is loaded everytime you save a file in the project, ie. a Get is applied to this file. By default the Execution Build Command in the project's properties will be something like this
This command will look in the file Test\Kernel\init.m which contains something like
So the file to look at is located in the file Test\Test.m A typical package located at Test\Folder1\package1.m looks like this (notice the BeginPackage instruction).
What I do in order to have its definitions automatically reloaded in the Kernel when I save it is the following. I have a list contexts before the package definition of Test.m and I manually Get all the contexts in this list so that they also are gotten when I save a file in the project while Mathematica is running and linked to Eclipse. The Test\Test.m package looks like this
This way of doing has the advantage that you only need to do
in order to load several related packages of a same application exported in \$BaseDirectory\Applications (or $UserBaseDirectory\Applications). For modifying $BaseDirectory for example you have to define an environment variable. See here Mathematica Sessions. Something practical is also to define the current Directory to a directory of the project using for example for the directory Test\Folder1 before << Test` in the Execution Build Command
This way you can save outputs by default to a folder you chose. |
||||
|
|
|
One way would be to both So just for readability I define a function to get the date, and a function which will update an expression when the file date changes.
So then you'd get the file writing:
It would be preferable to put this into the dynamicexpression of the notebook, however since IO doesn't tricker dynamic updating we need the update interval for the checking, This is done by calling:
|
||||
|
|

Getin the notebook), right? This is controlled by the "Notebook Properties" and "Source Properties" settings, which you can access from the context menu entry "Properties" (at least it works this way with eclipse+workbench plugin) – sebhofer Jun 26 '12 at 8:07