Sign in to follow this  
Followers 0
ToyBoi

How to Press Button IE button and await download

5 posts in this topic

Hi everyone, the problem I have today involves pressing an "Export" button on a website

Posted Image

When the export button is clicked, a pop up will open asking where to save the file, but that I will deal with later

Posted Image

Here is the related source code

<div id="form_subdiv" class="form_cell_label">
                  <input class="form_submit" type="button" name="report_submit" value="Build" onclick="document.chart_data.report_csv.value='false';document.chart_data.submit();" />
                  <input class="form_submit" type="hidden" name="report_csv" value="false" />
                  <input class="form_submit" type="button" name="csv_submit" value="Export" onclick="document.chart_data.report_csv.value='true';document.chart_data.submit();" />
                </div>

            </td>
          </tr>
        </table>
<table width=225><tr><td><td><tr></table>
      </form>

I tried IE clicklink by text but it doesn't work, and I didn't think it would anyways, since the button is more of an object than a text.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi everyone, the problem I have today involves pressing an "Export" button on a website

When the export button is clicked, a pop up will open asking where to save the file, but that I will deal with later

Here is the related source code

<div id="form_subdiv" class="form_cell_label">
                  <input class="form_submit" type="button" name="report_submit" value="Build" onclick="document.chart_data.report_csv.value='false';document.chart_data.submit();" />
                  <input class="form_submit" type="hidden" name="report_csv" value="false" />
                  <input class="form_submit" type="button" name="csv_submit" value="Export" onclick="document.chart_data.report_csv.value='true';document.chart_data.submit();" />
                </div>

            </td>
          </tr>
        </table>
<table width=225><tr><td><td><tr></table>
      </form>

I tried IE clicklink by text but it doesn't work, and I didn't think it would anyways, since the button is more of an object than a text.

The onclick scripting might not run if you just use _IEAction() with "click". Instead look at Example 2 under _IEAttach() _IEAction(). Get a reference to the input tag object, give it focus and ControlSend "{ENTER}" to it.

:)

Edit: Dumb typo.

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

The onclick scripting might not run if you just use _IEAction() with "click". Instead look at Example 2 under _IEAttach(). Get a reference to the input tag object, give it focus and ControlSend "{ENTER}" to it.

:)

thanks for the tip, i didn't use IE attach though, because when I tried to run the example it gave me an error. Anyways I used IEgetObjbyname to get a reference for the button, which has a name. I then gave it focus and sent the enter key like you said :)

$oForm = _IEGetObjByName ($oIE, "report_submit")
_IEAction ($oForm, "focus")
Send  ("{ENTER}")

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

thanks for the tip, i didn't use IE attach though, because when I tried to run the example it gave me an error. Anyways I used IEgetObjbyname to get a reference for the button, which has a name. I then gave it focus and sent the enter key like you said :)

$oForm = _IEGetObjByName ($oIE, "report_submit")
_IEAction ($oForm, "focus")
Send  ("{ENTER}")
The _IEAttach() reference was a dumb typo on my part. I meant Example 2 from _IEAction(), which looks something like what you have here, though you get only a reference to the Form and not to the input tag for the button. Does the smiley face mean it worked for you?

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

The _IEAttach() reference was a dumb typo on my part. I meant Example 2 from _IEAction(), which looks something like what you have here, though you get only a reference to the Form and not to the input tag for the button. Does the smiley face mean it worked for you?

:)

ya it worked great! your tip really helped a lot.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0