Regex trigger macro (not typed string)

Hi there,

I'm trying to get my macro to trigger when a regex of mine is found on the page (so it would in a way monitor the page I'm currently on). How could I do this??

Hi Ben,

What kind of page?

To my knowledge, such a trigger doesn’t exist. But you can build something like this:

  • Macro group:
    • Active when app XXX is frontmost
    • Active when front window title contains XXX or YYY
      • Macro trigger: Periodic or When window title changes, or…
        • Get the text of the page
        • Search for the regex
          • If found, then do XXX, YYY

In any case, it will be helpful to provide more details.

You find tips here:

Tips: How Do I Get The Best Answer in the Shortest Time?

Hi Tom,

It would be on tweetdeck. So I would pick some accounts I want to monitor and when the most recent tweet comes through containing the regex it would trigger the macro. There must be a way to do this?? I really do appreciate the help :slight_smile:

The point here is to find something that is always true. Then to do a further test with the RegEx. If that test fails then bail. If it succeeds then continue with your processing,

I had a look at a TweetDeck page. Basically I think it can be done with a structure as proposed above.

Some problems I see:

  • It seems, getting the relevant content requires some JS queries. I’m not very good with JS in general and with JS on web pages in particular. Other forum members, for example @ComplexPoint, @JMichaelTX, may solve this task in the blink of an eye.
  • The page seems to reload in set intervals, which means you either need the right timing when using a periodic trigger – or you try to disable the auto load and reload with the macro.
  • Once your regex action matches, it might match the same string/pattern again in the next run, depending on the progress of the time lines.
    • If this is a problem, you could include the text context with a match, and check the match against a variable that collects the previous matches with their text context. (Or by including time stamps.)

How would I go about doing that? I have the regex I wanted, but it’s only the process of going about doing it.

Thanks Tom I really appreciate the help :slight_smile: