karayil has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Im not able to identify the items in the application. I'm able to invole an application using $cw=win32::OLE->new("appl"); but menu items from this application is not accessible... $project = $CW->File->Open($projecttoopen, true, 0, 0)|| die "can't open a project $!"; gives error... Not able to identify what the errror is... it will be a great help, if someone helps me to identify the error.. Thanks a lot... -karayil

Replies are listed 'Best First'.
Re: win32::ole module
by castaway (Parson) on May 30, 2005 at 08:41 UTC
    Can you post more code, and the exact error you get? Which menus of which application are you trying to use?

    C.

      #!perl #Script to build a project # Win32::OLE gives access to COM objects, # including the IDE’s COM objects use Win32::OLE; # Create an instance of CodeWarrior $CW = Win32::OLE->new("CodeWarrior.CodeWarriorApp",'Quit'); # Get the command line argument $projecttoopen = @ARGV[0]; # Open the project $project = $CW->File->Open($projecttoopen, true, 0, 0)|| die "can't op +en a project $!" # Build the project # Build() $project->Build(); # end of script

      ---> here, able to invoke the application. But $CW->File->Open fails with error message --Can't call method "Open" on an undefined value at build.pl line 23

      -jaya

      Janitored by holli - fixed formatting

        Well that tells us that $CW->File is returning undefined. Perhaps you should call $CW->File the examine Win32::OLE->LastError().
Re: win32::ole module
by ghenry (Vicar) on May 30, 2005 at 08:41 UTC

    What's the application and what's the item you are trying to access?

    Also, do you have use strict; and use warnings; in your code?

    This will really help you out in any situation.

    Thanks.

    Walking the road to enlightenment... I found a penguin and a camel on the way.....
    Fancy a yourname@perl.me.uk? Just ask!!!