Help me overcome my fear/confusion of the Clipboard Features

Hello all,

I am most reluctant to pop up this query.

But honestly, after scrounging around in the Wiki, I realise this is something that will take presumably take a seasoned KM user a few seconds to assist with, but will/is taking me hours to get my head around… :weary:

I have come back to this on several occasions over the last few years, but the entry-effort is just too large, and each time, after a few hours of trying to get it working, I drop things (arguably more confused than before!)

I realise there is untold power in the KM Clipboards, and the variables, tokens etc., but the time required to work it all out, is preventing me from using them, and it’s no-doubt cutting off a sizeable chunk of KM use…

I am hoping someone can help me with the below, since once I see how it should be done, it will open up all sorts of other possibilities, hopefully as a result of me “finally getting it!

If this is not the right way of going about doing this, then please tell me to 'bugger off, and work it out on your own - you will appreciate in the long run etc. etc."… :sunglasses:

What I am doing, and want to fix using KM:

  • I saved 3 types of PDF files off our CMS, over and over again, on a daily basis.
  • The CMS displays client data, including the [NameSurname] and [ClientID], that is fortunately selectable, and so can be copied.
  • Open saving/printing the PDFs, one by one, I use a Textexpander snippet that fills in the [date], then a [standard description of that PDF page] (to distinguish between the 3 types of PDF pages I download from the CMS for each client), followed by me then pasting in the [NameSurname], and then pasting the [ClientID], as copied earlier.
  • I use Alfred’s clipboard manager in this – and I am then left with 3 different PDFs, that all have essentially the same filename structure to them, barring the 3 different PDF descriptors (inserted by TextExpander, after invoking 3 different snippets at each PDF save).
  • When the PDFs are dropped into a specific folder, Hazel works her magic, and automagically sorts the PDFs into the relevant Client folder (assuming it exists, failing which, Hazel creates the folder) – by recognizing the text-pattern that TextExpander ensures I apply to the filename of each PDF.

My steps:

1.) I manually select the [ClientID] off the screen, and [Cmd+C] Copy to System Clipboard.
2.) I manually select the [NameSurname] off the screen, and [Cmd+C] Copy to System Clipboard.
3.) I use KM to fire off the SaveAsPDF procedure.
4.) In the Save Dialogue box, after clicking into the filename, I invoke the individual TextExpander snippet, which pops up a floating text entry window. The [date]_ [PDF description] _ is already taken care of by TE, by each individual snippet.
5a.) I hit [tab] to jump over into TE’s blank field, where I am now to paste the [NameSurname].
5b.) I hit [Cmd+V], and paste in the last copied item, which is the [NameSurname].
5c.) I hit [tab] to jump to the next TE blank field, where I am now to paste the [ClientID].
5d.) I invoke Alfred’s clipboard manager, tap down once to the previously copied item, which is the [ClientID].
5e.) I hit [enter], which pastes the [ClientID] from Alfred, into the text field.
6.) I [tab] twice more to [OK], hit enter, and the file is named correctly, for Hazel to do the sorting.

7.) I repeat steps (3.)-(6.) for the next PDF [using a different TextExpander snippet at step (4.) – containing the other PDF description];
8.) I repeat steps (3.)-(6.) for the third and final PDF [using a yet another TextExpander snippet at step (4.) – containing the other PDF description].

Friction!

As is clear from the above, whereas this process could have been even more tedious were I not using KM, TE, Alfred and Hazel – it’s far from ideal, since I am fairly certain(?) that KM could jump in here, and take out even more steps… Correct?

What I surmise I need to be doing:

1.) Select and copy the [NameSurname].
2.) Make this a [Variable]??, and add it to a named clipboard [Firefox1].
3.) Select and copy the [ClientID].
4.) Make this a [DifferentVariable]??, and add it to a different named clipboard [Firefox2].
5.) Have KM create a third different named clipboard [Firefox3], using the Date variable and Text(??) variable, to create the [date]_[PDF description1] part of my TE snippet for the filename naming-regime.
6.) Add [Variable] from [Firefox1], and [DifferentVariable] from [Firefox2] into [Firefox3].
7.) Invoke KM to trigger the PDF save/print feature.
8.) Have KM click into the filename field, paste the content of [Firefox3].
9.) Have KM [tab] through to save the file with the new filename.

This appears longer, but since KM is doing everything in the background to the copied text, I am merely triggering KM once, at step (7.)

That said – I know I have missed several things above already. Presumably there is a far better way to do what I am trying to.
But assuming for a moment that that can work as is – and ignoring the fact that I have no clue how to actually get KM to do all of that, especially the using of the variables, and knowing in what order the writing to/copying from etc. must be happening in >> the real issue arises when I need to repeat all of this, for the other two PDFs…

Do I now create new named clipboards, to re-create the correct PDF description for the 2nd and 3rd PDFs, before pulling in [Firefox1] and [Firefox2] each time again?

I hope the above makes sense, and that I am clear in what I do, and what I want to do differently.

Putting me out of my misery:

Whereas an answer to the effect of “do this, then do that”, will be much appreciated - I am really holding thumbs that someone could pop up a screengrab (or 1st prize, share a test Macro) that will do the above…

I am obviously keen to try and get this sorted myself, to learn along the way, but the above is all broad-strokes…
My challenge lies in not really understanding the nit-picky details of how each step should look, in using the variables/tokens, and passing text from one clipboard on to another…
So even where I can get clarity on the “do this, then that” part in order to streamline things (rather than going my convoluted suggested way above), that will get me further, but I fear I will still get stuck in the details of actually compiling the macro.

Hoping some kind soul will take a bit of time, and help me out!
Much appreciated!

No problem. After having given a good effort to resolve a problem, please feel free to post your questions here. It is very good that you used the KM Wiki. It is great for getting the details on various features of Keyboard Maestro, but it does not help much with design questions. I guess you could say that is one of the main purposes of this forum – to help with design questions.

OK, if I understand you workflow correctly (and don’t hesitate to correct me if not), I’d say two things immediately:

  1. You don’t need KM Named Clipboards
  2. Keep using the Alfred Dropped Folder workflow.
    • KM could also do this, but why reinvent the wheel?

So, I think you could use KM to automate the entire process, requiring only that you select the first field in your CMS, and then trigger the KM Macro.
However, this is somewhat of a guess since I don’t know anything about your CMS. Could you please identify the CMS, and provide a screenshot of the section where the data and PDFs will be coming from. Please annotate the screenshot with the data you want to get.

Once you provide this, then we can help you with the next step: Designing your KM Macro.

Appreciate the reply.

Will take a screenshot, and pop something up as soon as I get in to office.

That being said, two things at this point.
A.). It’s a custom CMS, and whereas I call it that, it’s more of a Online Record, of their details as captured initially when they registered as students (I teach etc. at a University). My students are my ‘clients’.

I am effectively trying to create a CMS my side, regarding all my interactions/meetings with them.

B.) Your suggestion about a completely alternative use of KM is appreciated - but thing is - I am kind of hoping to put something together in KM using my outline above, precisely because what I am struggling with most, is trying to understand the KM clipboard feature!

So even if I could do something else completely, and bypass KM in the context of my intake suggestion, I’m hoping to put something together using the KM clipboards, precisely because I want to work out how to use them!

Regardless, many thanks for taking the time replying, and offering to help. It is much appreciated!

Ok. Here be my old student record, but this demonstrates the outlay of the "CMS"...

A couple of important points:

Nothing from the maroon coloured bar down is "visible" from a KM UI perspective, at least from what I can tell.
Even Shortcat.app, which I successfully use 99% of the time to interact with UI elements on any given screen/in any given application, sees "nothing" from below the Firefox toolbar down.

It's presumably since the CMS is wrapped in some sort of a "web-app", which makes it – for all intents and purposes – a single image on the screen, if that makes at all sense.

So interacting with it, requires me to use the KM "click at Found image", or the "Move or Click Mouse" action.

But regardless, as pointed out above - I am really hoping to construct something using the Clipboards feature inside KM, using the text copied to the system clipboard at [A] and [B] on the attached image.

Lastly, in case it was not clear from my spider-scrawl handwriting, I can individually select the different "tabs" on the left of the screen (those items in grey).
Selecting one of these, 'updates' the display field in white, on the right side of the screen.
So I select the 1st of the three I normally download, and once the information for that tab has appeared/is visible, I [Print page].
I then repeat that process two further times.

Hope this helps?

Been digging through the Wiki/shared macro examples…

Do I need to use a named-clipboard?

From what I gather, I could work of the system clipboard?
As in, set a [NameSurnameVAR] for the copying of the NameSurname, aimed at the system clipboard, then a 2nd [ClientNumberVAR], for when I copy the ClientNumber?

Would I then use a third step, and pull in [NameSurnameVAR] and [ClientNumberVAR], and play with those in constructing the NamingRegime to be used for the Filename?

It looks like you are using the FireFox web browser, which does not have any scripting support. If so, are you willing to switch to either Safari or Chrome for this task? If so, then it is likely that we can webscrape the page to get all of the info you want, as well as click any links for downloading the PDFs.

Again, no. As you copy text from the web page (either manually or by script), we would then save it to a KM Variable for further use.

Before going any further, I’ll wait for your answers.

Well what do you know…

I actually wrote my reply confirming that our CMS only works with Firefox, and that - despite my trying since 2012, neither Safari nor Chrome sees the CMS load properly.

I gave up testing either. But before hitting “post”, I went and checked again - and well, it works!!! :grinning:

No idea when IT rolled that out (I last tried towards the end of 2017), but my confirming that tonight has already made this post worth it! So… Thanks!

Good to hear.

Let’s know if you still have questions/issues.

Using Safari will be good, since it’s my main browser in any event, but I’m still not much further down this path.

I will still be trying everything above, but simply using Safari instead of Firefox…

Think it might be best to break down my attempted workflow into separate parts/threads, and take things from there.

I tried a really simple action today, involving a paste to clipboard with a variable involved, and couldn’t even get that to work. So will try and hammer away at that part, until I get it up and running, and then try and iterate from there.

I guess there’s no point aiming for the big workflow, until I work out how the various individual actions function!

It is very simple:

image

Make sense?

Assuming it does, the next step is to do a web page "inspect" of each field and link of interest. I prefer Chrome for this, but you can probably use Safari.

  1. Right-click on the object of interest, and select "inspect".
  2. This should open the Dev Tools, with the HTML for that object selected.
  3. Select the major HTML parent element (usually a <div>) above this, and right-click and choose "copy HTML"
  4. Paste that somewhere (in a plain text document)

Repeat the above for each object of interest.
Paste into a reply here using a Code Block.

Questions?