I'm new to using Win32::OLE and I've run into a problem. The application I want to interface with (SpaceObServer from JAM Software) has the following method I am trying to use:

Syntax (nasty VBS!)

GetFileAgesValue (FolderID : <Integer>, Index : <Shortint>, OccupiedSpace : <OLEVariant>, NumFiles : <OLEVariant>)

Parameters

FolderID The ID referring to the directory for which the "Age of Files" values should be retrierved. You get this ID from the functions RootFolderID, FirstChildID or NextSiblingID.

Index The index of the "Age of Files" bar to export. The first index is always 0. The last index is always (FileAgesCount-1)

OccupiedSize (Out Parameter) The space occupied by all files of this "Age of Files" interval.

NumFiles (Out Parameter) The number of files of this "Age of Files" interval.

My code fragment for calling this method is:
$AllocSpace = 0; $NumbFiles = 0; my $SOS = Win32::OLE->GetActiveObject("SpaceObServer.Application") || Win32::OLE->new("SpaceObServer.Application", 'Quit'); # get already + active SOS # application or open new for($i=0; $i < $SOS->{FileAgesCount}; $i++) { $SOS->{ROOTDirectory} = $RootDirectory; $CurrentID = $SOS->{RootFolderID}; $SOS->GetFileAgesValue({ olderID => $CurrentID, Index => $i, OccupiedSize => $AllocSpace, NumFiles => $NumbFiles }); print "$AllocSpace\n\n"; # Just to see if I get any data returned }
Setting the first 2 parameters is no problem but how to I get at the returned values? In VBScript the parameters are positional and I just Dim the variables and present the names.

From a confused BasilOfWestdene


In reply to Using Win32::OLE by BasilOfWestdene

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.