Playing macro from editor doesn't work?

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
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
Post Reply
Corbin
Posts: 5
Joined: Tue Mar 09, 2021 6:15 pm

Playing macro from editor doesn't work?

Post by Corbin » Tue Mar 09, 2021 6:44 pm

VERSION BUILD=12.6.505.4525, enterprise trial version
Windows 10
Internet Explorer version 11.1198.18362.0

I am trying to upload a file, I recorded a macro that selects a button on the webpage. I recorded this macro, using automatic mode. This opens a search window, where the file to be uploaded is found/selected. This works fine when I run it from the sidebar, but does not work when ran from the editor. (Other macros when played from editor work fine). When ran from the editor it opens the search window, and immediately closes it, where as with the sidebar it stays open. It does the same thing in the iMacros browser. I can't use any other web browsers, because this website doesn't work with them. I also tried using direct screen, and the same result occurs. The webpage requires a login, and I can't think of a similar one to post here. The upload demo works fine too. Not sure why it would work this way, any ideas? Maybe something with ONDIALOG canceling out of it?


VERSION BUILD=12.6.505.4525
TAB T=1
TAB CLOSEALLOTHERS
'SET !PLAYBACKDELAY 0.00
URL GOTO=http://jbpco92prod.corp.local/jde/E1Men ... =PROTECTED
FRAME NAME=e1menuAppIframe
TAG POS=1 TYPE=INPUT:BUTTON ATTR=NAME:browseButt
FRAME F=0
TAG POS=1 TYPE=DIV ATTR=ID:menutitle
Attachments
imacrosupload.PNG
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: Playing macro from editor doesn't work?

Post by Tom, Tech Support » Wed Mar 10, 2021 9:48 am

Hi Corbin,

Would you please post a screenshot of what the "search window" looks like, thanks!
Regards,

Tom, iMacros Support
Corbin
Posts: 5
Joined: Tue Mar 09, 2021 6:15 pm

Re: Playing macro from editor doesn't work?

Post by Corbin » Wed Mar 10, 2021 2:09 pm

Tom, Tech Support wrote:
Wed Mar 10, 2021 9:48 am
Hi Corbin,

Would you please post a screenshot of what the "search window" looks like, thanks!
This is what comes up when you press "browse", probably has a better name than search window... Although when played using the editor, and not the sidebar, it opens for a fraction of a second.
Attachments
searchwindow.PNG
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: Playing macro from editor doesn't work?

Post by Tom, Tech Support » Thu Mar 11, 2021 9:02 am

Okay, so it's a typical file selection dialog. In most cases, iMacros can handle these types of file-upload fields and you can find an example in the demo Upload macro included with iMacros and also available in the wiki.

We need to know what the HTML is for the text field where the selected file is displayed on that form. You can either try recording a click on that field to see if a TAG command gets recorded for it, or otherwise inspect the HTML yourself. If it is a typical <input type="file"> element then it should be no problem to automate.

It's also possible that the Browse button may be the element we want to target, so you can also try something like:

Code: Select all

TAG POS=1 TYPE=INPUT:BUTTON ATTR=NAME:browseButt CONTENT=<full path to file>
Of course, replacing <full path to file> with the actual path and name of the file you want to upload.
Regards,

Tom, iMacros Support
Corbin
Posts: 5
Joined: Tue Mar 09, 2021 6:15 pm

Re: Playing macro from editor doesn't work?

Post by Corbin » Thu Mar 11, 2021 3:33 pm

I got the demo working, using the file-upload field to upload my document to https://demo.imacros.net/Automate/FileUploadDemo . If I click into the text field by the browse button, it wont let me type anything. Here is the HTML for the text field and button. The other fields will allow me to edit and change them ("Sheet1", and "A1"). This code works in the iMacros browser and in the ie sidebar, but when played from the editor it opens the file selection dialog for a fraction of a second and then immediatley closes it. Here is the code I used, adding the content with file path didn't result in it being submitted either. (I did replace the file path, using <SP> instead of spaces).

VERSION BUILD=12.6.505.4525
TAB T=1
TAB CLOSEALLOTHERS
'SET !PLAYBACKDELAY 0.00
URL GOTO=http://jbpco92prod.corp.local/jde/E1Men ... =PROTECTED
FRAME NAME=e1menuAppIframe
TAG POS=1 TYPE=INPUT:BUTTON ATTR=NAME:browseButt CONTENT=<full path to file>
FRAME F=0
TAG POS=1 TYPE=DIV ATTR=ID:menutitle
Attachments
&quot;Worksheet name: Sheet1&quot; field
"Worksheet name: Sheet1" field
worksheet.PNG (5.66 KiB) Viewed 3946 times
Browse button and file-upload field
Browse button and file-upload field
html.PNG (7.89 KiB) Viewed 3946 times
Corbin
Posts: 5
Joined: Tue Mar 09, 2021 6:15 pm

Re: Playing macro from editor doesn't work?

Post by Corbin » Thu Mar 11, 2021 4:15 pm

Alright I figured it out (partly). The iMacros recording didn't find the file-upload field, but looking at the html code it shows what needs to be changed in my code to find it. It correctly puts the file path into the text box, but when I actually try to "export the data" it doesn't find the correct file like it should. The html code has two inputs, do I need to do something with the button too?

VERSION BUILD=12.6.505.4525
TAB T=1
TAB CLOSEALLOTHERS
'SET !PLAYBACKDELAY 0.00
URL GOTO=http://jbpco92prod.corp.local/jde/E1Men ... =PROTECTED
FRAME NAME=e1menuAppIframe
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:expImpFileName CONTENT=<full path to file>
FRAME F=0
TAG POS=1 TYPE=DIV ATTR=ID:menutitle
Corbin
Posts: 5
Joined: Tue Mar 09, 2021 6:15 pm

Re: Playing macro from editor doesn't work?

Post by Corbin » Thu Mar 11, 2021 8:17 pm

Sorry for all the posts, should have waited to have just one... I found a way around my issue. If I use the direct screen way of clicking on the button it opens the file search window, and if I have no code after it, it stays open. I then call a different macro to input the file path into the open upload window, and then press enter to upload it. Splitting up the macro is not a problem, since it is being called from a VBA script with other macros anyway. I'm sure there is a better way of doing this, but it is working so I will not complain. Thanks for all the help!

So first macro, with just the direct screen info. This is located at the very bottom:

'Click the file upload button
DS CMD=CLICK X=510 Y=274
DS CMD=KEY CONTENT=<file path>


Then a second macro that actually puts in the information and sends enter command, located at the top:

DS CMD=KEY CONTENT=<file path>
DS CMD=KEY CONTENT={ENTER}
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: Playing macro from editor doesn't work?

Post by Tom, Tech Support » Fri Mar 12, 2021 8:56 am

I was hopeful that the TAG command on the Browse button would have done the trick, as I have seen that work in other similar situations. But I am glad to hear you found a way to do it using DirectScreen. That is one of the advantages of using the iMacros Professional / Enterprise editions - you have more options available to you for getting things done in various scenarios!

Thanks for following up and posting your solution here, no worries about the number of posts!
Regards,

Tom, iMacros Support
Post Reply