Keyboard Maestro and App update screens

Hi everyone,

I am subscriber to a newspaper and use Keyboard Maestro to log in via Safari and download the PDF. Once downloaded the PDF get’s filed via Hazel and I can read my daily newspaper in the synced folder with PDF Expert.

The Keyboard Maestro script to open the webpage, log-in and download the PDF works in the most part with ‘Insert text’, ‘Type keystroke’ and ‘Move and Click’. Unfortunately the script fails from time to time: “Action Failed: Set Safari Field failed to set …”

Most of the times a App update screen is then open and I imagine, that this is preventing Keyboard Maestro from function as expected.

Experimented with ‘Hide All Applications’ but this doesn’t influence the app update screens.
The newspaper doesn't provide an API nor would I now how to us it.

Any suggestions how to get to a reliable PDF download or even how to figure out what is going on?

Thanks for your ideas.
Thomas
Capto_Capture%202020-01-01_12-34-14_PM

Could you post the macro itself? Would be helpful for others to follow along.

"App update screen"? Do you mean a macOS notification that there is an update available for an application? Something else?

Yes, absolutely. Created a public copy with placeholders for userid and password, but otherwise the same as one of the macro that runs every day.
Also found the log and saw, that there seems to be an error with a library missing. Could this be the reason? Have to figure out how to solve this as well.

Please find attached the macro as well as the log file for the last few days.

Any help or 20_ePaper Ktipp_Public.kmmacros (11.6 KB) Engine_Public.log.zip (49.6 KB) well appreciated.

Removed the 3 files below from System ▸ Library ▸ QuickTime
AppleIntermediateCodec.component
AppleMPEG2Codec.component
EyeTV MPEG Support.component
At least in the KeyboardMaestro Log the EyeTV error seems to be gone - at least for the moment.
I wonder if the macro will run more stable now.

Concerning the "App update screen". Yes, I mean the macOS notifications for available application update. At least for me those appear as standalone notification windows asking to skip or install the updates. Is this system standard behavior, or can this be changed to show up in notification center only?
Sorry for the imprecise formulation in the first place.

For this use case, web scraping, you are usually better off using JavaScript in Browser.

I always use a password manager (1Password) to log in to all of my web sites and apps.
It is possible for KM to script 1PW and the macOS Keychain, but let's start simple for now, and add that in after we've got the below working.

Open the web page and log in manually, then run the KM macro.

I can help you with the JavaScript, but I need either the page URL, or all of the HTML code around the section you're trying to control/script. You can use the Chrome Inspector to get this HTML.

Please post the URL, or the HTML using the Forum Code Block.

Removing the tree EyeTV files solved the CompileApleScript error for the EyeTV.

However, today the scripts weren't successfully proceeded. Possibly because a KeyboardMaestro forum dialog box wanted to be confirmed to add notifications.
According Engine.log is appended at the end.

BernerZeitung:
https://epaper.bernerzeitung.ch
Download -> Gesamte Ausgabe -> Login with username and password. Once logged in one more time Download -> Gesamte Ausgabe will download the PDF file.

https://www.ktipp.ch/login/
For the script '20_ePaper Ktipp' (Scripts kgeld / Gesundheitstipp / saldo do function exactly the same as it is the same html structure)
Login with username and password. Once logged in some more navigation is to be made in order to download the PDF.

Unfortunately I can't publish username and password.


2020-01-01 23:36:47 Log: 'ePaper Ktipp' downloaded: Mi., Jan. 1, 2020 11:36
2020-01-01 23:36:58 Log: 'ePaper Ktipp' finished: Mi., Jan. 1, 2020 11:36
2020-01-01 23:39:51 Execute macro “20_ePaper Ktipp” from trigger Editor
2020-01-01 23:39:51 Log: 'ePaper Ktipp' started: Mi., Jan. 1, 2020 11:39
2020-01-01 23:40:21 Log: 'ePaper Ktipp' downloaded: Mi., Jan. 1, 2020 11:40
2020-01-01 23:40:32 Log: 'ePaper Ktipp' finished: Mi., Jan. 1, 2020 11:40
2020-01-01 23:41:34 Execute macro “10_ePaper BernerZeitung” from trigger Editor
2020-01-01 23:41:34 Log: 'ePaper BernerZeitung' started: Mi., Jan. 1, 2020 11:41
2020-01-01 23:42:42 Log: 'ePaper BernerZeitung' finished: Mi., Jan. 1, 2020 11:42
2020-01-01 23:44:07 Execute macro “20_ePaper Ktipp” from trigger Editor
2020-01-01 23:44:07 Log: 'ePaper Ktipp' started: Mi., Jan. 1, 2020 11:44
2020-01-01 23:44:37 Log: 'ePaper Ktipp' downloaded: Mi., Jan. 1, 2020 11:44
2020-01-01 23:44:48 Log: 'ePaper Ktipp' finished: Mi., Jan. 1, 2020 11:44
2020-01-02 03:49:59 Execute macro “00_Close_Safari” from trigger At 3:50 every day
2020-01-02 03:59:59 Execute macro “20_ePaper Gesundheitstipp” from trigger At 4:00 every day
2020-01-02 04:00:00 Log: 'ePaper gesundheitstipp' started: Do., Jan. 2, 2020 4:00
2020-01-02 04:02:14 Async NSAppleScript error 2020-01-02 04:02:14.656 CompileAppleScript[25357:7793521] Keyboard Maestro Internal AppleScript Execute Error: Safari got an error: AppleEvent timed out.

2020-01-02 04:04:21 Set Safari Field failed to set //INPUT[@id="userid"]
2020-01-02 04:04:21 Set Safari Field failed to set //INPUT[@id="userid"] In macro “20_ePaper Gesundheitstipp” (while executing Set Safari Field “//INPUT[@id="userid"]” to Text).
2020-01-02 04:06:23 Set Safari Field failed to set //INPUT[@id="password"]