loop #start of a loop
Find Next “.+” #which should find all text in one paragraph without the \n return
Copy
goto loop #start the loop again (and copy the next paragraph until the end of document)
This is the scenario:
I’ve got one file with 1000+ paragraphs
I want to copy each paragraph in this file, beginning with its first paragraph, so that every paragraph appears in its clip in Copy Em Paste.
At the end I would have 1000+ clips in CEP.
Hi JMichaelTX and thank you for your hints.
I have managed steps 1 and 2.
I then set Clipboard to Variable "lineText"
but don’t know where to set the Pause here .
I’d like to show you a screenshot, but I can not find any uploadbutton.
Welche ist die bevölkerungsreichste Stadt Mexikos?
Mexiko City (Stadt)
http://www.rastlos.com/mexiko/staedte/
http://www.mexiko-sehenswuerdigkeiten.com/mexikos-stadte-im-uberblick/
Welche ist die bevölkerungsreichste Stadt der Ukraine?
Kiew
http://ukraine.admission.center/de/kiev/
http://www.goruma.de/Laender/Europa/Ukraine/Bevoelkerung/
Welche ist die bevölkerungsreichste Stadt in Norwegen?
Oslo
It seems that the macro is copying whole paragraphs (\par)? So a line in KM is actually a paragraph ".+\n"? If so, how to prevent KM from copying the return as well?
The extraneous text like \par is occurring because you are using a rich text file for the source text. You could try using a regex to grab only the text you want before adding it to the clipboard, but a faster and easier solution may be to simply copy all of the text from the source RTF file and save it as a plain text file (or just add all the copied source text to the sourceText variable directly using KM's preferences or a Set Variable to Text action). However you convert the source from rich text to plain text, it should resolve your issue so that you get results more like this:
Thank you, Gabe, saving my file as .txt did it … nearly.
The Clipbard History Switcher shows all copied lines. But Copy em Paste only has got the first two clips.
Oslo
Welche ist die bevölkerungsreichste Stadt in Norwegen?
I have set the Pause to 1 sec. and this did help. CEP is too slow
Interesting, but unfortunately this database is not public.
But there is nothing special about it. Just fields, where you would paste
the lines.
It’s a quiz database, so one field for the question, one to three for answers, one for an explanation, source and so forth. Buttons to click to save etc.
If you’re doing it manually, then you can just use the Clipboard History Switcher in Keyboard Maestro.
If you want to automate it, then there are all sorts of possible ways, it depends on the exact sequence of clipboards and fields and how consistent it is. The “one to three” part will need some dealing with for example.
If you have more than a hundred (which is the default Keyboard Maestro limit on clipboard history), then you either should increase that limit, or more probably want to store the data somewhere else, rather than the clipboard history. Especially since Keyboard Maestro clipboard history does not include repeats, and it’s possible you could have two questions with the same answer (eg a number like “7” could answer two different questions).
Perhaps some screenshots of the source data and the web site would help.
here is my routine of pasting and clicking.
It is not possible to put all the questions in a row into the database, cause I have to check the clips again before saving.
But if these nine or eleven steps could be automated, it would be a timesaver.
Best, Matze
Source data is a plain text document with thousands of paragraphs of text, I have written in Nisus Writer Pro.
What is the name of our planet?
Earth
(Moon)
(Mars)
(A)
(Also known as the blue planet)
1
Astronomy www.nasa.com
Controlling that should be relatively straight forward. At the worst you could just use clicks relative to the window. Better would be clicks relative to found images in the window, and better still would be to use the web browser actions to click the links or adjust the checkboxes or what have you. It depends on the web page though, and how well behaved it is.
Given the web page is presumably very static, and you’re going to be doing all of this in a short time frame (so the web site wont change), just using UI actions related to clicking or pasting is probably straight forward. Just a sequence of clicks, pauses, typed text (for menu selection) or pasting (for text input).
With the source data, how can you tell when the next question starts?
Reading the file line by line can be done using the For Each action and the Lines In collection. No clipboard is even needed for that.
Basically, you have a couple easy problems:
Copying each line of text from the file
Controlling the web page (probably).
And one tricky problem:
Figuring out which lines of your data go where, including figuring out when one question ends and one starts.
If you can resolve the latter, the rest will probably fall in to place.
me as a KM-newbie will keep your suggestions in mind for the time I might have learned how to use KM-basics. In 2018 this task will rise again and then I’ll give it a try… For now handling one question at time by pasting the clips into the database and clicking by hand will do.
In that case, might I suggest you just automate a small part of it.
The task must be pretty repetitive, so note down the exact sequence you do, even if for just one case (say when there is exactly four answers for example).
Note exactly what you do: Copy N things in order, then whatever sequence you do on the web page exactly.
Then create a macro that does exactly the same sequence (you can even use recording to record the click locations).
In your macro, it is best to start after you copied each of the N things, and set the clipboards into variables using the %PastClipboard% token. Then in your recorded macro template, add appropriate pauses, and use the Insert Text by Pasting action with %Variable% tokens.
But, of course, it’s entirely up to you as to whether that will make the overall process go faster.