iimGetStopwatch with Perl

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Jussi_S
Posts: 3
Joined: Tue Jan 14, 2014 1:04 pm

iimGetStopwatch with Perl

Post by Jussi_S » Tue Apr 08, 2014 12:43 pm

Hi there,

I am confused how to use iimGetStopwatch with Perl (or other similar language). Some non-VBS example would probably help.
I can get the return value but not the stopwatch ID or measured time.

This kind of VBS example works fine:

Code: Select all

iret = iim1.iimGetStopwatch(3,id,download)
I get the measured time to the variable "download".

But e.g. these do not bring the measured time into a Perl script:

Code: Select all

 $time = $b->iimGetStopwatch(3,$id,$download);
 $time = $b->iimGetStopwatch(3,\$id,\$download);
 $time,$id,$download=$b->iimGetStopwatch(3);
The two first trials do return "1" to variable "$time". This indicates that my macro and call do match. But i cannot get the time.

I would never expect the first trial to return anything to "$download" -but that's the way explained in the reference manual. Second way could work -but it doesn't change the content of "$Download". I guess reference manual is VBS specific. How to use this function with other languages? Also other example (e.g. C#) would probably help me out.

For this trial i have used iMacros v10 on Windows 7. with IE and standalone.

Best regards,

Jussi
Jussi_S
Posts: 3
Joined: Tue Jan 14, 2014 1:04 pm

Re: iimGetStopwatch with Perl

Post by Jussi_S » Wed Apr 09, 2014 1:20 pm

I reply myself. I got it working also with C#, this way variable "time" will store the measured time:

Code: Select all

            object ID;
            object time;
            iMacros.Status stopwatch = app.iimGetStopwatch(3, out ID, out time);
But still, i can't get the measured time returned to my Perl script, no matter how i try. Any ideas are welcome.
tomotello
Posts: 3
Joined: Mon Aug 28, 2017 3:34 pm
Location: Switzerland, Basel

Re: iimGetStopwatch with Perl

Post by tomotello » Mon Sep 11, 2017 12:01 pm

a working approach in perl is to add STOPWATCHTIME to !EXTRACT right after the second STOPWATCH measure point:

Code: Select all

ADD !EXTRACT {{!STOPWATCHTIME}}
if you in addition add the idname itself to the !EXTRACT statement you can later in perl split it into idname,value pairs

Code: Select all

ADD !EXTRACT Firstpage,{{!STOPWATCHTIME}}
Later on in perl assign all STOPWATCH idName,value pairs to a hash to get the values referenced by idnames and not only index numbers:

Code: Select all

# Get extracted values
# Split first id,value pairs from iimGetLastExtract into array
my @stopwatch_arr = split(/\[EXTRACT\]/,$iim1->iimGetLastExtract());

# Now assign id,value pairs to hash for accessing values by ids 
my %stopwatch_hash = ();
for (my $i = 0; $i <= $#stopwatch_arr; $i++ ) {
  my ($idName, $stopwatch_value) = split(',', $stopwatch_arr[$i]);
  $stopwatch_hash{$idName} = $stopwatch_value;
}
Using this approach, I have attached working perl adaptions of the VBS get-response-times scripts from the iMacros distribution (v12).
There are two versions:
1) Without GUI, reporting the output just to the console
2) With GUI message boxes like the VB script versions using the CPAN Prima GUI Toolkit.
The GUI version is also prepared for compiling with perl2exe from Indigostar (pre-compiler statements to include necessary dependencies etc.)
--Tom
Attachments
get-response-times.zip
(4.1 KiB) Downloaded 239 times
Post Reply