Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Create a FrontEnd object that updates when a file changes
"FileCheckFunction" | "LastModificationDate" | file property used to check if contents have changed |
"ImportFunction" | Import | function applied to file to import the contents |
"ContentDisplayFunction" | Automatic | function applied to expr to summarize the file contents |
"LayoutFunction" | Automatic | function that creates the final display |
"PurgeContentsQ" | False | if True,expr will be set to Missing["FileMissing"] if file is deleted |
UpdateInterval | 2 | how many seconds between running the file check |
"Placeholder" | ProgressIndicator[Appearance→"Necklace"] | object to show while importing file contents |
Create a test file:
In[1]:= | ![]() |
Out[1]= | ![]() |
Create an overview of the file status:
In[2]:= | ![]() |
Out[2]= | ![]() |
Check the imported contents:
In[3]:= | ![]() |
Out[3]= | ![]() |
Modify the file:
In[4]:= | ![]() |
Out[4]= | ![]() |
The imported contents have changed:
In[5]:= | ![]() |
Out[5]= | ![]() |
If the file does not exist, a placeholder will be shown:
In[6]:= | ![]() |
Out[6]= | ![]() |
Import the test file as a Wolfram Language expression instead of a string:
In[8]:= | ![]() |
Out[8]= | ![]() |
The expression is a Wolfram Language List now:
In[9]:= | ![]() |
Out[9]= | ![]() |
Display the first five elements of the imported list:
In[10]:= | ![]() |
Out[10]= | ![]() |
This affects the display, but not the underlying expression:
In[11]:= | ![]() |
Out[11]= | ![]() |
Specify a custom function to typeset the file name, content preview and modification date of the file:
In[12]:= | ![]() |
Out[12]= | ![]() |
With "PurgeContentsQ"→False, expr will remain unaffected if the file does not exist (or stops existing):
In[13]:= | ![]() |
Out[13]= | ![]() |
The variable didn't change:
In[14]:= | ![]() |
Out[14]= | ![]() |
With "PurgeContentsQ"→True, expr will be set to Missing["FileMissing"] if the file does not exist (or stops existing):
In[15]:= | ![]() |
Out[15]= | ![]() |
In[16]:= | ![]() |
Out[16]= | ![]() |
Set how often to check the file for changes:
In[17]:= | ![]() |
Out[17]= | ![]() |
Change the file to see how long it takes for the change to be picked up:
In[18]:= | ![]() |
Out[18]= | ![]() |
When the import is slow, a placeholder is shown to indicate that it is busy:
In[19]:= | ![]() |
Out[19]= | ![]() |
The tool will not update when it is hidden in the FrontEnd:
In[20]:= | ![]() |
Out[20]= | ![]() |
The expression does not update if you do not click the opener:
In[21]:= | ![]() |
Out[21]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License