Sign in to follow this  
VISQI

Urgent matter

Recommended Posts

VISQI    113
How ya' doin', people i wanted to on how can create a program in c++ to ask the user input a set of numbers, and then i copy them to the browser to autofill some designated forms( i.e: name, age .....) i really need it to complete my program and i don't know how to do it P.S: iam still learning in c++

Share this post


Link to post
Share on other sites
Assuming the Web page you need to fill in is actually on a site and not just local...

The simplest way to do it is to just launch the browser with a constructed URL in which you pass the parameters (a GET request):

http://www.example.com/foo.bar?name=John+Smith&age=22


Make foo.bar a CGI script that generates the form. If you are using PHP, for example, it might look like this:


<html>
<head>
...
</head>
<body>
...
<form action="submit.php" method="post">
<input type="text" name="name" value="<?php echo $_GET['name']; ?>"/>
<input type="text" name="age" value="<?php echo $_GET['age']; ?>"/>
...
<input type="submit" value="Submit"/>
</form>
...
</body>
</html>


This generates a form with whatever <input> fields you want and fills the fields with the appropriate values captured from the URL.

Make sure you take URL encoding into account if you have special characters in your input, and replace spaces with plus signs.

Share this post


Link to post
Share on other sites
VISQI    113
actually this is not what i meant, i meant that is there a way to copy the the text to the clipboard or something and then when the user clicks on the beginning of the form, it will automatically fill it

it should behave exactly like this macro but i want to implement it in c++

var WshShell = WScript.CreateObject("WScript.Shell")

WScript.Sleep(1000);
WshShell.SendKeys("John Doe");
WshShell.SendKeys("{TAB}");
WshShell.SendKeys("22");
WshShell.SendKeys("Male");
WshShell.SendKeys("aaa@aaa@aaa.com");


my friend made this one in javascript, if u can also tell me how did he do it, i will heavily appreciate it.

Share this post


Link to post
Share on other sites
Spynacker    106
Hm sounds to me that you are trying to do some
bot who will fill forms for you.
Make sure this is legal!

For the jscript part I do not know the context but I
think if it is written in jscript it should be embedded
into the site with the form in it.
For this reason it is simple to get access to the fields.
I do not know if there is an interface in your browser that
allows other programs to control it. If there is one than you
have to read its manuals.
If not, this would be very complicated.
Another possibility would be to write your own "browser" that
will fill in the form for you.

Share this post


Link to post
Share on other sites
matchu    142
You could look into GreaseMonkey it's a javascript engine that allows you to run javascript on a page without being part of the page. You can script it so when a certain page loads, it autofill the form. This plugin is for Firefox, but i think someone told me it also exists for chrome and/or safari.

Hope that helps!

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