help: combine several iim into one in java
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
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
-
- Posts: 15
- Joined: Tue Feb 23, 2010 2:06 pm
help: combine several iim into one in java
Hi,
I have different iim and I need it all to be combined.
I have iim1 to log into a website, iim2 to run a script x amount of times, and iim3 to log off the website.
Basically I'm trying to:
1) Log into a website
2) Run 2nd iim x amount of times
3) log out of website
Can someone help me create a javascript that lets me run it automatically?
the part 2 is kind of tricky because I want to be able to specify how many times the script repeats. (Currently I'm doing this by selecting "Repeat Macro" on the Macro window, but I want the java to be able to do it automatically)
So is it possible to contain all the 3 into one javascript? I'm very new to Java, in fact don't know anything at all. If you can specify what does what so I can learn it also myself, that'll be awesome!
Thank you for any help!
I have different iim and I need it all to be combined.
I have iim1 to log into a website, iim2 to run a script x amount of times, and iim3 to log off the website.
Basically I'm trying to:
1) Log into a website
2) Run 2nd iim x amount of times
3) log out of website
Can someone help me create a javascript that lets me run it automatically?
the part 2 is kind of tricky because I want to be able to specify how many times the script repeats. (Currently I'm doing this by selecting "Repeat Macro" on the Macro window, but I want the java to be able to do it automatically)
So is it possible to contain all the 3 into one javascript? I'm very new to Java, in fact don't know anything at all. If you can specify what does what so I can learn it also myself, that'll be awesome!
Thank you for any help!
-
- Posts: 1483
- Joined: Tue Jan 26, 2010 11:35 am
Re: help: combine several iim into one in java
Hello,
I recommend that your read this article on Firefox JavaScript Scripting Interface.
So, basically you play a macro with iimPlay(), you set variables for a macro with iimSet() (prior to playing it!), you get the last value a macro extracted with iimGetLastExtract() and if a macro returned an error, you check it with iimGetLastError(). All of these commands are explained in the abovementioned article.
You would do task 1 by running a macro that does the login from JavaScript, task 2 can be accomplished by using JavaScript prompt() function and then playing the macro in a loop. Task 3 - run another macro that does the logout. You have a few JavaScript files with your installation of iMacros. You could use them as code examples.
Here is one of them:
Best regards,
I recommend that your read this article on Firefox JavaScript Scripting Interface.
So, basically you play a macro with iimPlay(), you set variables for a macro with iimSet() (prior to playing it!), you get the last value a macro extracted with iimGetLastExtract() and if a macro returned an error, you check it with iimGetLastError(). All of these commands are explained in the abovementioned article.
You would do task 1 by running a macro that does the login from JavaScript, task 2 can be accomplished by using JavaScript prompt() function and then playing the macro in a loop. Task 3 - run another macro that does the logout. You have a few JavaScript files with your installation of iMacros. You could use them as code examples.
Here is one of them:
Code: Select all
//imacros-js:showsteps no
// With the imacros-js:showsteps command you can tell iMacros to show or
// not show the Javascript commands during the execution.
// Showing steps is useful for debugging, but adds an artificial delay to each step.
// This command overrides the global settings in the Option Dialog.
// Note that the command is *inside* a comment "//", since it is no
// official Javascript command and is used in the iMacros JS interpreter only.
// There can be only one such command per JS file and it affects the complete file.
var i, s;
iimDisplay ("Test script running");
iimSet ("NAME", "T. Test");
iimSet ("MENU", "Pizza");
iimSet ("DRINK", "water");
iimSet ("DESSERT", "Fruits");
iimSet ("IS_CUSTOMER", "Yes");
iimSet ("PASSWORD", "abcabc");
iimSet ("REMARKS", "Form filled");
iimSet ("WAIT", "3");
i = iimPlay("SI-Test-Macro1",60);
/* Check for error */
if (i < 0) {
s = iimGetLastError();
alert (s);
};
/* Submission completed, now check if the result page is ok */
/* We do this by checking if the ordered menu is indeed "Pizza" */
iimDisplay ("Verify form output");
i = iimPlay("SI-Test-Macro2",60);
if (i < 0) {
s = iimGetLastError();
alert (s);
};
s = iimGetLastExtract();
if (s.indexOf ("Pizza") != -1)
iimDisplay ("Test OK");
else
iimDisplay ("Problem detected :"+s);
Daniel, iOpus Support
-
- Posts: 15
- Joined: Tue Feb 23, 2010 2:06 pm
Re: help: combine several iim into one in java
Hi Daniel,
As always thank you so much for your help.
I've created a simple javascript that works surprisingly enough:
What I want to do is put in a code to repeat "mainiimscript" 90 times.
Am I able to set that option in javascript? If not, are there other ways I can do this?
As always thank you so much for your help.
I've created a simple javascript that works surprisingly enough:
Code: Select all
i = iimPlay("loginiimscript");
i = iimPlay("mainiimscript");
i = iimPlay("logoutiimscript")
Am I able to set that option in javascript? If not, are there other ways I can do this?
Re: help: combine several iim into one in java
Hi, i need a simmilar script,
java script should
start Macro1
LOOP Macro2
Start Macro3
Start Macro4
start Macro1
LOOP Macro2
Start Macro3
Start Macro4
in an other post i found this as loop, can i combine the 2 samples ?
retcode = iimPlay("macro1");
for (i = 0; i < 90; i++) {
retcode = iimPlay("macro2");}
retcode = iimPlay("macro3");
java script should
start Macro1
LOOP Macro2
Start Macro3
Start Macro4
start Macro1
LOOP Macro2
Start Macro3
Start Macro4
in an other post i found this as loop, can i combine the 2 samples ?
retcode = iimPlay("macro1");
for (i = 0; i < 90; i++) {
retcode = iimPlay("macro2");}
retcode = iimPlay("macro3");
-
- Posts: 15
- Joined: Tue Feb 23, 2010 2:06 pm
Re: help: combine several iim into one in java
OMG you just helped me do what I wanted! Thank you!SFU666 wrote: in an other post i found this as loop, can i combine the 2 samples ?
retcode = iimPlay("macro1");
for (i = 0; i < 90; i++) {
retcode = iimPlay("macro2");}
retcode = iimPlay("macro3");
But my macro2 is unique, pulling data from each line of .csv file.
Would you happen to know how I can make it loop but also extract new data from each rows everytime? Basically I have this on the iim
Code: Select all
SET !DATASOURCE_LINE {{!LOOP}}
Thank you so much!
-
- Posts: 1483
- Joined: Tue Jan 26, 2010 11:35 am
Re: help: combine several iim into one in java
Daniel, iOpus Support
Re: help: combine several iim into one in java
May you post your source code when it worked for you, i dont get mine to open Imacros ...
Code: Select all
<script type="text/javascript">
retcode = iimPlay("#Current");
for (i = 0; i < 90; i++) {
retcode = iimPlay("aaaaaneu");}
retcode = iimPlay("aaajanine");
retcode = iimPlay("macro4");
retcode = iimPlay("macro5");
</script>
Re: help: combine several iim into one in java
or could it be that this is not possible in the firefox version ? i dont get it to work ...
Code: Select all
var i, retcode,
retcode = iimPlay("macro1");
Re: help: combine several iim into one in java
Ok, works now thx
Code: Select all
iimPlay("Login 1",60)
for( var i=0; i<2; i++)
{
iimPlay("StudiLOOP",60)
}
iimPlay("Logout",60)
-
- Posts: 1483
- Joined: Tue Jan 26, 2010 11:35 am