Jump to content

Accessing clipboard binary data


Deeto

Recommended Posts

Hi all, long time lurker / new poster here. I've been bashing my head against the wall trying to figure out how to do something, and I'm hoping this community can point me in the right direction. Here's the situation:I manage a technical pre-sales team at a software company. I recently built an ASP (not .NET) based Forum for the team to use to collaborate on projects, how-to's, etc. The Forum supports rich media - image, file, video, etc attachments. I have a separate upload component I'm using and all that is working great.You Forum junkies know that adding images to your posts can sometimes be an arduous task. First you take a screenshot using PrintScreen. Then open MS Paint or Photoshop and paste the image in. Then save to the filesystem somewhere. Then (finally) browse to the file location to attach the image to your forum post. If you have multiple images to post, this can become an overwhelmingly time consuming process. Ok, I'm not telling you anything you don't already know here.With that said, is there ANY way to enable an IE browser in a trusted LAN environment to access the binary data in the clipboard buffer? I'd like to have some kind of control grab the binary image data from the clipboard, save it locally to the file system on the client as an image, then have my upload component upload it to the server for inclusion in the user's post. I'd like all of this to happen programmatically. I'm pretty good with Java Script, very good with VBScript and VB, but don't know .NET at all. Loading an ActiveX or COM object in the browser is OK - as I said these are all trusted machines on a LAN.Problem is I haven't been able to figure out ANY way to do this without buying some custom app (EXE) that needs to be manually installed locally to each client machine. I want to avoid this.So, any thoughts on how this could be done? Client-side, Server-side - it doesn't matter to me. I appreciate any advice or thoughts you might have.Thanks!Dave

Link to comment
Share on other sites

http://stackoverflow.com/questions/128463/...d-from-vbscriptI think that thread has every you need.It's a major security threat if clipboard data were accessible, I'm not a VBscript guy but it's common sense in a MS point of view. If you read the thread a guy suggests using MS word's clipboard to achieve his goal.
To avoid the security warnings associated with Internet Explorer and clipboard access, I would recommend you use the Word application object and its methods to put your data onto the clipboard. Of course you can only use this on a machine that has MS Word installed, but these days that's most of them. (*In spite of the fact that you asked for stuff on a 'clean' system :) *)
' Set what you want to put in the clipboard 'strMessage = "Imagine that, it works!"' Declare an object for the word application 'Set objWord = CreateObject("Word.Application")' Using the object 'With objWord   .Visible = False			 ' Don't show word '   .Documents.Add			   ' Create a document '   .Selection.TypeText strMessage   ' Put text into it '   .Selection.WholeStory		' Select everything in the doc '   .Selection.Copy			  ' Copy contents to clipboard '   .Quit False				  ' Close Word, don't save ' End With

You can find detail on the MS Word application object and its methods here: http://msdn.microsoft.com/en-us/library/aa...office.11).aspx

Edit: This is a VB topic not JavaScript.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...