Converting OLE variants in a FileSystemObject script

I am currently exploring the scripting power of labview and have some serious issues with converting a simple OLE variant to a LV datatype. I also tried with OpenG tools. Take a look at my example script
The ActiveX reference to FileSystemObject works with windows XP and maybe some older windows operating systems. Thanks
Aart-Jan
Attachments:
list_drives.llb ‏293 KB

aartjan,
OpenG Data Tools are for LabVIEW Variant data only. AcviveX Variant is a totally different beast under the same clothes.
However, the solution to your problem is simple. The variant type VT_R8 tells that it is a 8 byte real value, e.g. a LabVIEW double. You simply use "Variant to Data" to convert it to a LabVIEW double. See the attached VI. Also notice the use of "Format into String" to generate the string, a node that is much more convenient to use than string concatenation.
LabVIEW, C'est LabVIEW
Attachments:
list_drives.vi ‏35 KB

Similar Messages

  • Is it possible to convert LabView data into OLE variant?

    Hi. I'm using Activex Data Objects (ADO) to communicate with MySQL. Some ActiveX methods give OLE variant output, with "Variant Type" like "VT_ARRAY|VT_UI1", "VT_UI1" or "VT_BSTR". With some deduction and trial and error is relatively simple to extract data from this OLE variants and convert them to LabView data types. The problem is when I try to input variant data to some ActiveX methods, it almost always give me errors, I suppose because it expects the same type of the outputs, this is: OLE variants. Now, the question is: ¿Is there any way to convert LabView data into OLE variant data? ¿How?
    I've been searching and found a lot of posts about problems when passing variant data into ActiveX, saying that sometimes SAFEARRAYs are needed, sometimes saying that there were some bugs in LV6, giving some workarounds to this bug and saying that it is fixed in LV7.1, but the supposed workarounds don't work and the bug is still present in LV7.1, if it is really a bug.
    I think that if I could put LV data into OLE variant shape I may find an answer and solution to this matter.
    Thank you
    Daniel R.
    UdeC - Chile

    Below I describe how to handle OLE Variants, but I wanted to mention that LabVIEW does have a Database Connectivity toolkit (http://sine.ni.com/nips/cds/view/p/lang/en/nid/6429) that has already created a set of VIs for ADO. You might check that out first.
    However, handling OLE Variants in LabVIEW is automatic. LabVIEW itself has a variant datatype. When you use the ActiveX property or invoke nodes and one of the parameters is an OLE Variant, it is automatically converted to a LV Variant. You can then use the LV Variant VIs (such as "Variant to Data" and "To Variant").
    Brian Tyler
    http://detritus.blogs.com/lycangeek

  • Convert Back to OLE Variant

    Example VI attached.
    I aquire an image from a fingerprint reader, extract the template (digital way of uniquely identifying people), and save the template to disk.  Later, I acquire a new image, extract the template, and use the appropriate ActiveX method to compare the template against the stored version.  The template is OLE Variant, which cannot be stored to binary file.  If I store the Variant as an array of U8's instead, I am able to retrieve the U8's from the file, and convert to LabVIEW Variant.  The ActiveX method compares correctly, but sluggishly.  Any way to convert back to OLE Variant?
    Thank you,
    Jason
    Certified LabVIEW Architect
    Wait for Flag / Set Flag
    Separate Views from Implementation for Strict Type Defs
    Attachments:
    Retrive Stored Fingerprints & Identify Current.vi ‏30 KB

    I'd like to focus on saving and retrieving OLE Variant data.  The methods used to compare fingerprints (i.e. IdentifyPrepare and Identify in my example) work properly and rely on other settings (threshold and rotation tolerance), so I'd rather not architect my own.  (Thank you for your comment, Mike).
    Anyone ever successfully "type casted" back to OLE Variant?
    Thanks!
    Jason
    Certified LabVIEW Architect
    Wait for Flag / Set Flag
    Separate Views from Implementation for Strict Type Defs

  • How do I convert a Variant of type=String to G data? (LV 5.1.1)

    I've tried to return a string in the Variant return of a VB function in a DLL. (I want to do this so that I can retain the interface and thus binary compatibility in the DLL.)
    When I use the DLL function in LabVIEW 5.1.1 I
    get an error in the call library function call (returning). It looks like there is a way to handle this in v 6.0 but I have to use 5.1.1 for this application. Is there a way for LV 5.1.1 to handle a Variant containing a string?
    Thanks
    Dave Karon
    Concepts NREC

    Hi Dave,
    you can use the type conversion function located under advanced -> data
    manipulation to convert the variant into a string.
    Henrik
    Dave Karon schrieb in im Newsbeitrag:
    [email protected]..
    > I've tried to return a string in the Variant return of a VB function
    > in a DLL. (I want to do this so that I can retain the interface and
    > thus binary compatibility in the DLL.)
    > When I use the DLL function in LabVIEW 5.1.1 I
    > get an error in the call library function call (returning). It looks
    > like there is a way to handle this in v 6.0 but I have to use 5.1.1
    > for this application. Is there a way for LV 5.1.1 to handle a Variant
    > containing a string?
    >
    > Thanks
    > Dave Karon
    > Concepts NREC

  • How do I convert PDF/JPEG file in "Brush Script MT" font to Word Document

    How do I convert PDF/JPEG file in "Brush Script MT" font to Word Document? (I checked with Acrobat XI pro but no use

    You cannot in Adobe Reader. You can try in Acrobat, but first you must try to run OCR (Text Recognition). I have never tried OCR on a script font.

  • How to convert a Word Document to SAP SCript standard text.

    Hi team,
    Does any one know how to convert a word document or text in Word format to standard text.
    So that we can use that standard text in Script output.
    This might be very useful if we need to convert a lot of text into standard text.

    Hi,
    Create the name of the standard text you want in SO10.
    When the editor is called up, select Text -> Upload and then browse for your file(s). Must be saved in RTF format in Word remember.
    Cheers
    Colin.

  • How do I extract data from an OLE variant?

    I am trying to retrieve a string from a Dot Net function.  What I get out is a Labview variant.
    From my research, I suspect that what Labview is giving me in this variant is a pointer to the string that I need to dereference.  Problem is that I can't even get the pointer value out of the variant.
    If I view the variant as an indicator, I see that it has a value but no matter what type I wire to the Variant to Data function, I get a type mismatch error.
    The value is there, why can't Labview give it to me?

    MoveBlock() won't help you here much. VT_DISPATCH indeed contains a pointer, but not a pointer to data but instead a pointer to an IDispatch COM object. This is basically a pointer to an object containing internally one (and typically more) so called COM virtual method dispatch tables. The only safe way to get at the information is by using the COM QueryInterface() method in that object to retrieve the IDispatch interface, then calling the IDispatch methods to inspect the data contents the object contains and then retrieving the actual data.
    This is impossible to do on your own in a LabVIEW diagram but requires quite a bit of C(++) code. However if you know what the IDispatch is really holding internally (and your VBA.ICollection sounds like a plausible idea) then you can create a compatible Automation refnum by dropping one on your front panel and then browsing to the according ActiveX object type (here most like in the Visual Basic typelibrary) and then using Variant to Data, let LabVIEW comvert the contained IDispatch to the actual Automation refnum to the data object. Variant to Data will return an error if you selected the wrong ActiveX refnum type.
    An VBA.ICollection is however not a string or numeric data already but more like an Array like container, so you would then have to use the VBA.ICollection methods to enumerate the elements in it as variants and convert them to the actual datatype using Variant to Data again.
    Also note that pointers are 32 bit in LabVIEW 32 Bit and 64 bit in LabVIEW for 64 bit. This is independent if you run on 32 bit or 64 bit Windows, since a 32 Bit version of LabVIEW runs in a 32 bit environment even on 64 bit Windows.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Flatten to string vs. Convert to variant

    Does anyone have any speed/performance comparison between flattening a cluster to a string vs. converting to a variant?  I was trying some tests but I think the optimizing compiler in LV is not telling me the whole story...   Thanks!

    Not sure why this is so surprising.  Flattening to a string requires making a copy of the entire data structure and rearranging it so everything in it is stored sequentially in a single block of memory.  Converting to a variant just requires allocating a pointer to the existing memory location, along with a tag that says what sort of data it contains.
    Going the other direction, unflattening from a string requires splitting up the string at the right points and copying each element into a new structure.  To get data back from a variant you just point at the original data and as long as the types are compatible you're all set.
    The 3x difference isn't really meaningful; the difference in speed will be proportional to the complexity of the structure.  I'd guess that if you flatten a string to a string versus converting it to a variant you'll get relatively little difference, whereas a cluster containing several large arrays will require much more time.

  • Converting HR Form(pe51) into sap script/smartform

    I have an HR form created in PE51 - how do I convert this into a sap script/smartforms?  I would like to put our company logo on the form...
    Thanks - Janet

    Well i once found these two Notes:
    701887 and 309204
    It is talking about PE51 and some interaction with smartforms and a couple of Function modules.
    Following objects are created in release 4.6B and delivered from releases upwards via this note :
    Function group HR99S00_SMARTFORM
    Function module HR_99S_CONV_PRIPARMS_TO_SSFCOMPOP converts printing parameters from format PRIPARMS to Smartform format SSFCOMPOP.
    Function module HR_99S_CONV_SFERROR_TO_HRERROR converts and integrates Smartform error table to an HR error table.
    It looks like it is possible to produce a smartform payslip. What I could not find is how to do it.

  • Does anyone know how to convert the .deploy file to ant script

    hi guys ,
    I am doing some work relate to J2EE/ADF application deployment. I need ant script to compile/ear and remote deploy.
    Does anyone know how to generate the ant script based on the .deploy file (eg.ejb.deploy and webservice.deploy ).
    although I can generate the ant script with creating buildfile from project ,but all the ant tasks are just compile ,no other deploy task...
    I much appreciate if anyone can give me a clue
    Kevin

    I don't know how to convert a .deploy file but you may use below commands to remotely deploy an ear file
    To compile
    c:\Oracle\Middleware\jdeveloper\jdev\bin\ojdeploy -profile EarProfile -workspace MyApp\MyApp.jws
    To Deploy
    c:\Oracle\Middleware\wlserver_10.3\server\bin\setWLSEnv.cmd
    java weblogic.Deployer -adminurl http://localhost:7101 -user weblogic -password weblogic1 -deploy -upload MyApp\deploy\EarProfile.earMore Details
    http://edocs.bea.com/wls/docs100/deployment/understanding.html#wp1057841

  • Converting OLE Object in Sql Server to Oracle

    SQL Server contains datatype OLE Object. This is basically an array of binary floating point data where each value of the array is 4 byte long. How can I store these values in Oracle database.
    null

    You cannot specify the precision/scale or length of input paramters to a stored procedure in Oracle, or at least the pl/sql engine does not respect the sizing. Assuming that you want to do something with variable1 in the procedure, and not just return it, the Oracle equivalent would be something along the lines of:
    SQL> CREATE FUNCTION f (p_param1 IN VARCHAR2,
      2                     p_param2 IN NUMBER,
      3                     p_param3 IN NUMBER) RETURN NUMBER IS
      4     l_var1 NUMBER(20) := SUBSTR(p_param1, p_param2, p_param3);
      5  BEGIN
      6     RETURN l_var1 * 10;
      7  END;
      8  /
    Function created.
    SQL> SELECT f('ABC10DEF', 4, 2) FROM dual;
    F('ABC10DEF',4,2)
                  100You may need to adjust the return type to match what you are actually returning.
    You can also use this iin a direct assignment in pl/sql without doig a select, something like:
    SQL> DECLARE
      2     l_num NUMBER(20);
      3  BEGIN
      4     l_num := f('ABC10DEF', 4, 2);
      5     DBMS_OUTPUT.Put_Line('The number is: '||l_num);
      6  END;
      7  /
    The number is: 100John

  • Can we convert a variant bom in to a multiple bom

    my problem is i have  a variant bom for a material. i want to create  a alternative boms for that material.it says can not be done sine the bom is a variant bom. it can be done only for a multiple bom.

    Hi,
    Yes, This is the SAP standard functionality.
    Regards,
    V. Suresh

  • Reg Add problem. Convert from .reg to reg add script

    Hi. I'm making a registry script so I can add elements to the registry.
    The script is working for DWORDS but I cant get the last one to work.
    The registry exportet code I wan't to make a Reg ADD line from is:
    [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData]
    "UserFilter"=hex:41,1f,00,00,53,08,ad,ba,01,00,00,00,2c,00,00,00,01,00,00,00,\
    01,00,00,00,0c,00,00,00,9c,26,40,27,0c,f5,cf,01,01,00,00,00,07,00,6e,00,69,\
    00,74,00,6f,00,2e,00,6e,00,6f,00
    I've tried to google and have tried several reg ADD lines, but should't it be something like this?
    reg ADD "hku\temp\Software\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData" /v UserFilter /t REG_BINARY /d
    41,1f,00,00,53,08,ad,ba,01,00,00,00,2c,00,00,00,01,00,00,00,\
    01,00,00,00,0c,00,00,00,9c,26,40,27,0c,f5,cf,01,01,00,00,00,07,00,6e,00,69,\ 00,74,00,6f,00,2e,00,6e,00,6f,00 /f
    Its the "\" that's get messy, don't know how to write reg Add line with that.
    If I skip that line the script works, I can then run the .reg file above to complete the reg. settings, but that won't solve my problem.

    Those backslashes just indicate line continuations in the .reg file.  You don't need them in your reg add version; the binary data can be placed all on one line.
    If I remember correctly, you don't need the commas when using "reg add" either, so just this should work.  I've used environment variables here to split it up across multiple lines and make it more readable, but that's not actually required:
    set REGKEY="hku\temp\Software\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData"
    set REGDATA=411f00005308adba010000002c00000001000000010000000c0000009c2640270cf5cf010100000007006e00690074006f002e006e006f00
    reg add %REGKEY% /v UserFilter /t REG_BINARY /d %REGDATA%

  • While i press the key its sholud be convert to upper case using java script

    hai
    have a peace day.
    give me a code for
    while i typing a text in lower case but it should be displayed in uppercase format in the textbox
    any body now the code means please help me
    thank u

    <%@ page contentType="text/html;charset=windows-1252"%>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title>untitled</title>
        <script language="javascript">
          function setUpperCase(val){
            val.value = val.value.toUpperCase();
        </script>
      </head>
      <body>
      <input type="text" name="textfield" onkeydown="setUpperCase(this)" />
      </body>
    </html>

  • Tool required to convert data into script

    I have one staff table with following data
    empno, name, dob
    12345, kala, 25-aug-1960
    23456, anugraha,05-mar-1991
    34567,abiya,01-jul-1984
    I want to send this data to another domain where the staff table exists with the same structure.
    hence i need script file as follows
    insert into staff values (12345, 'kala', '25-aug-1960');
    insert into staff values (23456, 'anugraha','05-mar-1991');
    insert into staff values (34567,'abiya','01-jul-1984');
    i can run this script to load data into that new staff table under different domain.
    Every day's transaction, i want to create this script file and store it in different domain.
    Is there any facility to convert my entire data as above script file instead of writing procedures using cursors.

    In Oracle SQL Developer, you can right-click on a table and export the data as INSERT statements, among other formats.
    Thanks,
    - Scott -
    http://sumnertechnologies.com/
    http://spendolini.blogspot.com/

Maybe you are looking for