I hope you don't mind that I have revised your topic title to better reflect the question you have asked.
Running macro at the background possible?
Can a Macro Process a Web Page in the Background?
This will greatly help you attract more experienced users to help solve your problem, and will help future readers find your question, and the solution.
The answer is: Maybe.
The first, running once a day, is definitely possible. Use a KM Periodic trigger.
If your browser is either Safari or Chrome, and is always open, then you might try using these KM Actions:
Of course you will need to close the tab, but for now see if those Actions will work with the Browser in the background.
For now, I recommend Chrome. There seems to be a slowdown with Safari in some cases. See
Yes that's what I did, the macro is currently working fine.
By background, what I meant is that it doesn't start a front window/tab so it won't affect whatever app running as front windows.
So does that solve your problem?
if so, please check the "Solution" checkbox at the bottom of my above post so others will know.
If not, please post your follow-up questions.
No it doesn't. When the macro runs at schedule time, it opens a Chrome window as front window.
Please upload your macro.
That is most likely because you are using an Activate App Action, which you should not do, unless the app is not running. In which case you can Activate Last App at the end of your Macro.
See How to upload your macro. Instructions for uploading to an existing post are just below the main instruction.
You may also find this Macro useful: MACRO: Upload KM Macro to New or Existing Topic @KM [Pub]
This is the simple macro. It open google search and extract the exchange rate. I could use your wait element macro instead of simply pause for 3 seconds
get exchange rate gbp Macro (v9.2)
get exchange rate gbp.kmmacros (2.7 KB)
OK, it looks like KM always brings the Browser to the front when using any of the Browser window actions. So we will have to use AppleScript.
Original script was developed by Chris @ccstone.
Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.
Please let us know if it meets your needs.
MACRO: Open Chrome Tab in Background @TEST
-~~~ VER: 1.0 2021-05-19 ~~~
Requires: KM 8.2.4+ macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))
DOWNLOAD Macro File:
Open Chrome Tab in Background @TEST.kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
Thanks. Tested the macro and it does start tab in the background without affecting current front app! I don't know anything about AppleScript though so need to find time to learn a little bit.
I did some research on AppleScript. Looks this solution is actually not working.
The script is opening a new tab as active tab, and then tried to restore active tab to original active tab. I've added below line:
--- Restore Original Tab --- -- if (active tab index ≥ 1) then set active tab index to origTab set active tab index to origTab
It does restore active tab, but the subsequent action of "document.title" is running on the original active tab, not the tab just opened.
That was just and example of how to use Chrome in the Background.
Here's a more complete macro that opens a new Chrome Tab and then does a WebScrape of it -- ALL in the background:
MACRO: Open & WebScrape Chrome Tab in Background [Example]
Please let us know if this works for you.
If you have any questions about the Macro, please post them in the Macro topic.