Solved

VBScript to auto click a radio button in internet explorer

Posted on 2010-08-31
8
5,822 Views
Last Modified: 2012-05-10
This should be a really simple question.  I have a simple script that opens internet explorer and goes to a website.  

The script puts in a username and password automatically and then clicks submit

The problem im having is that before it clicks submit, I have a option to click 1 of 2 radio buttons.  a "In" and a "Out"   The script works great but unfortunetly the website doesnt work unless I click one of the radio buttons BEFORE hitting submit (action)

Heres what I do know.  The Name of the Radio buttons are both "ClockInOut"  One buttons value is "In" one button is "Out"

Heres the current script I'm using


Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "www.website.com"
IE.Visible = True
Wscript.Sleep 8000
IE.Document.All.Item("LoginID").Value = "loginname"
IE.Document.All.Item("password").Value = "password"
'The line below is the one in question that does not work and where the script error out at. 
IE.Document.All.Item("in").Click
IE.Document.All.Item("Action").Click

Open in new window

0
Comment
Question by:Jeffery Byers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 33569942
IE.Document.All.Item("ClockInOut").Value=True doesn't work?
0
 

Author Comment

by:Jeffery Byers
ID: 33570050
No.  The radio buttons are both named ClockInOut.  One has a value on "In" and one has a value of "out" according to the source of the form.


<form name="frm" action="webclock.asp" method="post" autocomplete="off">
<table border="2" width="400" cellspacing="0" cellpadding="0" align="center">
	<tr>
		<td colspan="2" class="noborderalt" align="center">
			<h2>Web Clock</h2>
		</td>
	</tr>
	<tr>
		<td class="noborderalt" align="right" width="30%"><b>Login ID:</b></td>
		<td class="noborderalt" width="70%"><input style="width:80%;" type="text" name="LoginID" value="" /></td>
	</tr>
	<tr>
		<td class="noborderalt" align="right"><b>Password:</b></td>
		<td class="noborderalt"><input style="width:80%;" type="password" name="Password" value="" /></td>
	</tr>
	
	<tr>
		<td colspan="2" class="noborderalt" align="center">
			<b>Clock In</b> <input type="radio" name="ClockInOut" value="in"  />
			<b>Clock Out</b> <input type="radio" name="ClockInOut" value="out"  />
		</td>
	</tr>
	<tr>
		<td colspan="2" class="noborderalt" align="center">
			<br/>
			<input type="submit" value="Submit" name="Action" onclick="document.frm.Action.disabled=true; document.frm.Action.value='Processing'; document.frm.submit();" />
		</td>

Open in new window

0
 
LVL 6

Expert Comment

by:thiagotietze
ID: 33570143
This "automated" solution is for a mass delivery proposal, or you'll use it only in one machine to automate a task only?
If it is the last option, I can tell you to use iMacros, for Internet explorer or Firefox browsers.

You can simply "record" the actions that you need to perform and schedule iMacros to do it for you...

More information about it:
http://www.iopus.com/imacros/

It have a free, and paid versions...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Jeffery Byers
ID: 33570251
Thanks thiagotietze,

It's only for my personal use, but I'd rather not use a third party program

0
 
LVL 6

Expert Comment

by:thiagotietze
ID: 33570305
Ok, cool. Thanks for the reply.

Just though about it because I had this need few time ago and used it to automate a site acessing.
Another clarification is that iMacros acts as an add-on on both Browsers, so it is easier to deal with, as a third party solution.

Cya ;-)
0
 
LVL 14

Accepted Solution

by:
Psy053 earned 500 total points
ID: 33624353
How about somthing like:
IE.Document.getElementByID("ClockInOut").Click

In my testing, it would select the first radio option. I could then use SendKeys to change it, for example:

Set WSHShell = WScript.CreateObject("WScript.Shell")
IE.Document.getElementByID("ClockInOut").Click
objIE.Document.getElementByID("ClockInOut").Focus()
WShShell.SendKeys "{Left}"
0
 
LVL 14

Expert Comment

by:Psy053
ID: 33751330
Assistance has been provided, however, poster has chosen not to continue with request.

Recommendation: Delete with NO Refund.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Script to copy or move mouse-selected collection of files plus targets referenced by shortcuts (.lnk) The purpose of this article is to help illuminate the real challenges and options available (where they may exist) for utilizing simple scriptin…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question