in reply to Re^3: problem with script transfered from VBS
in thread problem with script transfered from VBS

Thanks for your prompt reply! I don't need to drain my brain as much since I got your help.
I've tried as your suggestion, the good news is perl didn't throw any error. the bad news is it did do anything!:(
I place print $rs->Fields('AEName')->value($psProxyName) after and before the statment. below are output
VB script: wscript.echo "AEName old value is" wscript.echo rs.Fields( "AEName" ).value wscript.echo "ADAS_ID old value is" wscript.echo rs.Fields( "ADAS_ID" ).value rs.Fields( "AEName" ) = psProxyName rs.Fields( "ADAS_ID" ) = pnDeviceID wscript.echo "AEName new value is" wscript.echo rs.Fields( "AEName" ).value wscript.echo "ADAS_ID new value is" wscript.echo rs.Fields( "ADAS_ID" ).value wscript.echo rs.Fields( "AEName" ).value wscript.echo rs.Fields( "ADAS_ID" ).value __OUTPUT__ C:\>cscript cmp.vbs Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. AEName old value is Mp_Default ADAS_ID old value is null AEName new value is MyTestMeterProxy06 ADAS_ID new value is 1415 Meter proxy created having the ID: 673132 Script Finished
perl script print "ADAS_ID old value is", $rs->Fields('ADAS_ID')->value."\n"; print "AEName old value is", $rs->Fields('AEName')->value."\n"; print "\$psProxyName value is $psProxyName\n"; print "\$pnDeviceID value is $pnDeviceID\n"; $rs->Fields('AEName')->value($psProxyName); $rs->Fields('ADAS_ID')->value($pnDeviceID); print "ADAS_ID new value is", $rs->Fields('ADAS_ID')->value."\n"; print "AEName new value is", $rs->Fields('AEName')->value."\n"; $nCheckoutID = $ctMgr->Checkout($pnContainerID, $aSec); __OUTPUT__ C:\>perl cmp2.pl ADAS_ID old value is AEName old value isMp_Default $psProxyName value is MyTestMeterProxy010 $pnDeviceID value is Win32::OLE=HASH(0x1987448) ADAS_ID new value is AEName new value isMp_Default Meter proxy created having the ID: Script Finished
I'm confused with output above. It seems to me '->value($psProxyName)' doesn't work?
How can I continue?

BTW: what can I benifit from overstating my experience?

I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Replies are listed 'Best First'.
Re^5: problem with script transfered from VBS
by Bloodnok (Vicar) on Aug 06, 2008 at 14:48 UTC
    Hi ,

    Although the you didn't get a compile-time error, you may have experienced a run-time error - which wasn't caught.

    If it's the basic Win32::OLE module, any error from the last operation can be accessed via a call to Win32::OLE->LastError(), so try ...

    $rs->Fields('AEName')->value($psProxyName); die "value(\$psProxyName) failed - " . Win32::OLE->LastError() if Win3 +2::OLE->LastError();

    BTW, my sig is self-deprecating - it says that PM has a higher regard for my experience than I do;-)

    A user level that continues to overstate my experience :-))
      It throws:
      C:\>perl cmp2.pl value($psProxyName) failed - Win32::OLE(0.1709) error 0x8002000e: "Inv +alid numbe r of parameters" in METHOD/PROPERTYGET "Value"Meter proxy created having the ID: Script Finished
      What does it mean? and how do I walk around? Thanks in advance!

      I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
        Hi ,

        You gave value() one parameter - $psProxyName - the library was clearly expecting either more or less than that...if more, of what form they take I have no idea.

        It could, of course, be that the OLE model is similar to the Excel OLE model, in which case, value() is an accessor method, taking no args, to return the current value...and if that's so, then you could possibly (last throw of the dice time) try replacing $rs->Fields('AEName')->value($psProxyName); with $rs->Fields('AEName')->{value} = $psProxyName; - note the change of value() to {value} i.e. from method invocation to hash member.

        Other than that, I think you need to look at the COM model for your application for further information...Node Using Win32::OLE and Excel - Tips and Tricks gives an excellent overview of the use of Win32::OLE with Excel - from whence I 'borrowed' the above last ditch attempt to help.

        A user level that continues to overstate my experience :-))
        How can "Invalid number of parameters" be ambiguous?