08-04-2016 09:18 AM - edited 08-04-2016 09:19 AM
Hi,
I'm trying to use VI Scripting to change the context-menu setting for a node GPIB Write or GPIB Read - Synchronous I/O Mode. I obtain the reference to the GPIB Write node, but when I try to use ToMoreSpecificClass function with the target class GPIBReadWrite, the function ToMoreSpecificClass returns an error 1057: LabVIEW: Type mismatch: Object cannot be cast to the specified type.
I tried the similar thing with Write to Text File function. It also has a context-menu setting for Convert EOL. Trying to cast its reference with ToMoreSpecificClass function with target class ReadWriteFile causes the same error: 1057 Type Mismatch.
What I am missing?
Solved! Go to Solution.
08-04-2016 10:10 AM
I'm not really sure what is supposed to be in the GPIBReadWrite class but it doesn't look like any of the GPIB functions are. I dumped every single GPIB function from the pallettes to a VI and tested it against too more specific class and didn't get anything to return without an error.
If I changed the class to function it returns every GPIB call.
08-04-2016 10:24 AM
You're right, the Function class works, but it's too generic, for accessing the SyncI/O? property you have to cast to GPIBRW:
08-04-2016 11:24 AM
Sorry I wasn't very clear in my first post. I know function doesn't give the properties required but it was more of an observation that no GPIB functions seem to be of the GPIBRW class when I would assume at least some of them should be.
08-05-2016 01:26 AM
So, is there a way to programmaticaly change the set the Synchronous I/O Mode of the GPIB read/write functions? Actually I want to set them all to synchronous, which is unfortunaly a non-default settings. That means even using Replace method on this function will cause the new function to have this property set to async mode 😞
Can someone from NI comment on this please?
Thanks
08-05-2016 03:55 AM
Hi,
FYI: the scripting functionality is not officially supported by NI.
Source: http://sine.ni.com/nips/cds/view/p/lang/en/nid/209110
Technical Support
Because this is an NI Labs product, NI does not support LabVIEW VI Scripting. All technical issues should be posted on the API Community:
http://decibel.ni.com/content/groups/labview-apis
I couldnt get the scripting functionality running. There are only two outdated function that accept the GPIBReadWrite Class, but they dont seem GPIB related to me.
For the only workaround I could imagin you could replace the GPIB read/write VIs with a wrapped version of your GPIB read/write. In this wrapper VI you can make settings that would apply to all GPIB read/write VIs. (demo is attached)
Best regards
Christoph
08-05-2016 05:33 AM
Hi Christoph,
thanks for the response, I was also thinking about the wrapper, now I see it as inevitable 🙂
The similar issue I saw with the VI Write to Text File and not being able to cast it to the class ReadWriteFile. Is this the same issue? What are the members of the ReadWriteFile class?
08-05-2016 06:04 AM
Hi,
the members I found were "Read from binary file" and "Write to binary file". I attached an easy script how to find all possible functions of a certain class.
Just for clarification: Since VI scripting is not an official part of LabVIEW it is not an "issue" strictly speaking. VI scripting provides helper function which can be used if present.
Best regards,
Christoph
08-05-2016 06:28 AM
Hi Christoph,
thanks a lot for help
08-05-2016 06:39 AM
you are welcome!