Well … you could SORT of do this, but, I haven’t tried with an Object Style. Rather, with a Paragraph and Character Style.
Assuming you want to trigger a Heading to be styled based on something you have typed … then … you could type, say: Head=Books, or, Head=Tools, etc.
Then … setup a GREP Style to look for the “Head=” text string and if found HIDE this string (apply a Character Style with No Fill and a Font Size of 0.1pt) and to whatever follows the Head= to the carriage return you could then apply a “Heading” Character Style.
So, the GREP string might look like this: Head=.*~b (which means: Look for “Head=” followed by ANY amount of text, followed by a Standard Carriage Return).
But then you’ll need a second GREP style to deal with the Head= and make it disappear. Thus, apply a different Character Style called “Hidden” to the text “Head=”.
The Pro: you can hammer away using a single Paragraph Style and not give much thought to ‘applying’ a Heading style … instead, by merely typing “Head=” in front of a string of text you will make that text ‘become’ a heading.
The Con: you don’t get much control over the style options. E.g., you cannot change the Alignment of the text from the ‘base’ paragraph style that you are typing in … and, you cannot add a Ruling line (background) to make the Heading stand out. You can only apply character level styles using this ‘trick’.
So … I don’t think it’s really what you’re looking for … is it? But … it was fun to try, anyway.
Allan