How to use with C# can't find adequate information

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
danny98752
Posts: 1
Joined: Sat Apr 06, 2013 2:30 pm

How to use with C# can't find adequate information

Post by danny98752 » Mon Apr 08, 2013 8:19 am

Hello,
I would like to integrate imacros into my c# application.
I spent all day looking around the net but all i found was examples in other programming languages. I could only find a few lines of code on the wiki manual which I couldn't understand (maybe because I'm a beginner programmer). The c# examples that were included with the download only seem to show mulit threading. That's great but I really need to know how to pass variables from my C# program to imacro and have imacro return values to my program. I have seen the examples in c++ and VB but I don't understand what is going on because its not C#.
Can someone please direct me to a tutorial or example in c# which shows how to send values to imacro, start the macro and have the values returned?
Equinox
Posts: 1
Joined: Wed Mar 13, 2013 1:55 am

Re: How to use with C# can't find adequate information

Post by Equinox » Fri Sep 20, 2013 3:24 am

Initialize iMacros:
iMacros.AppClass imApp = new iMacros.AppClass();
iMacros.Status imStatus;
int timeout = 60;

Invoke iMacros:
imStatus = imApp.iimOpen("", true, timeout);
imStatus = imApp.iimPlayCode("URL GOTO=" + url, timeout);

For passing value and get data I do it like this.
example I need to increment the POS value on each tag and extract the text:

List<string> extractedData = new List<string>();
for(int i = 1; i <= 5; i++)
{
imStatus = imApp.iimPlayCode("TAG POS=" + i + " TYPE=SPAN ATTR=CLASS:NAME EXTRACT=TXT", timeout);
string data = imApp.iimGetLastExtract(1);
extractedData.Add(data );
}
Tom, Tech Support
Posts: 3527
Joined: Mon May 31, 2010 4:59 pm

Re: How to use with C# can't find adequate information

Post by Tom, Tech Support » Mon Sep 23, 2013 10:36 am

Danny,

For passing variable values to your macro, use iimSet. To retrieve extracted values from your macro back into your program code, use iimGetExtract. These work the same regardless of the language you are calling them from.
Regards,

Tom, iMacros Support
chivracq
Posts: 8719
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to use with C# can't find adequate information

Post by chivracq » Tue Jul 10, 2018 8:21 pm

Some kind of Follow-up on this Thread by some New User... who preferred to post/open their Thread on SOF:
- How can I control IMacros using c#?
SJ10 wrote: I have been searching all over the internet and found only a few examples of how to send commands to Imacros, however, nobody has posted the way to actually use the examples. For instance,

"Initialize iMacros:"

Code: Select all

iMacros.AppClass imApp = new iMacros.AppClass();
iMacros.Status imStatus;
int timeout = 60;
"Invoke iMacros:"

Code: Select all

imStatus = imApp.iimOpen("", true, timeout);
imStatus = imApp.iimPlayCode("URL GOTO=" + url, timeout);
"For passing value and get data I do it like this. example I need to increment the POS value on each tag and extract the text:"

Code: Select all

List<string> extractedData = new List<string>();
for(int i = 1; i <= 5; i++)
{
imStatus = imApp.iimPlayCode("TAG POS=" + i + " TYPE=SPAN ATTR=CLASS:NAME EXTRACT=TXT", timeout);
string data = imApp.iimGetLastExtract(1);
extractedData.Add(data );
}
- by Equinox on Thu Sep 19, 2013 8:24 pm
https://forum.imacros.net/viewtopic.php?t=20665

I cant get any of these lines of code to work, and I am not sure what I need to be using; and I don't know what to reference.

Do I need a special version of Imacros? Currently using the browser extension which I think is the problem, but even still, if I were to use the correct version, does anyone know what I need to be using;?

P.S. the issue is that I cant even access imacros with C#, please be mindful of this before marking this as duplicate.
... With one Reply/Answer:
Nic Endo wrote:
I need a special version of Imacros? Currently using the browser extension which I think is the problem
Exactly. This will only work with the commercial version of iMacros, which includes a C# interface. If you just installed the browser extension, this is not there at all and there is no way to talk to it from C#.

iMacros for Chrome used to have a free command line (similar to this), but looks like this is gone as well in the free version.
Hum..., this @'Nic Endo' User is a bit of a "fake" User (for iMacros...!), ah-ah...!, as they answer since several months practically all iMacros Threads on SOF... (and now + 1 more User doing exactly the same since a few weeks), to each time only redirect them to the 'Kantu' Browser, tja...! :roll:

But OK, they are correct anyway about needing the 'Scripting Interface' to control iMacros from 'C#', only included in the Commercial 'iMacros Enterprise' Edition...

And Users/Customers with a License for the 'iMacros Enterprise' Edition have direct Access to TechSupport, so there is indeed not much "Expertise" on the (iMacros) Forum as those Qt's/Threads never reach the Forum actually, where it's more Users helping Users, mostly among Users using the Free Add-ons for FF/IE/CR... :oops:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply