How to call an imacro with a php page?

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 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
TravelStuff
Posts: 3
Joined: Tue Nov 25, 2008 1:54 pm

How to call an imacro with a php page?

Post by TravelStuff » Tue Nov 25, 2008 2:07 pm

Hi,

Please could you tell me how to call an imacro from within a php page, and how to pass a parameter to it.
E.g.
<?php
$keyword="travel";
// Run a specific imacro called "Keyword-Test.iim", sending through the parameter "$keyword" to it
exit();
?>

Thanks
TravelStuff
Posts: 3
Joined: Tue Nov 25, 2008 1:54 pm

Re: How to call an imacro with a php page?

Post by TravelStuff » Wed Nov 26, 2008 1:08 pm

Hi,

Thanks for the link. I'm not having much luck at the moment though - my page consists of the following code:

<?php
$fso = new COM('Scripting.FileSystemObject');
$fso = NULL;

$iim1 = new COM("imacros");
$s = $iim1->iimInit("-runner");

$s = $iim1->iimSet("-var_mynumber", "2");
$s = $iim1->iimSet("-var_mytext", "test");
$s = $iim1->iimPlay("Wsh-Random");

echo "iimplay=";
echo $s;
echo "extract=";
echo $iim1->iimGetLastExtract;

$s = $iim1->iimExit();
?>

Its trying to use the "Wsh-Random" imacro, which has the following in it:

VERSION BUILD=3341216
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.iopus.com/imacros/demo/v6/f2 ... -entry.asp
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:WebDataEntry ATTR=NAME:FNAME CONTENT={{mynumber}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:WebDataEntry ATTR=NAME:LNAME CONTENT={{mytext}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:WebDataEntry ATTR=NAME:SendButton&&VALUE:Click<SP>to<SP>submit<SP>data

When I run the php script (i.e. by typing http://localhost:30/search-terms/form/test.php into a browser) I'm not getting any imacros window appearing, and I just get the following returned:

iimplay=-4extract=

Any advice on what I'm doing wrong?

Thanks
User avatar
Tech Support
Posts: 4947
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Re: How to call an imacro with a php page?

Post by Tech Support » Wed Nov 26, 2008 11:42 pm

What code is iimInit returning? Note that you must start iimRunner.exe manually before testing this script. Later, when running the final program unattended, the task scheduler can start iimRunner.exe automatically.
TravelStuff
Posts: 3
Joined: Tue Nov 25, 2008 1:54 pm

Re: How to call an imacro with a php page?

Post by TravelStuff » Fri Nov 28, 2008 10:51 am

Sorry - I didn't realise that iimRunner.exe had to be running (I don't think this is made clear enough in the above wikki link or in the page with the php code - perhaps it should be made to stand out a bit better?).

Everything is working fine now,

Many thanks :)
att
Posts: 24
Joined: Tue Aug 19, 2008 2:22 pm

Re: How to call an imacro with a php page?

Post by att » Thu May 14, 2009 1:08 am

I am trying to run the above example
output is
iimplay=1extract=
Can't see anything under extract !

My scripting Imacro edition has expired !, the code pops up a imacro browser but nothing runs !
Is this because it's expired ?

BTW
===
iimRunner.exe is running
How to configure Cisco Routers
www.ittrainingexpert.info
BlackKlaus13
Posts: 1
Joined: Thu Oct 08, 2009 11:07 am

Re: How to call an imacro with a php page?

Post by BlackKlaus13 » Thu Oct 08, 2009 11:09 am

I am trying to run the above example
output is
iimplay=1extract=
Can't see anything under extract !
I also have this problem!

_________________________________________________

Do you need keygen? Download it now!
brandon74
Posts: 1
Joined: Mon Apr 19, 2010 6:43 pm

Re: How to call an imacro with a php page?

Post by brandon74 » Mon Apr 19, 2010 6:49 pm

I have this problem too. I was suggested to go to php tutorials and find the solution there. But I even don't know nothing about php. How can I solve it? Is this can help me? Where I should to look?
send2dawood
Posts: 1
Joined: Mon Sep 02, 2013 12:49 pm

Re: How to call an imacro with a php page?

Post by send2dawood » Mon Sep 02, 2013 12:55 pm

Hi,
I have the same problem.
When i run the following code it gives me the error.
<?php
$iim1 = new COM("imacros");
$s = $iim1->iimInit("-runner");

$s = $iim1->iimSet("-var_keyword", $_GET["keyword"]);
$s = $iim1->iimPlay($_GET["macro"]);

echo "iimplay=";
echo $s;
echo "extract=";
echo $iim1->iimGetLastExtract;

$s = $iim1->iimExit();
?>

Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `imacros': Invalid syntax '...

I am using imacros trial version 9.0.0 , Firefox version 23.0.1 and OS is Windows 8 .
I am here request the support Team for help.




Please help
Thanks
zenoGlitch
Posts: 3
Joined: Fri Nov 26, 2010 5:04 am

Re: How to call an imacro with a php page?

Post by zenoGlitch » Sun Sep 22, 2013 11:20 pm

send2dawood wrote:Hi,
I have the same problem.
When i run the following code it gives me the error.
<?php
$iim1 = new COM("imacros");
$s = $iim1->iimInit("-runner");

$s = $iim1->iimSet("-var_keyword", $_GET["keyword"]);
$s = $iim1->iimPlay($_GET["macro"]);

echo "iimplay=";
echo $s;
echo "extract=";
echo $iim1->iimGetLastExtract;

$s = $iim1->iimExit();
?>

Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `imacros': Invalid syntax '...

I am using imacros trial version 9.0.0 , Firefox version 23.0.1 and OS is Windows 8 .
I am here request the support Team for help.




Please help
Thanks
Are you using the imacros firefox plugin?
Image
Post Reply