I was writing a test program in which needed to control the settings of a Tektronix TDS1012B oscilloscope.
I had the drivers downloaded from http://sine.ni.com/apps/utf8/niid_web_display.model_page?p_model_id=9074 and they were very useful.
However to get the 'scope set to exactly what I needed was a bit tedious - setting the vertical range, the timebase, trigger, 1 or 2 channels displayed, maths ......
I needed an easier way, so I did some investigation of the vis in the library. It appeared that the scope was being controlled with VISA calls writing strings.
Now, this series of 'scopes (and others) has the facility to store the set-up to a USB memory, and when stored has the filename eg TEK0001.SET. (This is something I do already to set-up a number of 'scopes quickly and easily for other tests which aren't (yet) automated.) Usefully this is just a text file and can be opened in Notepad.
So, I thought, what if I copy the text of this file and use 'VISA write' to send it to the 'scope?
And it worked! The settings that I wanted were there. Note, however, that it can take up to 10 seconds for the scope to actually be ready for the next step, so add a suitable delay to cover this.
The procedure then... Set up the scope manually to the way that you want it using its front panel controls. Save the set-up to file on the USB memory. Open the file on your PC with Notepad. Copy the text. Paste the text into a string constant. Wire to a VISA write.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.