-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Utilize clipboard contents as well as set them. #129
Comments
Thank you for your interest in Shell Anything. Could you elaborate on different use case that you have in mind ? Most use cases can now be implemented using a custom plugin. For example: reading the clipboard and using the value in Visibility / Validity fields such as exprtk attribute, istrue attribute or isfalse attribute can be implemented as a plugin. When the selection changes, the plugin reads the clipboard as text and set the |
Well as an example, and how I noticed this wasn't possible, was when writing a menu item to automatically install github repos from a context menu, I'm creating extensive menus to help with github/python/pip management as I'm working with ML a lot, example: At the moment I use CopyQ but I do a lot of cut and pasting so it helps to have a good tool with history, especially since I can pin things to it, and I often have to give out support info for SD.Next. If you check here you'll see what I've worked up just for that so far to make things easier on the less knowledgeable users that want to use stable diffusion. The advanced clipboard tools aren't that important other than providing potentially hundreds of saved contents, but ${clip} would be useful, since there's already a method to write to it. Love ShellAnything btw! Saved my entire idea from being relegated to the recycle bin! |
I think that your concern for such a feature is legitimate. However, I feel that creating a "permanent" If I do implement this feature, it would be as a "plugin" so that people implicitly specify to use this feature. I would also need to add a warning of something similar to let people know that clipboard content may end up in a log file. I have looked at your example configuration file and noticed that you do not seem to require to use You could modify your actions to
For example: <actions>
<exec path="cmd.exe" arguments="/C powershell get-clipboard>"${temp}\clipboard.txt"" />
<exec path="cmd.exe" arguments="/C set /p "GITURL="<"${temp}\clipboard.txt" && git clone "%GITURL%" . && python -m venv venv && venv\scripts\activate.bat && pip install -r requirements.txt" />
</actions> (note, I did not tried this but it should be working). If the exec command gets too complicated, move it to a batch file and simply call the batch file from ShellAnything. I hope this is actually helping. |
My apologies for the delayed response! Yes, actually it is helping! In fact I've started doing a little coding in vscode so I might just look at doing an extension though if it's not too difficult, thankfully there's tons of AI assistance around these days! A lot of my new menus are for using AI tools, even firing up llama.cpp and feeding it a prompt with one click. (actually can't recall if I ever finished this) <menu name="LLM">
<menu name="Explain-Doc Code">
<actions>
<exec path="cmd.exe" arguments="/K pushd && copy H:\explain-code-prompt.txt+${selection.path} explaincode-${selection.filename.noext}.tmp && H:\Apps\llama.cpp-clblast\main.exe -m %INSTRUCT_MODEL1% --prompt-cache llmcache --mirostat 2 --color -ins --keep 10000 -ngl 500 -c 32768 --temp 0.5 -f "explaincode-${selection.filename.noext}.tmp"" />
</actions>
</menu>
</menu> Though I am wondering if the text input box and string length could be bigger, I created a menu item to execute edge-tts but the length of what I can put in is limited by Shellanything's small area for text since it's just a little strip rather than something more like a text input area. Example for edge-tts: <menu name="Edge-TTS">
<actions>
<prompt name="texttospeech" title="Enter tts:" />
<prompt name="filename" title="Enter filename:" />
<exec path="cmd" arguments="/c edge-tts -t "${texttospeech}" --rate=-15% -v en-GB-MaisieNeural --write-media "h:\tmp\edge-tts-dump\${filename}.mp3"" />
</actions>
</menu> Also curious what you think about adding in more than just "yesno" and "ok" as buttons? Or potentially allowing shellanything to execute python code as a plugin? that would vastly expand it's abilities. |
Hi there, Idk if you already knew but there is a "Windows Clipboard" integrated from WIn10. To call it the shortcut is "Win+V". I know that it is basic. Maybe you can re-use that API for your purposes with ShellAnything. Also you can complement your clipboard developing using advanced commands with this repo https://github.com/Slackadays/Clipboard Regards. |
Yes, actually I did find Clipboard not too long after I originally wrote this, but I do appreciate your helpfulness, if I hadn't, it would be just the thing! I haven't had a chance to get back into things and test it, much less integrate it with my menus, sadly. This was originally just a sort of no-brainer FR, as only setting the clipboard and not reading it seemed... half done. |
I am not ready to give up on this requested feature. I said previously that it seems like a legitimate use case. I also think that positive feedback and positive criticism should be considered. I still need to figure out a way to implement this. My main concern is about security. I do not want to leak a password in the logs or something like that. One idea that I am exploring is to bind this feature with #109. For example, only when verbose logging would be enabled that full "property change events" would be logged. TODO:
Also... @Aptronymist, your issue about the input prompt:
is now fixed in #127. |
Crap, I'm sorry, I didn't even mean to close it! Those buttons seem particularly enticing to my mouse cursor for some reason! |
…d interface in the core. Created an implementation that matches the current clipboard management code in sa.windows.dll. Implemented `clipboard` property to reference current clipboard content. The property name is `clipboard` to match existing `<clipboard>` action. #129
…d documentation. Created new unit tests. #129
@arathburgos05 Could you clarify your idea about the new Windows Clipboard in Windows 10 ? From what I see, it is not a new "Clipboard API". It is a clipboard history where the latest values of the clipboard are saved. They can quickly be restored using "Win+V" and clicking on an element. Using the "old" (a.k.a. legacy win32 api) are producing new entries in the clipboard history. I have enabled the history feature on my side and ran ShellAnything's unit tests. There are probably functions to query the history. For example get the previous clipboard entry instead of the last (current) one. I could implement special properties to access the history. For example, the property Regarding https://github.com/Slackadays/Clipboard, I think the product is mainly targeted for console/terminal usage. There might be some API that I could use to set/get values to this application. However, this would create a hard dependency to Slackadays/Clipboard for ShellAnything. I do not ideally think this would be appropriate. As of today, the latest commit d02fe6a from branch feature-issue129 provide a generic clipboard interface for setting/getting values in/out of any clipboard implementations. I could create a special clipboard implementation that delegate this task to external executables. For example Waiting for your clarifications. |
Hello, from my side I shared the Windows Clipboard just like possible stuff that could be useful. I read all the thread again, certainly I neither see a useful case use about checking the last n-elements (only the first one is useful to see but not the others). Windows Clipboard is a useful tool for me to check and re-use the last n-elements copied. It also works with pictures and it keeps the format of specific text (like bold, color, size, etc.). I don't think that ShellAnything and Windows Clipboard can be merged or integrated together. I only shared it to access the last n-elements copied in a normal usage. I agree about accessing/reading the last element copied in ShellAnything. Also I saw your workaround using PoweShell and I think that is a good way to solve the requested feature by @Aptronymist I'll be reading the new comments of this thread but for the moment i don't have anything to share/support. Good job as always 👍 |
* feature-issue129: * Fixed issue #129: Utilize clipboard contents as well as set them. Renamed "Dynamic Properties" to "Live Properties" for clarity. Updated documentation. Created new unit tests. #129 Added "Service" postfix to App::Set/GetRegistry() and Set/GetLogger(). Add a comment in IWhatEverService interface declarations that it is required to keep the core decoupled from something. #134 #137 Decoupled clipboard management from sa.core.dll: created an IClipboard interface in the core. Created an implementation that matches the current clipboard management code in sa.windows.dll. Implemented `clipboard` property to reference current clipboard content. The property name is `clipboard` to match existing `<clipboard>` action. #129
The feature is implemented and integrated into the master branch. You can now use the clipboard's content with the You can safely copy/paste password or secure values in the clipboard without risking ShellAnything to leak the value in the logs. The content shall not be printed in the logs unless you use To be clear, it is compatible with Windows Clipboard History feature. If you enable Sync across devices (sharing), ShellAnything will have access to text copied from another device. If a user presses Win+V and click on a previous entry, ShellAnything will have access to this previous entry through |
Is your feature request related to a problem? Please describe.
There's a way to put data into the clipboard, but no way to read the clipboard and use the values in it inside the menus, such as strings of text that were copied, or even file/directory paths, of file contents, such as a .jpg image.
Describe the solution you'd like
create ${clip} that accesses the current clipboard contents. Potentially this could interact with the windows 10+ multi-entry clipboard history as well, or other more complex clipboard replacements such as Ditto or CopyQ (which I use).
The text was updated successfully, but these errors were encountered: