How to call exact file location using Win32::OLE->new()?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Naga Prakash
    New Member
    • Jan 2011
    • 2

    How to call exact file location using Win32::OLE->new()?

    Hello All,
    I'm very much new to PERL scripting. I'm the admin for an online tool which has some Perl scripts. And i have a problem executing one of the script. I'm just writing a problematic code in the script:
    Code:
    my $ex = Win32::OLE->new('CamCad.application') or die "oops\n";
    my @args = (25,"$basedir\\SYM.TXT,$basedir\\RTE.TXT,$basedir\\BRD.TXT,$basedir\\PAD.TXT",'');
    $ex->Invoke('Import',@args);
    Now when the first line is executed, a different version of CamCad application is getting called. My requirement is to call excatly "C:\MentorGraph ics\SDD_HOME\CA MCADPRO.EXE /Professional", that is an EXE is called with a Switch (/Professional).

    Is there any way I can replace the code in line1 so that the next lines works fine.
    or
    How is new('Camcad.app lication') know which EXE/application it has to execute. If i know this may be i can directly point here to call "C:\MentorGraph ics\SDD_HOME\CA MCADPRO.EXE /Professional".

    Thanks in Advance.
  • Oralloy
    Recognized Expert Contributor
    • Jun 2010
    • 988

    #2
    Naga,

    I'm not an expert in OLE; however, you'll notice that your code is going to the class CamCad.applicat ion that's maintained in the windoze registry.

    You can then create a new class in the registry by copying the existing class and updating the methods to use the "profession al" version.

    That's likely the easiest approach. Otherwise you can try manually searching through the registry for all instances of Mentor and look to see if any are already installed with the "/Professional" switch.

    Failing that, try a quick search through the uSoft documentation.

    Comment

    • RonB
      Recognized Expert Contributor
      • Jun 2009
      • 589

      #3
      Windows is not very smart in this area of having multiple versions of the same application. This is only one of the areas where *nix systems outshine Windows.

      Why are you running 2 different versions? Is one of them for development and the other for production? If so, then it would be better to use 2 different systems.

      Comment

      • Naga Prakash
        New Member
        • Jan 2011
        • 2

        #4
        Oralloy:
        I had look at all the registries, but nothing found with /Professional switch.
        And changing the registry worked for one time, means once I submit a request from my application it calls CAMCAD correctly with the newly changed value, but the next time the original data value for that clsid is restored. Is there any other technique to replace win32:OLE in PERL which works in a similar way? Or in some other script or language so that I can replace PERL with that.
        Thanks for the information provided.

        Comment

        • Oralloy
          Recognized Expert Contributor
          • Jun 2010
          • 988

          #5
          Naga,

          It sounds like the program is "self repairing"; even though you don't want it to be.

          Try copying the clsid to one of your creation, perhaps 'CamCad.applica tion.profession al', and see if that helps resolve your problem.

          Luck!
          Oralloy

          Comment

          Working...