1. Currently, there is no way to do that, clipboard is handled by OS. But maybe it is possible for Martin to add the source app in Trigger Clipboard Changed.
2. Write to file action, with append checked will automatically create the file first if it is not exist yet.\
3. The full implementation will require 4 flows. But can be reduced to 2 only if you already know how to combine triggers to single flow and split them using multiple parallel expression
viewtopic.php?f=5&t=7103
What app do you use to read the book? What file? PDF? ePub? I will make assumption you are using adobe reader for android, and open pdf files.
The first 2 flows will be using triggers app task started and ended, adobe reader. In both flows, enable/disable the flow 3 and flow 4 accordingly.
So when adobe reader is opened, enable flow 3 and flow 4. Adobe reader is closed, disable them.
Flow 3 will be using trigger
UI event (you need to enable accessibility services for Automagic), component clicked, package name com.adobe.reader; matches regex : .*\.pdf
The action after it only single script with 2 lines
Code: Select all
book = findAll(text, "(.*)\\.pdf", true);
global_book_name = book[0][1];
What happened is, when you click to open the pdf in adobe reader, it will trigger this flow 3. Script will parse the pdf name, for example
regexbuddy.pdf. Using regex parsing, we will take out the file name, removing the .pdf. Then save this to a global variable for later use. So now we have the file name as the source of the book name.
Flow 4 will be using Trigger
Clipboard changed. After clipboard changes, put conditon App Process Running, adobe reader. This will ensure the flow will only continue if the clipboard changed trigger inside adobe reader. Use action write to file as you have done, append it to the file name from glovar. Probably something like
File :
/storage/emulated/0/Automagic/{global_book_name}.txt
Text :
{clip_data}
The book name will stay for a long time, until you back from the pdf, click another pdf. Then the global_book_name will be set to the new name. Anything you copy from that book, will be append to new text file (if not exist yet).