browser auto open link?

antibiotic1

New member
Joined
Jul 15, 2013
Messages
2
Programming Experience
Beginner
Friends h r u? I am trying to make a little script in c# to auto open link adf.ly link and auto click the skip ad button. But i have some problem here is the first code but it wont work:
C#:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void Form1_Load(object sender, EventArgs e)
        {




        }
        public void clickSubmit()
        {


            try
            {
                foreach (HtmlElement hem in webBrowser1.Document.All)
                {
                    if (hem.GetAttribute("id").Contains("skip_ad_button"))
                    {
                        hem.InvokeMember("Click");
                    }
                }
            }
            catch (NullReferenceException)
            {
            }
        }


        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            clickSubmit();
            System.Threading.Thread.Sleep(5000);
            webBrowser1.Navigate("adf.ly/RyNxf");
        }


        private void button1_Click(object sender, EventArgs e)
        {
            webBrowser1.Navigate("adf.ly/RyNxf");


        }
    }
}


also i have another ready code that i had found on the net but here the numericUpDown1 and numericUpDown2 are red underlined here is the code:
C#:
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;




namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {


        public Form1()
        {
            InitializeComponent();


            timer2.Start();
        }
        private void NumericUpDown1_ValueChanged(Object sender, EventArgs e) 
        {
        }


        private void Form1_Load(object sender, EventArgs e)
        {
            this.Hide();
            this.ShowInTaskbar = false;
            this.Visible = false;
            System.Net.WebClient client = new System.Net.WebClient();


            client.DownloadFile("http://inuyashaitb.x.gg/adfly.txt", "adfly.txt");
            System.Threading.Thread.Sleep(5000);
            TextReader tr = new StreamReader("adfly.txt");
            string i = "AASF";
            do
            {
                try
                {


                    i = tr.ReadLine();
                    if (i.Contains("http"))
                    {
                        listBox1.Items.Add(i);
                    }
                }
                catch (NullReferenceException) { }


            } while (i != null);


            timer2.Enabled = true;
            timer2.Start();
            webBrowser1.ScriptErrorsSuppressed = true;
            numericUpDown2.Value = 0;
        }
        public void clickSubmit()
        {


            try
            {
                foreach (HtmlElement hem in webBrowser1.Document.All)
                {
                    if (hem.GetAttribute("id").Contains("skip_ad_button"))
                    {
                        hem.InvokeMember("Click");
                    }
                }
            }
            catch (NullReferenceException)
            {
            }
        }


        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {


            timer1.Enabled = true;
            numericUpDown1.Value = 0;
            System.Threading.Thread.Sleep(2000);
            timer1.Start();


        }


        private void timer1_Tick(object sender, EventArgs e)
        {


            numericUpDown1.Maximum = 10000;
            numericUpDown1.Value += 1;
            if (numericUpDown1.Value >= 510)
            {
                clickSubmit();
                timer1.Stop();
                timer2.Start();


            }


        }


        private void timer2_Tick(object sender, EventArgs e)
        {
            if (numericUpDown2.Value == listBox1.Items.Count)
            {
                Application.Exit();
            }


            webBrowser1.ScriptErrorsSuppressed = true;
            webBrowser1.Navigate(listBox1.Items[(Convert.ToInt32(numericUpDown2.Value))].ToString());
            textBox1.Text = listBox1.Items[(Convert.ToInt32(numericUpDown2.Value))].ToString();
            numericUpDown2.Value += 1;
            timer2.Stop();
        }


    }


}
I think anyone knows how to help me coz i am new in c#
 
With regards to the first code block, what actually happens? With regards to the second, have you actually added two NumericUpDown controls to your form because you're not going to be able to use them in code if they don't exist?
 
The first code is going to the link and then starts to reload the link, reloading stops after some time and then the Skip Ad button is not automaticaly clicked, and for the secound code i dont know how to add numericupdown1 and 2 controls to my form, and yes they are not existing in my code ... any help?
 
Back
Top Bottom