?
Solved

Need help on this Q...

Posted on 2007-08-12
7
Medium Priority
?
238 Views
Last Modified: 2010-03-05
Hi,

The question is of my interest.If any one can help me implement it.

http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_21458513.html?sfQueryTermInfo=1+ad+script

I have put the code to a filename.hta file.When i run it i get an error.

Regards
Sharath
0
Comment
Question by:bsharath
  • 4
  • 3
7 Comments
 
LVL 12

Expert Comment

by:netsmithcentral
ID: 19680395
We need to know the error your getting to be of any assistance...
0
 
LVL 11

Author Comment

by:bsharath
ID: 19681107
Line 33
Char 1
Object does not support this char or method
0
 
LVL 12

Expert Comment

by:netsmithcentral
ID: 19685313
Alright, when the script was originally written it looks like it had a namespace violation.  Here's the fix:

<script language="JavaScript">
var olContactItem = 2;

function contact( FirstName, LastName, bizPhone, Email, Company, JobTitle )
{
  this.FirstName = FirstName;
  this.LastName  = LastName;
  this.bizPhone  = bizPhone;
  this.Email     = Email;
  this.Company   = Company;
  this.JobTitle  = JobTitle;
}

function saveContact( obj )
{
  /* Create the Outlook Object and Contact Item */
  var out = new ActiveXObject( "Outlook.Application" );
  var con = out.CreateItem( olContactItem );

  /* Transfer the data */
  con.FirstName = obj.FirstName;
  con.LastName  = obj.LastName;
  con.BusinessTelephoneNumber = obj.bizPhone;
  con.Email1Address = obj.Email;
  con.CompanyName = obj.Company;
  con.JobTitle = obj.JobTitle;
 
  /* Save the data */
  con.Save();
}
</script>

<a href="#" onclick='var newContact = new contact("John", "Doe", "(555) 555-5555", "jdoe@test.com", "Company",
"Title");saveContact( newContact );return false;'>Add Contact for John Doe</a>
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!

 
LVL 11

Author Comment

by:bsharath
ID: 19685436
Hi,

If you can understand this script can you tell me what this will do please...
0
 
LVL 12

Expert Comment

by:netsmithcentral
ID: 19685713
Sure.  The script creates an Outlook contact, then saves it.  The data is as defined in this line:

var newContact = new contact("John", "Doe", "(555) 555-5555", "jdoe@test.com", "Company", "Title");
0
 
LVL 11

Author Comment

by:bsharath
ID: 19685831
I get a windows which has this data

Add Contact for John Doe

Where will it save and for what can i use this.

What i thought was i can send this trough mail and when the user clicks it his contact will be added to a file.?

Is this what this can do?
0
 
LVL 12

Accepted Solution

by:
netsmithcentral earned 2000 total points
ID: 19686449
The script will save the contact info into the program "Microsoft Office Outlook", on the contacts page.  It will do this ONLY IF it is run from the local computer (otherwise you would have a security violation).  Most e-mail programs will NOT run the script if you e-mail it out to other people.  The recipient of your message must manually add your contact info in this case.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
Suggested Courses

809 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