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
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:


Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

iimGetStopwatch with Perl

by Jussi_S on Tue Apr 08, 2014 5:43 am

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);

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,

Posts: 3
Joined: Tue Jan 14, 2014 6:04 am

Re: iimGetStopwatch with Perl

by Jussi_S on Wed Apr 09, 2014 6:20 am

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.
Posts: 3
Joined: Tue Jan 14, 2014 6:04 am

Re: iimGetStopwatch with Perl

by tomotello on Mon Sep 11, 2017 5:01 am

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

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

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.)
(4.1 KIB) Downloaded 95 times
Posts: 3
Joined: Mon Aug 28, 2017 8:34 am
Location: Switzerland, Basel

Return to Command Line and Scripting Interface

Who is online

Users browsing this forum: Majestic-12 [Bot] and 5 guests