Paste URL and Page Title into Another Web Page [Example] Macro (v9.0.3)

MACRO:   Paste URL and Page Title into Another Web Page [Example]

~~~ VER: 1.0    2019-11-07 ~~~
Requires: KM 9.0.2+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Paste URL and Page Title into Another Web Page [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • Open a Text Input Area on a New Web Page and Paste text into it
    • Get the Title and URL of the Current web page, Open a new Web Page in a new Tab, and Paste the Title & URL into the new page.

HOW TO USE

  1. First, make sure you have followed instructions in the Macro Setup below.
    • NOTE: All settings are OK if you want to test using a new Topic in the KM Forum.
  2. Open web page that you want to get the Title and URL for.
  3. Trigger this macro.
    • IF Option 2 is used, Notification is given and Macro pauses until user clicks in Input Area and presses OPT-RETURN.

MACRO SETUP

  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
      .
      Make These Changes to this Macro
  1. Assign a Trigger to this macro.
  2. Move this macro to a Macro Group that is only Active when you need this Macro.
  3. ENABLE this Macro, and the Macro Group it is in.
  4. Review the "Macro Method" Comment and decide which Option you want to use
  5. Change the Actions in magenta color to provide the required data
    .
  • REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
    (all shown in the magenta color)

    • Set Variable Local__TargetWebPage
      • This is the destination web page where you want to paste the URL and Title from the source page

OPTION 1
(set to blank if you want to use Option 2)

  • Set Variable Local__PageLoadedCSS
    • CSS for querySelector of page element that must be present to consider the page loaded
  • Set Variable Local__EditAreaCSS
    • CSS for querySelector of page element for the Text Input Area
    • Leave EMPTY if you want to use Option 2

OPTION 2

  • Set Variable Local__SecToWaitForPageLoad
    • Number of Seconds to wait for page to finish loading
    • Leave unchanged (or empty) if you use Option 1

REQUIRES:

  1. KM 9.0+ (may work in KM 8.2+ in some cases)
  2. macOS 10.11.6 (El Capitan)+

TAGS: @WebScraping @URL @JavaScript

USER SETTINGS:

  • Any Action in magenta color is designed to be changed by end-user

ACTION COLOR CODES

  • To facilitate the reading, customizing, and maintenance of this macro,
    key Actions are colored as follows:
  • GREEN -- Key Comments designed to highlight main sections of macro
  • MAGENTA -- Actions designed to be customized by user
  • YELLOW -- Primary Actions (usually the main purpose of the macro)
  • ORANGE -- Actions that permanently destroy Variables or Clipboards,
    OR IF/THEN and PAUSE Actions

USE AT YOUR OWN RISK

  • While I have given this a modest amount of testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
  • If you have any doubts or questions:
    • Ask first
    • Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.

1 Like