copy txt file to clipboard
Moderator: Martin
-
- Posts: 31
- Joined: 31 May 2018 09:18
copy txt file to clipboard
Hello I have a txt file like this
x1
x2
x3
x4
.
.
x999
x1000
I want the text to be copied one by one in the clipboard That is, copy x1 first and then x2. Up to x1000, respectively.
And I want to make two different actions
like this
copy x1 to clipboard go to action 1
copy x2 to clipboard go to action 2
copy x3 to clipboard go to action 1
copy x4 to clipboard go to action 2
.....
....
....
copy x999 go to action 1
copy x1000 go to action 2
x1
x2
x3
x4
.
.
x999
x1000
I want the text to be copied one by one in the clipboard That is, copy x1 first and then x2. Up to x1000, respectively.
And I want to make two different actions
like this
copy x1 to clipboard go to action 1
copy x2 to clipboard go to action 2
copy x3 to clipboard go to action 1
copy x4 to clipboard go to action 2
.....
....
....
copy x999 go to action 1
copy x1000 go to action 2
Re: copy txt file to clipboard
Hehehe, it seems you need it fast. Unfortunately I am in the middle of transferring my old phone data to new one. Just got my RN5 yesterday, kinda busy migrating data.
It is almost the same as the open pdf, just some different actions. Same init variable file list to get all files. Then use the script to filter the text only, change the extension in the script to "txt".
To open text file and read the content, use Init Variable Text File. The to copy it, use Copy text to Clipboard. But it seems that is not the proper way to do your flow.
Do you really need to copy it to the clipboard before processing? What is the action 1 and action 2? is there a paste() action there? Because you can save some step and make the flow faster by using the text file content directly, rather than copying to clipboard first. We are talking about 1000 files, obviously saving some steps will save a huge amount of time in the end. Or maybe you can do the whole things just in a single script, if your action 1 and 2 is about parsing data.
Got to know what is the detail of action 1 and 2 first. If both of them are separate actions which is not script function, then you can use Condition Execution Count to split them, use 2. So every first execution will result in false, the second execution result in true. Thus execute 1000, 500 will go to true, 500 will go to false respectively. From both of these, loop back to the script until everything is finish.
It is almost the same as the open pdf, just some different actions. Same init variable file list to get all files. Then use the script to filter the text only, change the extension in the script to "txt".
To open text file and read the content, use Init Variable Text File. The to copy it, use Copy text to Clipboard. But it seems that is not the proper way to do your flow.
Do you really need to copy it to the clipboard before processing? What is the action 1 and action 2? is there a paste() action there? Because you can save some step and make the flow faster by using the text file content directly, rather than copying to clipboard first. We are talking about 1000 files, obviously saving some steps will save a huge amount of time in the end. Or maybe you can do the whole things just in a single script, if your action 1 and 2 is about parsing data.
Got to know what is the detail of action 1 and 2 first. If both of them are separate actions which is not script function, then you can use Condition Execution Count to split them, use 2. So every first execution will result in false, the second execution result in true. Thus execute 1000, 500 will go to true, 500 will go to false respectively. From both of these, loop back to the script until everything is finish.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 31
- Joined: 31 May 2018 09:18
Re: copy txt file to clipboard
Thank you engineer Desmanto,
There is a paste operation,
I do not want to open the file,
I want write to clipboard, And then paste.
like this
write x1 to cliboard,And then paste.
up to x1000
There is a paste operation,
I do not want to open the file,
I want write to clipboard, And then paste.
like this
write x1 to cliboard,And then paste.
up to x1000
Re: copy txt file to clipboard
If that so, Init Variable Text File + Copy Text to Clipboard will be a pair to loop. Need to take care of the action 1 and action 2, are they the same, just different app? Or what are the differences that need to be separated?
paste() operation need Control UI, you will need accessibility services to be turned on for Automagic. (Settings > Features & Permissions)
paste() operation need Control UI, you will need accessibility services to be turned on for Automagic. (Settings > Features & Permissions)
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 31
- Joined: 31 May 2018 09:18
Re: copy txt file to clipboard
automagic accessibility is on.
I just want to know how many TXT files are copied one by one to the clipboard
I just want to know how many TXT files are copied one by one to the clipboard
-
- Posts: 31
- Joined: 31 May 2018 09:18
Re: copy txt file to clipboard
not work
- Attachments
-
- flow_Flow8_20180602_221435.xml
- (2.37 KiB) Downloaded 688 times
Re: copy txt file to clipboard
If you want to know only the number of text file, you only need script. When you use Init Variable File List, files will be populated by all the file names from that folder. You only need to check if it is a text file (end with .txt)
So you only need the script after it, very similar, except you don't need to append "file:///" and encode it anymore.
number of text file inside the folder is txtcount.
If you still need to copy it to clipboard and do something to it, then you only need to use the similar loop from the open pdf version. Except replace the pdf with txt list. And replace the start activity with "Init Variable Text File". This action support direct path, no need to encode URL again.
So you only need the script after it, very similar, except you don't need to append "file:///" and encode it anymore.
Code: Select all
txt = newList();
for(i in files)
{
if(endsWith(i, "txt"))
addElement(txt, i)
}
txtcount = length(txt);
If you still need to copy it to clipboard and do something to it, then you only need to use the similar loop from the open pdf version. Except replace the pdf with txt list. And replace the start activity with "Init Variable Text File". This action support direct path, no need to encode URL again.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 31
- Joined: 31 May 2018 09:18
Re: copy txt file to clipboard
hi, not work
- Attachments
-
- Screenshot_2018-06-03-14-25-38-314_ch.gridvision.ppam.androidautomagic.png (176.96 KiB) Viewed 16785 times
-
- Posts: 31
- Joined: 31 May 2018 09:18
Re: copy txt file to clipboard
.txt not copyed to clipboard
Re: copy txt file to clipboard
The script is the preparation for the list of file, it should not be looped.
As you can see, it is very similar.
The loop start after the script, which is Init Variable Text file.
File : {txt[index]}
The expression part is exactly the same as pdf one, as it is one of the standard method to loop over list.
Code: Select all
txt = newList();
for(i in files)
{
if(endsWith(i, "txt"))
addElement(txt, i)
}
index = 0;
len = length(txt);
The loop start after the script, which is Init Variable Text file.
File : {txt[index]}
The expression part is exactly the same as pdf one, as it is one of the standard method to loop over list.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.