Hello everyone, I am currently trying to develop a plugin for PopClip, and I would like to be able to access the context of the selected word. However, after reviewing the PopClip development documents(such as https://www.popclip.app/dev/script-variables) and searching online, it seems that there are no variables or APIs available to access the word context.
I was wondering if PopClip has this capability at all. I am working on a context-based learning program, so the context of the selected word is crucial for my work.
eg: This website aims to be a complete resource for PopClip users. It contains all the documentation for PopClip in one place, with the following sections
(when I select this word of documentation, I also want get the sentence It contains all the documentation for PopClip in one place)
Greatly appreciate your timely feedback. I am currently developing a learning tool for non-native speakers like myself. The tool helps them add new words encountered to Anki. Contextual learning greatly enhances the learning efficiency, which I personally enjoy. I use the online-dictionary-helper chrome extension to easily add new words, but it has limitations on browsers. Recently, I’ve come to realize the vast potential of popclip, which can break the browser’s restrictions. Therefore, I aim to develop a better tool to assist non-native, heavy Anki users like myself.
The plugin I mentioned is able to extract the context of the selected word(s) on a browser page. It would indeed be a big challenge for non-browser environments.
One possibility right now, though a little clunky, is you could write a module-based javascript extension with two actions, one to input the specific word and another to input the context.
Unlike other action types, JavaScript modules allow you to actually store variables which persist between invocations of the action. An example of an extension that already does this is the ChatGPT one (source), which stores the chat history between invocations.
If you need any pointers how to go about this let me know. I can write up an simpler example when I have a bit of time.