[Windows Mobile Apps and Games] cls_:
Updated Scripts

Below are updated scripts. It will try to look for both registry values:

HKCU\Control Panel\BackLight\DispOn

HKLM\Drivers\Display\DispOn

Also, you can easily extend the reg_array to look for even more registry values.

autoClock.mscr

; *****************************************************************************************
; *** Special Thanks to NetRipper for the Msm7kCpuSpeed App
; *** Also thanks jpc073@gmail.com for the work with this mortscript
; *** Website: http://ip208-100-42-21.static.xda-developers.com/showthread.php?t=725290
; ***
; *** Updated: 7/25/2010 by cls_
; *****************************************************************************************

; Place this into directory: "\Windows\StartUp"

;**********************************************************************
; DEFINABLE VARIALBES

; Set your speed settings.
; Default Settings: boost_speed=40 and safe_speed=31
; Possible settings:
;41=787
;40=768
;39=748
;38=729
;37=710
;36=691
;35=672
;34=652
;33=633
;32=614
;31=604
;30=576
;29=556
;28=537
boost_speed = 40
safe_speed = 31

;***************************************
; Create 2 dimensional registry array:
; reg_array[i][1] = reg_root
; reg_array[i][2] = reg_key
; reg_array[i][3] = reg_val

; Check HKLM\Drivers\Display\DispOn
; 0 when screen off, 1 when screen on
; This may be Device/Rom Specific
reg_array[1][1] = "HKLM"
reg_array[1][2] = "Drivers\Display"
reg_array[1][3] = "DispOn"

; Check HKCU\ControlPanel\BackLight\DispOn
; 0 when screen off, 1 when screen on
; This may be Device/Rom Specific
reg_array[2][1] = "HKCU"
reg_array[2][2] = "ControlPanel\BackLight"
reg_array[2][3] = "DispOn"

; END DEFINABLE VARIALBES
;**********************************************************************

;**********************************************************************
;****************** DO NOT EDIT PAST THIS LINE ************************
;**********************************************************************
; Get boost_speed & safe_speed from registry
; Create registry key & values with defaults if they do not exist
;
reg_BoostSpeed = RegRead("HKLM", "SOFTWARE\Msm7kCpuSpeed", "BoostSpeed")
reg_SafeSpeed = RegRead("HKLM", "SOFTWARE\Msm7kCpuSpeed", "SafeSpeed")

If (reg_BoostSpeed <> 0)
boost_speed = reg_BoostSpeed
Else
RegWriteDWord("HKLM", "SOFTWARE\Msm7kCpuSpeed\", "BoostSpeed", boost_speed)
EndIf

If (reg_SafeSpeed <> 0)
safe_speed = reg_SafeSpeed
Else
RegWriteDWord("HKLM", "SOFTWARE\Msm7kCpuSpeed\", "SafeSpeed", safe_speed)
EndIf

;**********************************************************************
; Check existence of registry keys
; If not found exit with warning
;
reg_root = ""
reg_key = ""
reg_val = ""
ForEach reg_setting in array(reg_array)
If (RegValueExists(reg_setting[1], reg_setting[2], reg_setting[3]) )
reg_root = reg_setting[1]
reg_key = reg_setting[2]
reg_val = reg_setting[3]
EndIf
EndForEach

; Exit if no registry settings where found
If ((reg_root eq "") OR (reg_key eq "") OR (reg_val eq ""))
msg = "Cannot find these registry values:^NL^^NL^"
ForEach reg_setting in array(reg_array)
msg &= " " & reg_setting[1] \ reg_setting[2] \ reg_setting[3] & "^NL^"
EndForEach
msg &= "^NL^Exiting..."
BigMessage(msg, "OverClocking ERROR")
Exit
EndIf

;**********************************************************************
; Create continuous loop
; Set the clock to the desired clock speed
;

; Initally set overclock to 0
RegWriteDWord("HKLM", "SOFTWARE\Msm7kCpuSpeed\", "OverClocked", 0)

While (1)
; Read registry key
value = RegRead(reg_root, reg_key, reg_val)
cpu_overclocked = RegRead("HKLM", "SOFTWARE\Msm7kCpuSpeed", "OverClocked")

; Check if reg value is 0 (screen is off).
; Check if CPU is overclocked.
; If both true, throttle to Safe Speed
If ((value = 0) AND (cpu_overclocked))
RunWait("\Program Files\Msm7kCpuSpeed\Msm7KAutoCpuSpeed.exe", safe_speed)
RegWriteDWord("HKLM", "SOFTWARE\Msm7kCpuSpeed\", "OverClocked", 0)

; Check if reg value is 1 (screen is on).
; Check if CPU is NOT overclocked
; If both true, throttle to Boost Speed
ElseIf ((value <> 0) AND (NOT cpu_overclocked))
RegWriteDWord("HKLM", "SOFTWARE\Msm7kCpuSpeed\", "OverClocked", 1)
RunWait("\Program Files\Msm7kCpuSpeed\Msm7KAutoCpuSpeed.exe", boost_speed)

; No state has change, so sleep
Else
Sleep(5000)
EndIf
EndWhile
Exit

safeClock.mscr

; *****************************************************************************************
; *** Special Thanks to NetRipper for the Msm7kCpuSpeed App
; *** Also thanks jpc073@gmail.com for the work with this mortscript
; *** Website: http://ip208-100-42-21.static.xda-developers.com/showthread.php?t=725290
; ***
; *** Updated: 7/25/2010 by cls_
; *****************************************************************************************

; Use a keyboard mapping program to map this to the SLEEP button.
; This script must run before the phone is put to sleep via the hardware sleep button

;**********************************************************************
; DEFINABLE VARIALBES
; Set your safe speed
; Default Settings: safe_speed=31
; Possible settings:
;41=787
;40=768
;39=748
;38=729
;37=710
;36=691
;35=672
;34=652
;33=633
;32=614
;31=604
;30=576
;29=556
;28=537
safe_speed = 31

; END DEFINABLE VARIALBES
;**********************************************************************

;**********************************************************************
;****************** DO NOT EDIT PAST THIS LINE ************************
;**********************************************************************
; Get safe_speed from registry
; Create registry key & values with defaults if they do not exist
;
reg_SafeSpeed = RegRead("HKLM", "SOFTWARE\Msm7kCpuSpeed", "SafeSpeed")

If (reg_SafeSpeed <> 0)
safe_speed = reg_SafeSpeed
Else
RegWriteDWord("HKLM", "SOFTWARE\Msm7kCpuSpeed\", "SafeSpeed", safe_speed)
EndIf

;**********************************************************************
; Clock CPU to safe speed
;
RunWait("\Program Files\Msm7kCpuSpeed\Msm7KAutoCpuSpeed.exe", safe_speed)
RegWriteDWord("HKLM", "SOFTWARE\Msm7kCpuSpeed\", "OverClocked", 0)
Exit