Author |
Topic |
|
lyttmonkey
8 Posts |
Posted - 09/13/2013 : 04:10:46
|
when selecting a folder, and mouse gestures down, paste the contents of the clipboard to this folder |
|
breakcore
Russia
74 Posts |
Posted - 09/13/2013 : 06:45:37
|
quote: Originally posted by lyttmonkey
when selecting a folder, and mouse gestures down, paste the contents of the clipboard to this folder
acSendKeys("{ENTER}{Delay 300}^v{Delay 100}{BACKSPACE}") |
Edited by - breakcore on 09/13/2013 06:46:44 |
|
|
lyttmonkey
8 Posts |
Posted - 09/13/2013 : 07:55:20
|
quote: Originally posted by breakcore
quote: Originally posted by lyttmonkey
when selecting a folder, and mouse gestures down, paste the contents of the clipboard to this folder
acSendKeys("{ENTER}{Delay 300}^v{Delay 100}{BACKSPACE}")
There is a condition, I just wrote half. Otherwise just "^v". The point is how to judge the focuse and paste into the folder without opening that folder just like the "paste" in the right click menu when clicking on the folder. |
|
|
Rob
USA
2615 Posts |
Posted - 09/13/2013 : 09:13:00
|
Without invoking the right-click menu on the folder, you cannot easily paste into it. Windows is handling that behind the scenes, when you right-click a folder and click Paste, it knows the folder you selected.
This could be accomplished programmatically, but I don't think you're likely to be successful via Lua (nor is it worth the effort, I'm sure). The only quick way I was able to emulate was by sending SHIFT+F10 (to bring up the right-click menu) and sending the appropriate number of arrow keys (or letter P) to select the Paste menu item, then send ENTER. However, it's not very reliable nor consistent as different selected items will invoke menus with slightly different options.
breakcore's solution is about as close as you'll get without getting very creative...and spending a lot of time for a small gain. |
|
|
lyttmonkey
8 Posts |
Posted - 09/13/2013 : 10:09:42
|
quote: Originally posted by Rob
Without invoking the right-click menu on the folder, you cannot easily paste into it. Windows is handling that behind the scenes, when you right-click a folder and click Paste, it knows the folder you selected.
This could be accomplished programmatically, but I don't think you're likely to be successful via Lua (nor is it worth the effort, I'm sure). The only quick way I was able to emulate was by sending SHIFT+F10 (to bring up the right-click menu) and sending the appropriate number of arrow keys (or letter P) to select the Paste menu item, then send ENTER. However, it's not very reliable nor consistent as different selected items will invoke menus with slightly different options.
breakcore's solution is about as close as you'll get without getting very creative...and spending a lot of time for a small gain.
appreciate your last word. but isn't there a way to judge the focus? |
|
|
Rob
USA
2615 Posts |
|
breakcore
Russia
74 Posts |
Posted - 09/13/2013 : 12:27:41
|
lyttmonkey For that kind of stuff I recommend you to get "Directory Opus" - an alternative to windows explorer. When combined with S+ it becomes the best piece of software ever made. |
Edited by - breakcore on 09/13/2013 12:29:04 |
|
|
Cerberus
Netherlands
86 Posts |
Posted - 10/17/2013 : 14:11:02
|
You can do it with Cautomaton: it allows you to execute the actions behind context menus on files, but from the command line. The actual menu is not used. http://whitehat.dcmembers.com/pages/software/cautomaton.php So a command line like this will copy a file to clipboard as if you had right-clicked on it and selected "copy":
D:\Programs\Cautomaton (0.9.0)\cautomaton32.exe /v Copy "C:\Documents and Settings\user\Desktop\Test.txt" With Autohotkey, you can analyse whether or not you have a file selected in Windows Explorer. I have written a little script for Autohotkey that uses Cautomaton, and it should do what you want. If you create a mouse gesture that sends alt-control-shift-win-V, the script will does its thing every time that hotkey is received by the system. http://www.autohotkey.com/
So you need to install Autohotkey, paste the code below into a text file in Notepad, save it as Paste.ahk (or whatever name you prefer), and then execute Paste.ahk. Then it will be active in the background.
You also need to download Cautomaton and have Cautomaton32.exe (or cautomaton64.exe) somewhere on your hard drive. You need to change the directory in the Autohotkey script to point to the right directory, where Cautomaton is. You might also want to remove the "Sleep 500" line from the Autohotkey script, then it will go quicker.
You can also remove the line "^!#+v" from the script if you don't want to have it running in the background; in that case, you have to make your mouse gesture run/execute the Paste.ahk file in Just Gestures instead of sending a hotkey. It might be slightly quicker if the script remains active in the background, but it shouldn't matter much. Good luck!
----------------------------------------------------------------------------------------
!^+#v:: ;; When you hit alt-control-shift-win-V, the commands below are triggered.
Sleep 500 ;; Remove this long sleep if the hotkey is triggered by a mouse gesture:
;; it should only be needed if you type the hotkey by hand.
Sleep 50
Send {control up}{alt up}{rwin up}{shift up}
ClipSave := ClipboardAll ;; This saves whatever you have on your clipboard for later.
Clipboard := ""
Send {control down} ;; Copy (control-C) whichever item you have selected in order to get the path of a folder, if present.
Sleep 50
Send c
Sleep 50
Send {control up}
FilePath := Clipboard ;; Here we take the path of the selected item from the clipboard in order to analyse it (folder or not?).
FileGetAttrib, Attributes, %FilePath%
If Instr(Attributes, "D") ;; If the selected item is a folder/directory, execute "paste" from the right-click menu, using Cautomaton.
{
Clipboard := ClipSave
Run, D:\Programs\Cautomaton (0.9.0)\cautomaton32.exe /v paste `"%FilePath%`", , Hide ;; Replace the part before
;; "cautomaton32.exe" with the location of your Cautomaton file.
}
Else ;; Do normal paste action, control-V.
{
Sleep 50
Send {control down}
Sleep 50
Send v
Sleep 50
Send {control up}
}
Sleep 100
Return |
Edited by - Cerberus on 10/17/2013 14:21:06 |
|
|
|
Topic |
|
|
|