How to store a command's result to a scoreboard?

Minecraft's command system has evolved over the years, and in the latest version of Minecraft: Java Edition, commands are able to do incredible things, like modification of NBT and scoreboards, which are essential for data storage, math operations, and the creation of complex command machines.

But in Minecraft: Bedrock Edition, the command system is stuck in 1.12− commands, just before the command evolution of 1.13+, with some of the more complicated commands not available, and without access to NBT, or custom scoreboard criteria.

Because of this, some complicated tasks using commands are not possible in the Bedrock Edition of Minecraft, like ones involving NBT, requiring sometimes-finnicky workarounds to get the task done.

One of these tasks is one I would like to focus on here: How can one store a command's result to the scoreboard?
In Java Edition, the follwing command works:

/execute store result score @p myScoreboard if entity @a

Explanation: Store the number of players in the nearest player's score score.

Of course, /execute in Bedrock Edition is still stuck in the "dark ages" of commands, only modifying the execution position and location, nothing else.
Pity...

...because what I need to do is store a command's result to the scoreboard for modification using math.

Viewing past versions of the 1.12 commands pages show that a /stats command existed in 1.12, which was the equivalent of 1.13's /execute store command, and could only store results to a scoreboard.

This could be utilized by running it to target a command block or entity, and specifying where to store the results of all commands further executed by that block or entity. So, here would be the 1.12− equivalent of the above command

/stats block 12 23 34 set QueryResult @p myScoreboard
/testfor @a
/stats block 12 23 34 clear QueryResult

where (12, 23, 34) is the location of the second area with the /testfor.

Now let's take that over to Bedrock Edition, because it uses 1.12− command syntax, this should work, right?

Oh wait, /stats was one of the more complicated commands that they chose not to include in Bedrock Edition.

Now, the only way to probe a command's result would be using a comparator coming out of a command block. And the only way to measure the actual number is redstone and signal strength, and we know that redstone dust is evil when used with commands. Worse, it has a maximum of 15 power, much less than the scoreboard's maximum of 2,147,483,647.

Unless there is another, top sneaky way out there, which this question tasks you to find.
Can you find a way to probe a command's result without use of redstone components?


For the specific example given of counting players or entities, you can actually come up with something that works in bedrock.

First create the scoreboard objective

/scoreboard objectives add count dummy

Next, give all entities a score

/scoreboard players set @a count 1

Next use the execute command to add up all the scores to a fake player slot

/execute @a ~~~ scoreboard players operation count_total count += @s count

Now the fake player count_total has a count score equal to the total count of players.