I am trying to paste clipboard contents to a file with the following code:
When this code is executed, I receive Hello One which means that contents are not assigned to sclpbrdtxt and test.txt remains blank.
If I assign a manual string for testing:
I receive Hello Two and test.txt file gets This is testing 123.
Code:
<%
Dim sclpbrdtxt,fso,fr
Const ForReading = 1, ForWriting = 2
with createobject("internetexplorer.application")
.navigate "about:blank"
sclpbrdtxt=.document.parentwindow.clipboarddata.getdata("text")
.quit
end with
Set fso = CreateObject("Scripting.FileSystemObject")
Set fr = fso.OpenTextFile("d:\test.txt", ForWriting, True)
'sclpbrdtxt="This is testing 123"
if isnull(sclpbrdtxt) then
Response.Write "Hello One"
else
Response.Write "Hello Two"
end if
'fr.WriteLine(sclpbrdtxt)
'fr.close
%>
When this code is executed, I receive Hello One which means that contents are not assigned to sclpbrdtxt and test.txt remains blank.
If I assign a manual string for testing:
Code:
<%
Dim sclpbrdtxt,fso,fr
Const ForReading = 1, ForWriting = 2
with createobject("internetexplorer.application")
.navigate "about:blank"
sclpbrdtxt=.document.parentwindow.clipboarddata.getdata("text")
.quit
end with
Set fso = CreateObject("Scripting.FileSystemObject")
Set fr = fso.OpenTextFile("d:\test.txt", ForWriting, True)
sclpbrdtxt="This is testing 123"
if isnull(sclpbrdtxt) then
Response.Write "Hello One"
else
Response.Write "Hello Two"
end if
fr.WriteLine(sclpbrdtxt)
fr.close
%>
I receive Hello Two and test.txt file gets This is testing 123.