[button] paste image from clipboard

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
KozakMak
Senior Member
Senior Member
Posts: 480
Joined: 2021-05-24, 12:39 UTC
Location: UA

[button] paste image from clipboard

Post by *KozakMak »

Hi. I need help with this button :arrow:

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Utils\nircmd.exe
clipboard saveimage %pclipboard.png
shell32.dll,68
paste from clipboard (as .png)
%COMMANDER_PATH%\Utils\

-1
1. name must contain also date-time
2. "cm_Rereadsource" must be pressing manually to show file - is it possible to apply reread automatically?
OS: Win10 | TC: latest x64
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: [button] paste image from clipboard

Post by *Stefan2 »

KozakMak wrote: 2024-06-04, 07:27 UTC Hi. I need help with this button :arrow:

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Utils\nircmd.exe
clipboard saveimage %pclipboard.png
shell32.dll,68
paste from clipboard (as .png)
%COMMANDER_PATH%\Utils\

-1
1. name must contain also date-time
2. "cm_Rereadsource" must be pressing manually to show file - is it possible to apply reread automatically?



 

1.)

Read the help of "nircmd.exe", it has an on command for this:
--------------------------
TOTALCMD#BAR#DATA
"%COMMANDER_PATH%\TOOLs\NirSoft\nircmd.exe"
clipboard saveimage "___ $currdate.yyyyMMdd$ ~$currtime.HHmmss$ _Clipboard .png"
"%COMMANDER_PATH%\TOOLs\NirSoft\NirCmd_Clipboard_Saveimage.ico"
NirCmd clipboard saveimage (ex.: ___20180530-121120_Clipboard.png)|(http://www.nirsoft.net/utils/nircmd.html)


-1
--------------------------






2.)
Create your own user defined command from the code above as f.ex. "em_NirsoftClipboardSaveImage".

usercmd.ini
[em_NirsoftClipboardSaveImage]
cmd="%COMMANDER_PATH%\TOOLs\NirSoft\nircmd.exe"
param=clipboard saveimage "___ $currdate.yyyyMMdd$ ~$currtime.HHmmss$ _Clipboard .png"






Use that UDC in button as "em_NirsoftClipboardSaveImage,cm_Rereadsource".

Or maybe _ _ _ _ _ _ _ "em_NirsoftClipboardSaveImage,CM_WAIT 500,cm_Rereadsource".






More about UDC over there >>> https://ghisler.ch/board/viewtopic.php?p=344777#p344777
Also see there how to create an alias (like f.ex. "si", short for SaveImage) or keyboard shortcut (like CTRL+ALT+X) to execute that UDC.



 
KozakMak
Senior Member
Senior Member
Posts: 480
Joined: 2021-05-24, 12:39 UTC
Location: UA

Re: [button] paste image from clipboard

Post by *KozakMak »

thx!
Stefan2 wrote: 2024-06-04, 08:47 UTC
Use that UDC in button as "em_NirsoftClipboardSaveImage,cm_Rereadsource".
chains works only with buttons? can i used it with [Shortcuts] ?
OS: Win10 | TC: latest x64
User avatar
petermad
Power Member
Power Member
Posts: 16009
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [button] paste image from clipboard

Post by *petermad »

2KozakMak
chains works only with buttons? can i used it with [Shortcuts] ?
You can use chained commands also in shortcuts, but you have to put the chain in a separate em_command in your usercmd.ini file:

for example

Code: Select all

[em_pasteimage]
cmd=em_NirsoftClipboardSaveImage,cm_Rereadsource
and make the chorscut to em_pasteimage
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
funkymonk
Senior Member
Senior Member
Posts: 491
Joined: 2013-12-04, 09:56 UTC

Re: [button] paste image from clipboard

Post by *funkymonk »

Hi!

This is how I do it to save the clipboard content into either an image file or a text file -- depending on what's currently in the clipboard.

Ctrl + C/X/V work as always (of course!).
In addition I have added Ctrl + Y to
  1. paste the clipboard content into a file "YMD - hms - clip.jpg" or "YMD - hms - clip.txt",
  2. jump to the new file, and
  3. do a quick rename to immediately change the name to whatever I need.
In wincmd.ini I put

Code: Select all

[Shortcuts]
C+Y=em_pasteClipboard
In usercmd.ini I have these commands:

Code: Select all

[em_gotoNewestFile]
cmd=cm_SrcByName 8,cm_SrcByDateTime 2,cm_GoToFirstFile,cm_SrcByName 9
menu=Go to newest file

[em_pasteClipboardImg]
button=%COMMANDER_PATH%\WCMICONS.DLL,26
cmd=%COMMANDER_PATH%\tools\nirsoft\nircmd.exe clipboard saveimage ~$currdate.yyyy-MM-dd$" - ~$currtime.HH_mm_ss$ - clip".jpg
menu=Paste clipboard to image using nircmd

[em_pasteClipboardTxt]
button=%COMMANDER_PATH%\WCMICONS.DLL,26
cmd=%COMMANDER_PATH%\tools\nirsoft\nircmd.exe clipboard writefile ~$currdate.yyyy-MM-dd$" - ~$currtime.HH_mm_ss$ - clip".txt
menu=Paste clipboard to text file using nircmd

[em_pasteClipboard]
button=%COMMANDER_PATH%\WCMICONS.DLL,26
cmd=em_pasteClipboardImg, em_pasteClipboardTxt, cm_Wait 300, cm_rereadsource, cm_Wait 300, em_gotoNewestFile, cm_RenameSingleFile
menu=Paste clipboard to image or text file using nircmd

Maybe that helps and inspires for more refinements...

(BTW: em_gotoNewestFile is taken from petermad's "TC Extended Menus". I hope this is ok. Thank you!)
User avatar
petermad
Power Member
Power Member
Posts: 16009
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

[OT] Re: [button] paste image from clipboard

Post by *petermad »

2funkymonk
BTW: em_gotoNewestFile is taken from petermad's "TC Extended Menus". I hope this is ok. Thank you!)
It is fine with me, especially when you do what you did here: renamed the command from my Extended Menu from em_ext_gotonewestfile to em_gotoNewestFile - this way using your command will not interfere when the user is also using my menus (all the up to 555 em_commands in my menus are named em_ext_command for that reason).
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
KozakMak
Senior Member
Senior Member
Posts: 480
Joined: 2021-05-24, 12:39 UTC
Location: UA

Re: [button] paste image from clipboard

Post by *KozakMak »

2funkymonk
cool! thx for sharing.
OS: Win10 | TC: latest x64
User avatar
Vingolf
Junior Member
Junior Member
Posts: 26
Joined: 2023-02-13, 08:17 UTC
Location: Europe

Re: [button] paste image from clipboard

Post by *Vingolf »

funkymonk wrote: 2024-06-04, 16:19 UTC Maybe that helps and inspires for more refinements...
Very Useful 8) :)
Thank you for sharing this button :!:
Post Reply