Re: Win32::OLE to open Visual Studio ?
From: rangelife (rangelife_at_blueyonder.co.uk)
Date: 10/24/03
- Next message: Grumbler(ng): "SerialPort for Active perl 5.6.1"
- Previous message: W K: "Re: perl SOAP::Lite and Apache"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 24 Oct 2003 09:24:36 -0400
This is possible, I've just done it. I'm amazed how easy it is! Thinking
of boycotting VBScript altogether! If only there was a way of launching
perl from within Visual Studio.. (the macro environment seems to be a
pretty tight sandbox)
The OLE application name is MSDEV (I'm using Visual C++ 6 - I guess .NET
is the same)
Example:
-------------------------
use Win32::OLE;
# use existing instance if MSDEV is already running
eval {$ex = Win32::OLE->GetActiveObject('MSDEV.Application')};
die "MSDEV not installed" if $@;
unless (defined $ex)
{
$ex = Win32::OLE->new('MSDEV.Application', sub {$_[0]->Quit;})
or die "Oops, cannot start MSDEV";
}
$ex->ActiveDocument->Selection->NewLine;
$fname = $ex->ActiveDocument->FullName;
print("File name: $fname\n");
undef $ex;
-------------------------
In return.. I'm trying to port the following line of VBScript to perl
Win32::OLE code, but can't work out how to do it- any ideas?
ActiveDocument.Selection = "Hello there"
in perl I've tried
$ex->ActiveDocument->Selection->Set("Hello there");
$ex->ActiveDocument->Selection = "Hello there";
I've ended up using this rather messy clipboard code instead
use Win32::Clipboard;
$ex->ActiveDocument->Selection->Cancel;
Win32::Clipboard->Set("Hello there");
$ex->ActiveDocument->Selection->Paste;
-- Posted via http://dbforums.com
- Next message: Grumbler(ng): "SerialPort for Active perl 5.6.1"
- Previous message: W K: "Re: perl SOAP::Lite and Apache"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]