Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to access properties of a file in the clipboard?

Status
Not open for further replies.

lancer227

Programmer
May 3, 2005
6
ES
Hello,

I'd like to obtain properties such as creation date, length, modification date, etc. from a file in the clipboard.

Is it possible?

Thank you.


 
>... properties ...from a file in the clipboard.
You mean the whole file actually loaded in the clipboard, or do you mean properties of it copied to the clipboard? If it is the former, I doublt even the full-flegded vb cannot. If it is the latter, vbs can use a hack of using an instance of browser to get the data from the clipboard.
 
Hi tsuji,

What I need to do is to get file properties such as modification date, creation date, length, etc...
I don't need to read the content of the file.

I understand by your mail that it is possible.
Could you please tell me how?

Thank you very much!
 
Hi PHV,

Thank you for your answer but I need to read file properies of files stored in the clipboard...

Nevertheless, thanks so much! and thank you for the faq links ;-)
 
This is a very much tempered function to read clipboard text data. Any thing less than a string will return an empty string to make script behaviour well-tempered.
[tt]
s=getcbstring()
wscript.echo s

function getcbstring()
'getcbstring is very much tempered,
'empty string is returned if it is unable to handle data or nothing is there.
set oie=createobject("internetexplorer.application")
oie.navigate "about:blank"
do while oie.readystate<>4 : wscript.sleep 50 : loop
set oclip=oie.document.parentwindow.clipboarddata
on error resume next
sdata=oclip.getdata("text")
if err.number=0 then
if lcase(typename(sdata))="string" then
getcbstring=sdata
else
getcbstring=""
end if
else
getcbstring=""
end if
on error goto 0
set oclip=nothing
oie.quit
set oie=nothing
end function
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top