Select all but only from the main window

Hi, I want to select and copy some dictionary entries from this site: Wörterbuchnetz
There are three windows one can interact with. When I press command+a I select text from all three windows/areas. Is there a possibility to select and copy text only from the main window in the middle?

Thank you!

Perhaps broadly this kind of thing ?

(Assuming, for example, the Safari browser)

Text from central panel of Worterbuchnetz page.kmmacros (2.5 KB)

(You can find the classname of a web page element, here a div, in a browser's Inspect mode)

what exactly should I add and where to?

That depends on what exactly you need to produce.

If you need just the plain text content of the html elements, then you can get the text below directly,
by downloading, opening and running the macro above, and either copying from the display window,
which the macro throws up,
or changing display results in a window in the second action block to something like:
save results to clipboard.

Bd. 7, Sp. 119Rabelais bis RabenschnabelBd. 7, Sp. 120 Meyers Rabelais1 Rabelais auch rein identifizierende Nennung metonym für das Hauptwerk des frz Satirikers FRabelais (16.Jh), den Romanzyklus ‘Gargantua u Pantagruel’,1532-64 [Arbon:] Ich habe nichts gegen die Erklärung des Bildes das sich nicht selbst erklärt..Gut! man mache Noten..wie zu R. 18,293,23 GutWeiber T3,301,27 v 28.11.07 uö(selten) Claudia Ristau Adelung Rabenaas 1DWb rabenaas, n. Krünitz Rabenaas3 Rabenaas ‘Rabenas’ grobes Schimpfwort für eine (den Raben gleichsam zum Fraß vorzuwerfende) niederträchtige Person; nur als (geplanter) weiblicher Figurenname für ‘Hanswursts Hochzeit’ [im Entwurf des PersVerz:] Ifr [Jungfer] R. 38,440 HanswurstsHochz Plp uö(selten ebd) Claudia Ristau Rabencras das Krächzen des Raben imitierendes u lat ‘cras’ (morgen) assoziierendes Wort; hier für einen dieses Wort enthaltenden, überlieferten Mehrzeiler gegen das Vertagen auf später1) [betr die evtl Verwendung in ‘Wallensteins Lager’ zur Eröffnung des Weimarer Theaters] /Bd. 7, Sp. 120/ schicke ich einen Band des Pater Abraham [a Sancta Clara], der Sie gewiß gleich zu der Capuzinerpredigt begeistern wird. So wäre zum Ex. Das Raben Cras als Schlußformel, in Genasts Munde, vielleicht höchst erbaulich B13,281,19 Schiller 5.10.98 1) zu ‘cras’ vgl Wander1,542 Nr 1u2, Wander5,1106; zum Sachverhalt MA8.2,468 Claudia Ristau Meyers Rabener1 Rabener auch -aa-; vorwiegend rein identifizierende Nennung metonym für Satiren des dt Schriftstellers GWRabener Ich aber habe es mit dem Freyer im R. gemein, daß ich meine Fehler voraus sage B1,2,7 Ysenburg 23.5.64 uö(selten) Claudia Ristau 1DWb rabenfeder, f.1 Rabenfeder (bevorzugt zum Zeichnen u Feinschreiben benutzte) Feder des Raben einen Vers mit der R. und Tusche auf holländisch Papier schreiben 27,135,27 DuW 7 N3,54,10 FlH I Theophr uö(selten) Claudia Ristau Adelung Rabenhütte 1DWb rabenhütte, f. Krünitz Rabenhütte3 Rabenhütte jägersprachl: getarnter Unterstand zum Auflauern u Schießen von Raben Wir auf der R. [zwei Tage später] Wieder Rabenschiesen T1,35,7 v 7.3.77 uö(selten) neben ‘Auerhahnbalz’ (sd) u ‘Schnepfenstrich’ zugl metonym für die Zeit der Jagd auf Rabenvögel im Herbst u Winter alles [in dem Jagdgedicht] war, besonders was auf das Geflügel Bezug hatte..mit großer Eigenthümlichkeit behandelt. Von der Auerhahnbalz bis zum zweiten Schnepfenstrich und von da bis zur R. war nichts versäumt, alles..leicht und scherzhaft, oft ironisch dargestellt 24,309,9 Wj II 4 Claudia Ristau *Rabenonkel (in Analogie zu Rabenmutter od -vater) für einen sich nicht um seine Nichten u Neffen Kümmernden; als pejor Selbstbezeichnung [an Goethes Nichte MALNicolovius] Ich soll Ihnen sagen: er sei kein R., aber schreiben, das wäre eine Sache, die selten bei ihm ausgeführt würde Gespr(He1,895) EVoß undat Claudia Ristau 1DWb rabenpost, f.1 Rabenpost für das Überbringen (schlechter) Nachrichten durch Raben als Boten; iGz ‘Taubenpost’ 151,273 Faust II 10678 Claudia Ristau Rabenschießen -s- das Jagen von Rabenvögeln unter Einsatz von Schußwaffen T1,35,8 v 9.3.77 [Zit s v Rabenhütte] Claudia Ristau Adelung Rabenschnabel 1DWb rabenschnabel, m. Krünitz Rabenschnabel3 Rabenschnabel langer, kräftiger, an der Spitze gekrümmter Schnabel des Raben; im Formvergl Corpus V B,20 Nr30 Morph Plp Claudia Ristau

It doesn't work for me. I don't understand what you mean by

You can find the classname of a web page element, here a div, in a browser's Inspect mode

Is this important to make the macro work?

Do I need to change anything?

I don't think so – that is directly downloaded from the link above ?


If what you actually want to copy is the HTML, then you could Ctrl-click (right-click) the central area and:

  • Choose Inspect Element
  • then select the HTML element below which gives the best selection range above, and then, again with a contextual menu, choose Copy HTML

But if I want to apply this 100 times on different pages it takes too much time.

How did you get this result?

Oh I see. I had to activate JavaScript in Safari.
Is it possible to copy the text as a html with the Macro?

You could experiment with the .outerHTML or .innerHTML property to capture the HTML code.

HTML from central panel of Worterbuchnetz page.kmmacros (2.5 KB)


(If you want a pasteable HTML clipboard, that's a bit different)

This works great! You helped me a lot!

Is this the best way from to get the formatted text into Word? I would need to copy it as html then paste it into a html file and copy it from there into word, right?

paste into word

סוף סוף הבנתי

An additional code snippet should copy it directly into the clipboard as html rich text for pasting into Word, I think.

(We haven't copied the various stylesheets which play a role in this page, so not all of the formatting will be intact, but it may already be enough for legibility)

HTML copied to clipboard from central panel of Worterbuchnetz page.kmmacros (3.8 KB)


Expand disclosure triangle to view JS Source
(() => {
    "use strict";

    ObjC.import("AppKit");

    const main = () =>
        setClipOfTextType("public.html")(
            Application("Keyboard Maestro Engine")
            .getvariable("copiedHTML")
        );


    // ----------------------- JXA -----------------------

    // setClipOfTextType :: String -> String -> IO String
    const setClipOfTextType = utiOrBundleID =>
        txt => {
            const pb = $.NSPasteboard.generalPasteboard;

            return (
                pb.clearContents,
                pb.setStringForType(
                    $(txt),
                    utiOrBundleID
                ),
                txt
            );
        };

    return main();
})();
1 Like

This is genius! Thank you so much!
I don't want to be shameless to ask for more but is there a way to store the collected date somehow if I want to execute the macro without pasting the content each time into word but only after 100 times or so.

Perhaps two separate macros, with two distinct keyboard hotkeys ?

  • One to accumulate HTML – appending it to a Keyboard Maestro variable on each run, and
  • another to finally paste from that variable and clear it ?

I can aim to take a look this evening, if no one else has done it.


Sketch of a pair of macros:

  • ⌥⌘C for accumulating HTML from that central panel
  • ⌥⌘V for moving any accumulated HTML to the rich text clipboard, and pasting it

Worterbuchnetz Macros.kmmacros (11 KB)

1 Like