Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7018385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:02:38+00:00 2026-05-27T23:02:38+00:00

Currently I am writing Perl script that creates LoadRunner scenario, execute the test, collect

  • 0

Currently I am writing Perl script that creates LoadRunner scenario, execute the test, collect the result, recover the environment and repeat the cycle again with different scenario variables.

I don’t have a problem creating new scenario, adding generator, adding 2 groups + script + the run-time settings. But I am having a problem with:

  1. Setting scenario schedule from “Scenario” to “Group”.
  2. Setting schedule per group

This the snippet of the code:

use strict;
use v5.10;
use Win32::OLE;
use Win32::OLE::Enum;
use Win32::OLE::Variant;
use Data::Dumper;
use Win32::OLE::Const 'LoadRunner Automation Library';
use constant False  =>  Variant(VT_BOOL,'');
use constant True  =>  Variant(VT_BOOL,1);

my $lrEngine = Win32::OLE->new('wlrun.LrEngine') or die "oops\n";
my $lrScenario = $lrEngine->Scenario();
my $rc = $lrScenario->new(0, 1); # do not save previous, Regular vusers based scenario 
if ($rc != 0) {
    print "Win32::OLE::LastError: ".Win32::OLE::LastError()."\n";
    print "lrScenario->new(0, 1):rc: $rc\n";
}
# snip-snipped - add generator
# snip-snipped - add @groups definition
foreach my $group (@groups) {
    print "scriptName: $group->{scriptName}\n";
    my $scriptLocation = $group->{scriptLocation};
    my $scriptName = Variant(VT_BSTR|VT_BYREF, $group->{scriptName});

    { # add $group->{scriptName} script
        $rc = $lrScenario->Scripts->Add($scriptLocation, $scriptName);
        if ($rc != 0) {
            print "Win32::OLE::LastError: ".Win32::OLE::LastError()."\n";
            print "lrScenario->Scripts->Add($scriptLocation, $scriptName):rc: $rc\n";
        }
    }
    #############################################################################
    my $groupName = Variant(VT_BSTR|VT_BYREF, $group->{groupName});
    { # add $group->{groupName} group
        $rc = $lrScenario->Groups->Add($groupName);
        if ($rc != 0) {
            print "Win32::OLE::LastError: ".Win32::OLE::LastError()."\n";
            print "lrScenario->Groups->Add:rc: $rc\n";
        }
        $rc = $lrScenario->Groups->Item($groupName)->AddVusers($scriptName, $hostname, 3);
        if ($rc != 0) {
            print "Win32::OLE::LastError: ".Win32::OLE::LastError()."\n";
            print "lrScenario->Groups->Item($groupName)->AddVusers:rc: $rc\n";
        }
    }
    #############################################################################
    # snip-snipped - change group script run time setting
}

my $scheduleName = Variant(VT_BSTR|VT_BYREF, 'Schedule123');
my $lrManualScheduleData = $lrScenario->ManualScheduler->AddSchedule($scheduleName, lrGroupSchedule); # Scenario schedule mode
if (!$lrManualScheduleData) {
    say "Win32::OLE::LastError: ".Win32::OLE::LastError();
    say "lrScenario->ManualScheduler->AddSchedule:rc: $rc";
}
$rc = $lrScenario->ManualScheduler->SetCurrentSchedule($scheduleName);
if ($rc != 0) {
    say "Win32::OLE::LastError: ".Win32::OLE::LastError();
    say "lrScenario->ManualScheduler->SetCurrentSchedule:rc: $rc";
}
print "\$lrScenario->ManualScheduler->SetScheduleMode($scheduleName, lrGroupSchedule):";
$lrScenario->ManualScheduler->SetScheduleMode($scheduleName, lrGroupSchedule);
#LrManualScheduleMode ->  lrGroupSchedule = 1, lrScenarioSchedule = 0
say "Win32::OLE::LastError: ".Win32::OLE::LastError();

$lrManualScheduleData->{'InitAllBeforeRun'} = 'True';
$lrManualScheduleData->{'DurationMode'} = 1;
$lrManualScheduleData->{'Duration'} = 60 * 60;
$lrManualScheduleData->{'RampupBatchSize'} = 1;
$lrManualScheduleData->{'RampupMode'} = lrRampupByGroupBatches;
$lrManualScheduleData->{'RampupTimeInterval'} = 5;
$lrManualScheduleData->{'RampdownBatchSize'} = 1;   
$lrManualScheduleData->{'RampdownMode'} = lrRampupByGroupBatches;
$lrManualScheduleData->{'RampdownTimeInterval'} = 5;

$rc = $lrScenario->ManualScheduler->{'ScenarioStartTimeMode'} = 0; # Start scenario without delay 

#test
say "$scheduleName: ".$lrScenario->ManualScheduler->Schedule($scheduleName)->{'Duration'}; # returns 300
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:02:39+00:00Added an answer on May 27, 2026 at 11:02 pm

    I have the same problem. Setting those properties and then calling either setschedulemode or setcurrentschedule doesn’t seem to work. The only workaround I have found is to use the setscheduledata method passing in xml. You will need to get the current xml for the scheduledata and then change the xml, passing in the modified xml to the setscheduledata method. Hopefully this helps

    lrManualScheduleData data = engine.Scenario.ManualScheduler.get_Schedule("Schedule 1");
    
    String scheduleXML,errStr;
    
    int returncode = data.getScheduleData(out scheduleXML, out errStr);
    
    // Manipulate the XML to set whatever schedule you want
    
    data.SetScheduleData(scheduleXML, out errStr);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So i'm writing a quick perl script that cleans up some HTML code and
I'm currently writing a Perl program that is to read a given file (either
I'm writing a script in Perl that needs to run at the same time
I'm new to Perl, currently writing a Perl script to automatically fill web forms
I'm writing this Perl script that gets two command line arguments: a directory and
I am currently writing a simple, timer-based mini app in C# that performs an
I'm currently writing a simple .sh script to parse an Exim log file for
Scenario: I'm currently writing a layer to abstract 3 similar webservices into one useable
I'm (re)writing a program that does generic unit test scheduling. The current program is
I'm currently writing a C# console app that generates a number of URLs that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.