#!/usr/bin/perl -w
#  This is the Perl equivalent of "Script4.js" and "Script5.vbs" scripts in the Surfer 7 Samples directory.
#  Converted by Burak Gürsoy <burakgursoy@gmx.net> <http://trperl.sourceforge.net>
#
#  This script requires an up-to-date version of ActivePerl (Windows port of the Perl Language).
#  You can download it from http://www.activestate.com for free.
#
#  Tested with ActivePerl 5.6.1 Build 633.
#
#  If Perl is in your path, you can execute it from the command line as 
#  	"perl Perl4.pl"
#  (Without the quotes)
#  And if ".pl" extension is registered and linked to perl in your system, then 
#  you can just execute it by double-clicking on the file.  
#
# This is a simple Perl Script example to create a shaded relief map.

use strict;               # Enable strict mode for errors
use constant True   => 1; # Create a boolean constant
use Win32::OLE;           # Load the OLE module

# Create an instance of the Surfer Application object and assign it to the
# variable named "$SurferObj"
my $SurferObj = Win32::OLE->new("Surfer.Application");

# Makes the Surfer window visible
$SurferObj->{Visible} = True;

# Creates a plot document in Surfer and assigns it to the variable named "$DocObj"
my $DocObj = $SurferObj->Documents->Add;

# Assigns the location of the grid file to the variable named "$Path"
my $GridFile = $SurferObj->Path . "\\samples\\Helens2.grd";

# Create the shaded relief map from Helens2.grd
my $MapFrameObj = $DocObj->Shapes->AddReliefMap($GridFile);
