Results 1 to 1 of 1
2007-03-12, 14:23 #1
- Join Date
- Nov 2001
- Melbourne, Victoria, Australia
- Thanked 0 Times in 0 Posts
Graphic file contents to Clipboard
I've been toying with a way to send the contents of a graphic file to the clipboard, without the need to (manually) open the file in an application and use Edit -> Copy. It's been harder than I thought, but I found a way to do it using the free IrfanView program - <post#=637,872>post 637,872</post#>. The program itself, as well as the Windows Scripting Host I think, lack the ability to track and close just a specific instance. The upshot is lots of windows to close manually or the other extreme - all instances closed with each copy operation. In desperation I turned to another free favourite - AutoIt.
This simple script seems to do the trick:
Dim $Program, $PID
if $CmdLine > 0 Then
$Program = "C:Program FilesIrfanViewi_view32.exe " & $CmdLine & " /clipcopy"
$PID = Run($Program, "", @SW_HIDE)
If $PID Then ProcessClose($PID)
This works for IrfanView in the folder shown above. I've compiled a copy (176KB) and uploaded to http://397.port5.com/Pic2Clip.exe. You can put it on the desktop and drag & drop to it, and/or you can create a shortcut to it in your "Send To" folder (name it "Clipboard as Picture" or similar) then
o right-click graphic file
o select Send To
o click your shortcut ("Clipboard as Picture")
The picture will then be on the clipboard ready for pasting. If anybody wants this, but has IrfanView in a folder other than the default above, give a scream and I'll compile a version to suit. I've found no problems*, but I'd appreciate any bug reports.
* I did have to introduce a small "sleep" time (100ms) due to delay in IView doing its thing. If you're really quick with your paste, you might beat the clipboard! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>