Back

Behold... the Power of Perl.


Have you ever laid awake into the wee-hours of the night and asked yourself "Can I use Perl to integrate with STK Object Model?" First, you need more help than a simple blog post, and second, yes you can! Although C#, Matlab, VB.Net  and Python get all the STK/Help Code-Snippet glory, you can use Perl with STK (and not just for TCP/IP connections). Why use Perl? Well, beyond the obvious $, @, and % (scalars, arrays, and hashes), and the sexy; line endings, Perl is simple and quick (you can write a Perl script before someone opens Visual Studio and creates a new project!). Here's a simple example...

# just a simple example of starting and controlling STK #
use Win32::OLE; 

# use existing instance of STK if already running, else start new #

if (! ($STKapp = Win32::OLE->GetActiveObject('STK11.Application'))){
$STKapp = Win32::OLE->new('STKX11.Application');
}
$STKapp->{Visible} = 1;
$STKapp->{UserControl} = True;

# do stuff in STK - using CONNECT commands or Object Model #

$stkRoot = $STKapp->{Personality2};
$stkRoot -> ExecuteCommand("New / Scenario MyScen");
$stkRoot -> Isolate;
$stkRoot -> UnitPreferences -> SetCurrentUnit("DateFormat", "EpSec");

# Exit STK #

$STKapp->{UserControl} = False;

You can find additional examples in the STK FAQs and Code Examples.

Author

Mike Shepherd


Developer Tools

Extend your existing software or create custom applications with AGI technology.

STK Components

Build custom applications on a foundation of STK’s algorithms and capabilities.

STK Integration

Automate Systems Tool Kit (STK) and integrate it with other applications to extend its capabilities.