By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,874 Members | 1,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,874 IT Pros & Developers. It's quick & easy.

Copy filepath to clipboard & paste it in outlook. How?

P: n/a
Hello All

I am creating an ASP page. There are a list of filename and checkbox
next to it. When user checked all the documents they want and click
ADD TO CLIPBOARD button. All filepaths will be copied into clipboard
and then they can right-click -> paste into MS Outlook as attachments.

How can I use clipboardData.setData function to do that? I saw a lot
of examples they are just copy and paste text.

Thanks
Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"tabonni" <ta*****@yahoo.com> wrote in message
news:fb**************************@posting.google.c om...
Hello All

I am creating an ASP page. There are a list of filename and checkbox
next to it. When user checked all the documents they want and click
ADD TO CLIPBOARD button. All filepaths will be copied into clipboard
and then they can right-click -> paste into MS Outlook as attachments.

How can I use clipboardData.setData function to do that? I saw a lot
of examples they are just copy and paste text.

Thanks


Will this help? Watch for word-wrap.

<html>
<head>
<title>Clipper.htm</title>
<script type="text/javascript">
function checks() {
var form = document.form1;
var what = "";
for (var i=0; i<form.files.length; i++) {
if (form.files[i].checked) {
what += form.files[i].value + "\n";
}
}
alert("Clipboard = \n\n" + what);
window.clipboardData.setData("Text", what)
}
</script>
</head>
<body>
<form name="form1">
<br><input type="checkbox" name="files" value="c:\temp\file1.txt"> file1
<br><input type="checkbox" name="files" value="c:\temp\file2.txt"> file2
<br><input type="checkbox" name="files" value="c:\temp\file3.txt"> file3
<br><input type="button" value="Clipboard" onclick="checks()">
</form>
</body>
</html>
Jul 23 '05 #2

P: n/a
But, when I paste it into outlook. It is not a real file, just text
c:/Temp/file1.txt.

How can I copy the file and paste the real document in outlook? It is
like insert attachments in outlook?

cheers

"McKirahan" <Ne**@McKirahan.com> wrote in message news:<ax%Zc.119792$mD.80881@attbi_s02>...
"tabonni" <ta*****@yahoo.com> wrote in message
news:fb**************************@posting.google.c om...
Hello All

I am creating an ASP page. There are a list of filename and checkbox
next to it. When user checked all the documents they want and click
ADD TO CLIPBOARD button. All filepaths will be copied into clipboard
and then they can right-click -> paste into MS Outlook as attachments.

How can I use clipboardData.setData function to do that? I saw a lot
of examples they are just copy and paste text.

Thanks


Will this help? Watch for word-wrap.

<html>
<head>
<title>Clipper.htm</title>
<script type="text/javascript">
function checks() {
var form = document.form1;
var what = "";
for (var i=0; i<form.files.length; i++) {
if (form.files[i].checked) {
what += form.files[i].value + "\n";
}
}
alert("Clipboard = \n\n" + what);
window.clipboardData.setData("Text", what)
}
</script>
</head>
<body>
<form name="form1">
<br><input type="checkbox" name="files" value="c:\temp\file1.txt"> file1
<br><input type="checkbox" name="files" value="c:\temp\file2.txt"> file2
<br><input type="checkbox" name="files" value="c:\temp\file3.txt"> file3
<br><input type="button" value="Clipboard" onclick="checks()">
</form>
</body>
</html>

Jul 23 '05 #3

P: n/a
"tabonni" <ta*****@yahoo.com> wrote in message
news:fb**************************@posting.google.c om...
But, when I paste it into outlook. It is not a real file, just text
c:/Temp/file1.txt.

How can I copy the file and paste the real document in outlook? It is
like insert attachments in outlook?

cheers


[snip]

You originally asked that "All filepaths will be copied into clipboard";
"c:/Temp/file1.txt" is a filepath.

To copy all files checked into the clipboard, try:

<html>
<head>
<title>file0.htm</title>
<script type="text/javascript">
function checks() {
var form = document.form1;
var j = 0;
var list = new Array;
var what = "";
//
for (var i=0; i<form.files.length; i++) {
if (form.files[i].checked) {
list[j++] = form.files[i].value;
what += "\n" + form.files[i].value;
}
}
alert("Clipboard List =\n" + what);
window.clipboardData.setData("Text", what)
what = "";
//
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
for (var k=0; k<list.length; k++) {
var oOTF = oFSO.OpenTextFile(list[k],1);
var sOTF = oOTF.ReadAll();
what += "\n" + sOTF;
}
alert("Clipboard Data =\n" + what);
window.clipboardData.setData("Text", what)
}
</script>
</head>
<body>
<form name="form1">
<br><input type="checkbox" name="files" value="c:\temp\file1.txt"> file1
<br><input type="checkbox" name="files" value="c:\temp\file2.txt"> file2
<br><input type="checkbox" name="files" value="c:\temp\file3.txt"> file3
<br><input type="button" value="Clipboard" onclick="checks()">
</form>
</body>
</html>

Be aware that you will get a security warning as FSO is an ActiveX control.

Also, there is a limit to how much data can be placed into the clipboard.
Jul 23 '05 #4

P: n/a
It doesn't work. After I checked the files and clicked the Clipboard
button, I tried to paste it in MS outlook. However, files cannot be
pasted. And, the outlook message and the html page (containing
checkboxes and button one) are not responding.

By the way, how can I copy and paste PDF Files?

I should clarify everything in the beginning. Sorry.

Cheers
"McKirahan" <Ne**@McKirahan.com> wrote in message news:<X3j_c.27457$3l3.13092@attbi_s03>...
"tabonni" <ta*****@yahoo.com> wrote in message
news:fb**************************@posting.google.c om...
But, when I paste it into outlook. It is not a real file, just text
c:/Temp/file1.txt.

How can I copy the file and paste the real document in outlook? It is
like insert attachments in outlook?

cheers


[snip]

You originally asked that "All filepaths will be copied into clipboard";
"c:/Temp/file1.txt" is a filepath.

To copy all files checked into the clipboard, try:

<html>
<head>
<title>file0.htm</title>
<script type="text/javascript">
function checks() {
var form = document.form1;
var j = 0;
var list = new Array;
var what = "";
//
for (var i=0; i<form.files.length; i++) {
if (form.files[i].checked) {
list[j++] = form.files[i].value;
what += "\n" + form.files[i].value;
}
}
alert("Clipboard List =\n" + what);
window.clipboardData.setData("Text", what)
what = "";
//
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
for (var k=0; k<list.length; k++) {
var oOTF = oFSO.OpenTextFile(list[k],1);
var sOTF = oOTF.ReadAll();
what += "\n" + sOTF;
}
alert("Clipboard Data =\n" + what);
window.clipboardData.setData("Text", what)
}
</script>
</head>
<body>
<form name="form1">
<br><input type="checkbox" name="files" value="c:\temp\file1.txt"> file1
<br><input type="checkbox" name="files" value="c:\temp\file2.txt"> file2
<br><input type="checkbox" name="files" value="c:\temp\file3.txt"> file3
<br><input type="button" value="Clipboard" onclick="checks()">
</form>
</body>
</html>

Be aware that you will get a security warning as FSO is an ActiveX control.

Also, there is a limit to how much data can be placed into the clipboard.

Jul 23 '05 #5

P: n/a
"tabonni" <ta*****@yahoo.com> wrote in message
news:fb**************************@posting.google.c om...
It doesn't work. After I checked the files and clicked the Clipboard
button, I tried to paste it in MS outlook. However, files cannot be
pasted. And, the outlook message and the html page (containing
checkboxes and button one) are not responding.
It works if they're ".txt" files.
By the way, how can I copy and paste PDF Files?
You can't.
I should clarify everything in the beginning. Sorry.

Cheers

Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.