Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
So I have this localhost website that shows gridview of images that can be downloaded (link button used). I created a batch file and wrote some script to import it in Windows Task Scheduler. It works fine. But now, i'm trying to make the script do the clicking. Currently, it just runs/ open the localhost website.

What I have tried:

Here's my code:
@ECHO OFF
SET BROWSER=chrome.exe
START %BROWSER% - new-tab "http://localhost:7665/AdvGridView.aspx"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
Pause



aspx:
<form id="form1" runat="server">
    <div>
         <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" OnRowCommand="GridView1_RowCommand">
                    <Columns>
                        <asp:BoundField HeaderText="ID" DataField="AdvID" />
                        <asp:BoundField HeaderText="Name" DataField="Name" />
                        <asp:BoundField HeaderText="Item" DataField="Item" />
                        <asp:ImageField HeaderText="Image" DataImageUrlField="ImgPath" ControlStyle-Height="120" ControlStyle-Width="140">
                            <ControlStyle Height="120px" Width="140px"></ControlStyle>
                        </asp:ImageField>
                        <asp:TemplateField HeaderText="View Information">
                            <ItemTemplate>
                                <asp:LinkButton ID="lnkView" runat="server" CommandArgument='<%#Eval("AdvID") %>' OnClick="lnk_OnClick">View</asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="DownloadLink">
                            <ItemTemplate>
                       <asp:Button ID="lnkDownload" runat="server" Text="Download" OnClick="DownloadFile"
                                        CommandArgument='<%# Eval("AdvID") %>' ></asp:Button>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
        <asp:Button ID="btnDownload" runat="server" Text="Download" OnClick="lnk_OnClick" />
Posted
Updated 9-Feb-19 8:07am

1 solution

You're going to have to write an application to load the web site and do the "clicking". There's nothing you can put into a batch file that will click a link.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900