Jump to content

OS X selection in Clipboard History


Recommended Posts

- pastes the "selection in OS" text?

 

What (the selection? / the latest Clipboard item?) and where (in the frontmost application?) do you want to paste?

 

Could you be more precise, please. 

 

You can't paste a selection, so you can't pastes "the "selection in OS" text" but you can copy any Clipboard item. 

 

HTH.

Link to comment

Hi politicus,

I'm a translator, and I'm using Alfred as a simple CAT tool (computer assisted translation) for certain jobs. My clipboard history contains translated strings (each string contains the source sentence followed by the target sentence). When I have to translate a new sentence that I know I already translated a few minutes, hours ou days ago, I want to select the sentence in Pages (Numbers, or any other app) without copying it in the clipboard. The reason is quite simple: I want the clipboard history to contain only strings with both source and target sentences.

If I copy the selected text (sentence to translate) in the clipboard and then look into the clipboard history, I get 2 results (one with only the source to translate that I just copied, and the second result with both the source and the target). This is almost perfect... all I need is a way to look at the clipboard history without adding a "source only string" in the clipboard.

 

Concrete example with a screenshot (the clipboard history shows the "source only string" as first choice, and then the previously translated (source and target) segment. I need to get rid of the source only string to make the process perfect... (smaller clipboard, only translated strings, and no disturbing "source only strings" in the search results).

Link to comment

Thanks for the detailed explanation.  

 

From what I do understand, I'd give you 2 potential solutions:

 

- You can create a database of translations by copying them in the clipboard. When you want to translate, you just have to select (not copy) what you want to translate, open the clipboard, select the translation and hit enter.

Just tried it and works very well in Sublime Text and TextEdit. 

 

- You can create snippets of the sentences you translate over and over. When you want to translate them, you just have to select the text you want to translate, launch the snippet wiever, select the snippet you want, hit enter.

 

Snippets are NEVER deleted from the clipboard history even if you don't use them. Clipboard entries are atfer 3 months if you do not use them.

 

I hope it does answer your question.

Link to comment

Thank you politicus,

 

For the first solution, I don't understand how you can open the clipboard without copying the text to translate. :(   It would be the ideal solution, but how do you actually open the clipboard with the selected text?

 

(As for the 3 months limit, it doesn't really matter since I can import the clipboard database (the sqlite3 file) and export it to a txt file that I will still be able to search with mdfind. But of course removing the 3 months limit would be a better option... maybe this will be possible in a future release)

Link to comment

(As far as I know).

 

Well, you can't open the clipboard with a selected text (you have to copy it first): you can't select a text, hit a keyboard shortcut or launch a workflow that would open the Clipboard viewer with the text you selected. I doesn't depend on Alfred. It depends on your mac built-in clipboard. If you want to add something to it you have to copy it.

 

In Alfred, what you can do is open Alfred with the text you selected. You selection is automatically copied to the clipboard. It is a very simple workflow (Triggers > Hotkeys with Action : "Show to Alfred" and Argument "Selection in OS X"). The problem here is the Alfred bar will be launched not the Clipboard viewer.

 

May I ask you why my first solution doesn't fit your need perfectly? Is it because you have to type some text to select the clip?

 

You might be luckier in posting this in the feature request forum. 

 

Maybe the solution to your problem is using an expander application (like TextExpander). You select some text, type an abbreviation (you previoulsy defined) and your text is replaced by the translated text. No more clipboard problem  :)

Edited by politicus
Link to comment

Politicus, your first solution would be fine if I had only a few sentences, but to find the good sentence will be a hard task if I have hundreds or thoushands of sentences in the clipboard history (database).

 

As for the other solution, I already have something quite good.. that uses Alfred to launch mdfind and grep to search for the selected text in a folder (I have millions of sentences in that folder, in thousands of tab delimited txt files). The search syntax is: 

mdfind -onlyin /Users/.../folder containing hundred of small tab delimited texts \"{query}\" | xargs grep -i -h --max-count=50 --color "{query}"

In 2 or 3 seconds I get all the sentences that contain the selected string (full sentence or a few words), and the searched string is colored so I can find it easily in the results (the string can be in the middle of a long paragraph). The search is triggered with a hot key, with the "Selection in OS X" argument selected.

 

In can also add my news translated sentences to a txt file, with another hot key, with the following syntax:

echo "{query}" >>/Users/...path to my tab delimited.txt file && osascript -e 'tell application "Terminal" to close window 1'

The first part adds my selected text at the end of the file, and the second part closes the terminal's window.

 

(I have another one to delete a string when I realise that it contains a mistake, but it's becoming a bit off topic ; ;)  )

 

The only problem is that it uses mdfind, and mdfind doesn't index all the words. Frustrating. That's why I started using the clipboard history, since it uses sqlite and probably makes a better indexing job than mdfind (Spotlight). For the moment I copy the text and launch the clipboard search. Segments are also quite easy to del from the history (fn delete). I just wish I had the possibility to launch the clipboard search with the selected text. Maybe I should make a feature request for Launching Clipboard Search with selected text... after all it's similar to Show Alfred with the selected text...

Link to comment

I just realised that "Show Alfred with the selected text" also copies the selected text into the clipboard. Quite logical... :o  So "Showing the clipboard history without copying the selected text" is probably impossible. Another solution would be to automatically delete the clipboard history's last entry, but some sql command would be necessary for that (too complicated for me, I gave up). I'll just have to ignore the first result in the clipboard history results. Not perfect, but very close.  :)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...