I'm loving the graphs, this is really cool. But I run my indigo server without a monitor and pretty much all my interaction is done via the web, and I wanted to make the graphs automatically available via the web server.
First, make a graphs subdirectory for the images:
Code: Select all
mkdir /Library/Application\ Support/Perceptive\ Automation/Indigo\ 6/IndigoWebServer/images/graphs
So this little chuck of bash copies all of the graphs into the Indigo web server images directory, and makes a small index file for them. This makes it easy to reference them in webpages and access them remotely.
Code: Select all
#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
cp /Users/tadg/Documents/INDIGOplotD/*.png /Library/Application\ Support/Perceptive\ Automation/Indigo\ 6/IndigoWebServer/images/graphs/
cd /Library/Application\ Support/Perceptive\ Automation/Indigo\ 6/IndigoWebServer/images/graphs
echo "<ol>" > index.html
for i in `ls *.png`; do echo "<li><a href='$i'>$i</a></li>" >> index.html; done
echo "</ol>" >> index.html
IFS=$SAVEIFS
You'll need to edit the path in this file to replace my username with yours.
And then I used LaunchControl (or Lingon [or vi]) to install this plist that watches the IndigoplotD folder for changed files, and invokes the bash script. It goes in ~/Library/LaunchAgents
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>net.gallistel.indigo-graph</string>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>-c</string>
<string>/Users/tadg/Documents/Indigo-graph-copy.sh</string>
</array>
<key>StandardErrorPath</key>
<string>/tmp/net.gallistel.indigo-graph.err</string>
<key>StandardOutPath</key>
<string>/tmp/net.gallistel.indigo-graph.out</string>
<key>WatchPaths</key>
<array>
<string>/Users/tadg/Documents/INDIGOplotD/</string>
</array>
</dict>
</plist>
After IndigoPlotD writes out the graphs, LaunchD will spot the changed files and call the bash script to copy them to the web server graphs directory. You can then see a list of them at:[url]http://<your-machine-IP-or-name>:8000/images/graphs/index.htm[/url]l . At this point it is really easy to reference the graphs in other pages.
Tad