Temperature shut off

Is there a way to initiate shutdown if the temperature gets to a certain point. I thought I turned it off but did not and later found it overheating in my laptop bag.

Hi,
The EC already sends a PROCHOT to the CPU when it gets too hot.
This forces the CPU to its slowest speed, but it appears that inside a bag, even at its slowest speed, it still keeps getting too hot.
The fix is therefore to prevent the laptop from waking up in your bag.
The latest FW16 BIOS is supposed to fix the wakeup problem, so a good first step is probably to try that. The BIOS fix, is it prevents wakeup when the lid is closed.
Failing that, I use a different fix, that adds a script so that the only thing that can wakeup the laptop is pressing the power button. It disables the keyboard or touchpad from waking up the laptop when the lid is closed. You can find the sleep script on other threads.

The reason for the wakeup is that in the bag, the keyboard/touchpad was still active, so a little pressure on the laptop, while in the bag, would either press a key, or click the touchpad and wake it up.

I thought I had powered it off but I don’t think I did, I was in a rush. As a safety measure I would like it to power off if CPU and GPU are at idle yet temperature gets above.

I should make an ahk script to shutdown by keystroke quickly as a work around.

I think that would be useful.
Essentially some tool that measures the efficiency of the cooling, and if the fans do not appear to be cooling it enough, log a reason message then do an automatic shutdown.