Try turning the last parameter to your OPCItemWrite call into a string. Some servers are sensitive to the actual type of the data in the variant. I think you might have tried that though.

Someone else had a similar problem, he started out with this code (which gave the error):

use Win32::OLE::OPC; use CGI qw(:all); $opcintf = Win32::OLE::OPC->new('OPC.Automation','hci.phd'); $group = $opcintf->OPCGroups->Add('sanitize_mode'); $items = $group->OPCItems(); $reset_item = $items->AddItems("6440SAN2.PV", 999); $reset_item->Write('SANITIZE');

and this is the code once he got it working:

use Win32::OLE::OPC; use CGI qw(:all); $opcintf = Win32::OLE::OPC->new('OPC.Automation','hci.phd'); $group = $opcintf->OPCGroups->Add('san_grp'); my $items = $group->OPCItems; $items->AddItem( '6440SAN2.PV', 0 ); $item = $items->Item(1); $item->Write('NORMAL');

You don't show how you are creating the groups, that might have something to do with it.


In reply to Re: Win32::OLE error by Anonymous Monk
in thread Win32::OLE error by nonnonymousnonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.