I am working on a benchcel method that downstack, aliquot seal and stack. The problem is we have both 4 stackers ver and 6 stackers ver so we are looking into ways to get how many stackers are associate with the used device file. There are other ways like for eg ask user to input how many stackers, or parse the device xml files but if theres a way to get it directly in the protocol using js that will be great. Please share your thought and thank you in advance!
The number of stackers for a benchcel is stored in the profile and not accessible by JS, so you cannot automatically drive the protocol to use 4 or 6 stackers. However your users will see which benchcel they are using so you could create two very similar protocols, one for the 4R and another for the 6R and have the user select the number of stackers in a form. The “run” button will be a pushbutton control that selects the protocol to run via “runset.appendProtocolFileToRunset()”.
I think that this is the safest option.
Best
M
P.S.
Actually you can read the number of racks form a CMD shell called by run() in this way (in the example below I assumed that your profile is called “4R”):
Unless this was removed from the scripting engine, you can read and write directly to and from the Windows Registry with VWorks JavaScript. If I recall, the methods do not show up in IntelliSense:
The way I’ve handled instrument variations in the past is to always load a .js file that includes details about that particular instrument. I think it was actually @Pete that first taught me this unknowingly.
He (or someone would, whatever, I continued this practice for all my VWorks protocols going forward) would load a main.js file every single time. Every VWorks instrument would have the same file structure for .js files. Typically now the main.js file is the same for every instrument, but one of the files that main.js loads would be a localVariables.js file. In that file I’ll store things that are appropriate for that instrument. In your example I would have a variable that would tell protocols how many stackers are available. Some protocols would use that information, some protocols would not, but it doesn’t really matter it always gets loaded when the protocol runs. You’ll find this to be more useful that you might have thought otherwise.
Yep that’s clever. The problem is that I’m not sure if you get an error when trying to compile a protocol that refers to Stacker 6 when the profile only has 4.
Anyway I would use the information in the external file to run the appropriate protocol from a form so there are no issues with the compilation step.
Thank you guys so much for the reply!! This is extremely helpful! I will try and see what works the best for our workflow!
Another question is has anyone tried using ActiveX Wrapper to parse the device information? I found a couple lines of codes in VWorks and thought I could use ActiveX to get stacker information but after I created a ActiveX object with BenchCel’s ProgID its an empty object (I think). Anyone has seen this before?
I’ve used the ActiveX constructor sometimes to connect to some Windows COM objects, for example
var xmlDoc = new ActiveX(“Msxml2.DOMDocument.6.0”);
With this one you can use Xpath to extract values from XML nodes, see the plateInfo function in my GitHub repo VWorksExtLib.
I would not suggest trying to connect to the Benchcel via ActiveX other than when using C# or similar languages based on .NET. There’s no point in doing this if you use VWorks, because it does not add anything to what you can do with VWorks. On top on that our R&D suggests to never install VWorks and ActiveX on the same computer!
Yes, I’ve used ActiveX to talk/control to vworks drivers. I tested the following and I’m getting proper class instantiation but since I don’t have hardware connected can’t call any methods that require initialization. Give it a try
var ocx
if( ocx == undefined){
ocx = new ActiveX( “BENCHCEL.BenchCel.1”);
}
for( x in ocx.members)
print( x)
ocx.set(“Blocking”, true); // Use set() method to set the Blocking property
print(“Initializing BenchCel1!”)
var version = ocx.GetFirmwareVersion();
print("Versions is " + version);
var result = ocx.Initialize(“benchcel1”);
var count = ocx.GetStackCount();
print(count)
Edit: Actually, if I remember correctly an issue you might encounter is that initialize will fail if you already initialized the instrument via VWorks on protocol start, which is likely the case for you, so this might be a bit of a dead end
Tysm!!! I used the wrong PorgID lol. Yea I agree its a dead end but at this point I just want to know how this work haha. I am still having trouble getting the number of stacker info and I have the similar error as yours. I think (I might be wrong I am purely guessing) its requiring a pointer as the function input but I don’t know if theres pointer in vworks js.
And I tried using Registry() to parse from a specific profile and it works!! I never know theres registry object haha. Is there a place to look for this kind of information besides the vworks knowledge base?
Yea, that’s a tricky one. I don’t think their javascript engine supports method arguments as refs (or javascript in general) . Did you try just passing a declared var eg. as the argument and the printing its value.
Something like:
var countRef = 0
ocx.GetStackCount(countRef);
print(countRef);
Registry() is the only undocumented constructor. Everything else is in the knowledge base. It was used in our AssayMAP product to set up the teachpoints of a number of profiles based on a parent profile. it is useful, but not essential, as one could replicate it with run() and the CMD shell as I have shown before. The problem is that it stops the js engine if pointed to a not existent registry entry and no try/catch block works.
ActiveX() is better, but tricky. Some COM objects give good results, some other (for example Wscript.shell) cannot be fully used (at least I could not use it properly when I tried).
I’ve lately started to run external powershell code if I need to use specific COM objects. To me this is a more stable option, although powershell takes a couple of seconds to start.