Use iMacros to automate pressing a button when it appears?
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
Use iMacros to automate pressing a button when it appears?
Here's an example of what I'm trying to do.
On a website, a button will appear on the page. It won't always be there. How could I use iMacros to do this:
Refresh a page until it xan click a button. When it can, it would click the button as well as another one that would appear after it.
Thanks!
On a website, a button will appear on the page. It won't always be there. How could I use iMacros to do this:
Refresh a page until it xan click a button. When it can, it would click the button as well as another one that would appear after it.
Thanks!
-
- Posts: 1483
- Joined: Tue Jan 26, 2010 11:35 am
Re: Use iMacros to automate pressing a button when it appear
Hi
I think the easiest thing to do would be to:
1. Run the macro in a loop
2. Ignore errors (SET !ERRORIGNORE YES)
3. Try pressing the buttons
If the button isn't there, the macro will just continue to the next iteration.
Of course you could also use iMacros Scripting.
Best regards,
I think the easiest thing to do would be to:
1. Run the macro in a loop
2. Ignore errors (SET !ERRORIGNORE YES)
3. Try pressing the buttons
If the button isn't there, the macro will just continue to the next iteration.
Of course you could also use iMacros Scripting.
Best regards,
Daniel, iOpus Support
Re: Use iMacros to automate pressing a button when it appear
Thanks. I had a script written in VBScript to do it, but I'm not sure how to click something without using coordinates.
The syntax for iMacros doesn't seem too difficult to make the program. Could I make it click the button without entering the coordinates of where the mouse should click? I want to only enter the button name in HTML instead.
I couldn't record the macro while the button isn't there, right?
Thanks again.
The syntax for iMacros doesn't seem too difficult to make the program. Could I make it click the button without entering the coordinates of where the mouse should click? I want to only enter the button name in HTML instead.
I couldn't record the macro while the button isn't there, right?
Thanks again.
-
- Posts: 1483
- Joined: Tue Jan 26, 2010 11:35 am
Re: Use iMacros to automate pressing a button when it appear
Hi,
Well, there are 2 options:
1. You can try to catch the moment when the button is there and record it with iMacros, or view the source and put the button name (or id) into iMacros manually, or just try to use the text on the button:
2. You can also use the coordinates (if you're using iMacros Browser or IE) by using the DirectScreen Commands:
http://wiki.imacros.net/DirectScreen_Technology
Example:
Best regards,
Well, there are 2 options:
1. You can try to catch the moment when the button is there and record it with iMacros, or view the source and put the button name (or id) into iMacros manually, or just try to use the text on the button:
Code: Select all
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=VALUE:TEXT_ON_THE_BUTTON_GOES_HERE
http://wiki.imacros.net/DirectScreen_Technology
Example:
Code: Select all
DS CMD=CLICK X=411 Y=434
Daniel, iOpus Support
Re: Use iMacros to automate pressing a button when it appear
Thanks again.
Because I'm not familiar with the iMacros syntax, here's the general idea of what I want to do. Could you convert the code to something that would work in iMacros? Should be fairly simple and hopefully well-commented.
SET !ERRORIGNORE YES -- ignore errors
while true do -- loop the code
NavigateTo: WebsiteNameHere.com -- load/refresh the website
if (Button_Name_Here) == nil then return end -- if the button isn't there, *keep looping*
else LeftClick:Button_Name_Here -- clicks the button if it is there
LeftClick:Button_Number_Two -- clicks a button that appears after the 1st is clicked
break loop -- stop the loop from running agin
end
Because I'm not familiar with the iMacros syntax, here's the general idea of what I want to do. Could you convert the code to something that would work in iMacros? Should be fairly simple and hopefully well-commented.
SET !ERRORIGNORE YES -- ignore errors
while true do -- loop the code
NavigateTo: WebsiteNameHere.com -- load/refresh the website
if (Button_Name_Here) == nil then return end -- if the button isn't there, *keep looping*
else LeftClick:Button_Name_Here -- clicks the button if it is there
LeftClick:Button_Number_Two -- clicks a button that appears after the 1st is clicked
break loop -- stop the loop from running agin
end
-
- Posts: 1483
- Joined: Tue Jan 26, 2010 11:35 am
Re: Use iMacros to automate pressing a button when it appear
Hi,
All you have to do is write the code on the scripting/programming language of your choice and call the following macro in the loop:
This macro tries to click the first button, if its not there, the error is ignored, if its there, the button get's clicked and the 2nd one gets clicked in one second too.
To run the macro from your code have a look at these 2 wiki articles:
http://wiki.imacros.net/iimInit
http://wiki.imacros.net/iimPlay
Basically these 2 commands (iimInit and iimPlay) are the only ones you'll need to run the macro from your code.
Best regards,
All you have to do is write the code on the scripting/programming language of your choice and call the following macro in the loop:
Code: Select all
SET !ERRORIGNORE YES
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=VALUE:TEXT_ON_THE_BUTTON_GOES_HERE
WAIT SECONDS 1
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=VALUE:TEXT_ON_THE_SECOND_BUTTON_GOES_HERE
To run the macro from your code have a look at these 2 wiki articles:
http://wiki.imacros.net/iimInit
http://wiki.imacros.net/iimPlay
Basically these 2 commands (iimInit and iimPlay) are the only ones you'll need to run the macro from your code.
Best regards,
Daniel, iOpus Support
Re: Use iMacros to automate pressing a button when it appear
Thank you very much, the code you posted looks great. But wouldnit repeatedly refresh the page?
-
- Posts: 1483
- Joined: Tue Jan 26, 2010 11:35 am
Re: Use iMacros to automate pressing a button when it appear
Hi,
Not unless you add a URL GOTO statement. So I suggest you 1st go to that page and then run the macro.
Best regards,
Not unless you add a URL GOTO statement. So I suggest you 1st go to that page and then run the macro.
Best regards,
Daniel, iOpus Support
Re: Use iMacros to automate pressing a button when it appear
following this I cannot get it to click on a button with the following text on it.
"Click to Re-submit" without the quotes.
is the - throwing it off? can I use a wildcard? like "Click*" or something like that??
Thanks
"Click to Re-submit" without the quotes.
is the - throwing it off? can I use a wildcard? like "Click*" or something like that??
Thanks
-
- Posts: 1483
- Joined: Tue Jan 26, 2010 11:35 am
Re: Use iMacros to automate pressing a button when it appear
Hi,
Could you please post your full macro or tell me where I can see that submit button?
Thanks,
Could you please post your full macro or tell me where I can see that submit button?
Thanks,
Daniel, iOpus Support
Re: Use iMacros to automate pressing a button when it appear
So this is a form that I fill out with time slots. then I click continue with this
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:Update ATTR=NAME:submit&&VALUE:Continue
I get the second page that has the "Click to Re-Enter" button on it that I need to click with the below HTML info.
<input type="button" value="Click to Re-Enter" onClick="history.go(-1)" id="button2" style="color: maroon; font-size: 10pt; font-weight: bold" name="button2"><br>
this is the HTML code for that button. when I try to use this in iMacros it doesnt work
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=VALUE:"Click to Re-Enter"
with or without the quotes.
using the ID does work
TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:button2
But i need to catch the button by the text on it.
there is also another button that will randomly pop up on this page that I need to press IF it exists and this one is by TEXT as well and that one says "CLICK TO ACCEPT" and NOT click on the "Click to Re-Enter" button
THanks
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:Update ATTR=NAME:submit&&VALUE:Continue
I get the second page that has the "Click to Re-Enter" button on it that I need to click with the below HTML info.
<input type="button" value="Click to Re-Enter" onClick="history.go(-1)" id="button2" style="color: maroon; font-size: 10pt; font-weight: bold" name="button2"><br>
this is the HTML code for that button. when I try to use this in iMacros it doesnt work
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=VALUE:"Click to Re-Enter"
with or without the quotes.
using the ID does work
TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:button2
But i need to catch the button by the text on it.
there is also another button that will randomly pop up on this page that I need to press IF it exists and this one is by TEXT as well and that one says "CLICK TO ACCEPT" and NOT click on the "Click to Re-Enter" button
THanks
Re: Use iMacros to automate pressing a button when it appear
and then LOOP it. reading on looping now
I need something external to loop the script right?
I need something external to loop the script right?
Re: Use iMacros to automate pressing a button when it appear
any ideas on searching for the text? maybe it doesn't work because it has a - in it?
Re: Use iMacros to automate pressing a button when it appear
ok so searching for text on buttons with <sp> in them works on firefox but NOT chrome. so my workaround is use firefox. bug report on chrome
Thanks
Thanks