So – I’m using an image capture tool (snagit).
By default, the image itself is saved to the clipboard (after a capture).
I would prefer that the image’s path stored in the clipboard.
The application allows me to (instead) save the file, and pass the image as an argument to an external application. I’m passing it to the following .vbs file:
Dim Clipboard
Set args = WScript.Arguments
if args.length > 0 then
arg1 = trim(args.Item(0))
else
arg1 = "(No Data)"
end if
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "cmd /C echo "&arg1&" | CLIP", 2
This does 99% of what I want, except I find that ‘ECHO … | CLIP’ tends to append formfeed/carriage return chars to my string.
Is there a better command I can use (in either cmd/vbs)?
Thanks in advance.
I seriously doubt your code produces
<formfeed><carriage return>on the clipboard. It should produce<carriage return><line feed>at the end. Those are the standard line termination characters on Windows. They are automatically added by theECHOcommand.You can write to stdout without the new line using
<NUL SET /P "=message"I don’t understand why you are using VBS when it can’t access the clipboard directly. It makes more sense to me to use a batch file.
or as a one line batch file:
If you really want to use VBS, then here it is