471,351 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,351 software developers and data experts.

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

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
5 4079
"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
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
"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
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
"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.

Similar topics

2 posts views Thread by cv | last post: by
1 post views Thread by Manuel | last post: by
3 posts views Thread by Jean-Luc ERNST | last post: by
7 posts views Thread by William Gill | last post: by
reply views Thread by DraguVaso | last post: by
reply views Thread by Mr. Murad Jamal | last post: by
reply views Thread by Curious | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.