Likely the timeout errors are when you are seeing the -113 Undefined Header error on the analyzer. Usually this indicates a syntax error for the SCPI commands. Have you tried this with the package of instrument drivers you linked here? Reason I ask is a bunch of the VIs in the examples had different names in the instrument driver package than what the example wanted, making me thing they corrected some syntax errors. I was able to relink them and will work on this throughout the day showing you a better way . Hopefully that will give you a better idea of both how to use the instrument drivers and the LabView dataflow and statemachine techinques.
Do you have some specific needs or are you just learning at this point? If you have specifics, we can work through those as well.
Alot of the content of the states will be dependent on the measurement you are trying to make and how much setup needs to be done to the OSA to get there. I think once you see what I am working on to clean up the examples, you will understand what I mean. You are sort of correct that you should start with an init and end with a close, but in reality this is more for handling the VISA bus references in the PC than for the instruments sake.
A lot of times if I am doing something simple such as a trace capture from a spectrum analyzer, I usually leave the instrument setup to the operator. When they are ready to take a trace, I open the VISA reference to the insturment, query the values I need, then close the VISA reference. I also try to return the analyzer to local control which depends a lot on the age of the equipment. Some of the HP gear I work with is knocking on 25 years old and doesn't have some of the same features in GPIB as the newer equipment.
Attached is a refined version of the example 2 that uses what I feel are appropriate LabView techniques. I also did some documenting in the code for you to try to give you an idea of what I am doing, and what Agilent did in their code. If you are familiar with text languages the technique should look familiar using DoWhile and a big If/Then/Else statement.
You may have to relink to VIs if this comes up broken. If so, I might suggest that you first take the ag8614x_LV.zip file that placed here earlier and unzip it into c:\program files\national instruments\labview 8.5\instr.lib\ folder. You may then only have to re-direct LabView to the VXIpnp driver install location. BTW, I am developing in LabView 8.5. I believe I read that you are using 8.5 or later so you should be OK. Let me know if you have any problems. If you do, likely we have problems with the SCPI syntax, as I didn't take the time to download the manual and verify it, I just copied it from Agilent's VIs. The code is untested, so hopefully I didn't forget anything or miss something.
I kind of have to laugh at Agilent's VI and "driver" set. What they did, could have been done without their instrument driver for the most part (at least the examples). In LabView we have the ability to read and write to and from the VISA driver using the VISA natives. They do exactly the same thing that Agilent did with their VXIpnp driver, since Agilent still requires you to code or enter the SCPI language with their "Send String" VI. I am going to continue tinkering with this and show you how I would have done this with the absence of a NI provided LabView driver. It's not difficult, especially if you have access to the programming manual for the instrument to get the SCPI syntax for your requirements.