ZitatOriginal von jwoegerbauer
...
Mach Dir doch keine Mühe mehr in dieser Sache: es scheint tatsächlich NIEMAND ein Interesse hieran zu haben:
@jwoegerbauer
Zu spät. Ich hab die berichtigungen bereits gemacht, und es flutscht
jetzt bei meinem navi. Nochmal danke!
Die von mir geänderten Stellen sind rot gemacht
# POWERNOTIFIER_PROMPT.mscr
#
# 2009-08-28
# J.Wögerbauer
# GNU General Public License (GPL), Version 2, June 1991
#
#
ErrorLevel("off")
Local()
#
#
# note: the exe here defined must be the same as defined in file
# ON_AC_POWER_LOSS.mscr
#
Set OFF_EXE, "Sleep.exe"
Set OFF_EXE_PATH, "\My Flash Disk\SystemProgs\"
Sleep 50
#
#
If (not FileExists( %OFF_EXE_PATH% & %OFF_EXE% ))
# notify user
SleepMessage(3, "Datei^NL^" & %OFF_EXE% & "^NL^nicht gefunden!")
# go out
Exit
EndIf
#
#
Set PN_EXE, "PowerNotify.exe"
Set PN_EXE_PATH, "\My Flash Disk\programme\TroNikPowerNotifier\"
Set INI, "PowerNotifyFlags.ini"
Sleep 50
#
#
If (not FileExists( %PN_EXE_PATH% & %PN_EXE% ))
# notify user
SleepMessage(3, "Datei^NL^" & %PN_EXE% & "^NL^nicht gefunden!")
# go out
Exit
EndIf
#
#
If (not FileExists( %PN_EXE_PATH% & %INI% ))
# notify user
SleepMessage(3, "Datei^NL^" & %INI% & "^NL^nicht gefunden!")
# go out
Exit
EndIf
#
#
Set PN_LNK, "\Windows\Startup\PowerNotify.lnk"
#
#
Set fontSize, "22"
Set fontName, "Verdana"
Set lineHeight, "30"
options[1] = "Aktivieren"
options[2] = "Deaktivieren"
options[3] = "Neu Initialisieren"
options[4] = " "
options[5] = "Deinstallieren"
Sleep(100)
#
#
SetChoiceEntryFormat(%lineHeight%, %fontSize%, %fontName%)
Choice("Auto On/Off Optionen", "^NL^^NL^", options)
Case( 1 )
#
CreateShortcut( %PN_LNK%, %PN_EXE_PATH% & %PN_EXE% )
#
# start PowerNotify.exe that will register for PowerNotifications
#
Run( %PN_EXE_PATH% & %PN_EXE%)
#
Case( 2 )
#
#
# stop PowerNotify.exe
#
If(ProcExists(%PN_EXE%))
Kill(%PN_EXE%)
EndIf
#
Delete( %PN_LNK% )
#
Case( 3 )
# stop PowerNotify.exe
#
If(ProcExists(%PN_EXE%))
Kill(%PN_EXE%)
EndIf
#
#
IniWrite( %PN_EXE_PATH% & %INI%, "PowerOnOff", "PowerFlag", "1" )
Sleep(100)
# re-start PowerNotify.exe
#
Run( %PN_EXE_PATH% & %PN_EXE%)
#
Case( 4)
# nothing to do
Case( 5 )
# stop PowerNotify.exe
#
If(ProcExists(%PN_EXE%))
Kill(%PN_EXE%)
EndIf
#
Delete( %PN_LNK% )
#
# remove all related entries in \My Flash Disk
#
DelTree( %PN_EXE_PATH% )
files[1] = "\My Flash Disk\navigation\menu\desktop\PowerNotifier.xml"
files[2] = "\My Flash Disk\navigation\menu\desktop\PowerNotifier.png"
files[3] = "\My Flash Disk\programme\MortScript\ON_AC_POWER_LOSS_EXE"
files[4] = "\My Flash Disk\programme\MortScript\ON_AC_POWER_LOSS.mscr"
files[5] = "\My Flash Disk\programme\MortScript\ON_AC_POWER_RESUME.EXE"
files[6] = "\My Flash Disk\programme\MortScript\ON_AC_POWER_RESUME.mscr"
files[7] = "\My Flash Disk\programme\MortScript\ON_AC_POWER_DAEMON.EXE"
files[8] = "\My Flash Disk\programme\MortScript\ON_AC_POWER_DAEMON.mscr"
For i = 1 To ElementCount(files) Step 1
Delete( files[i] )
Sleep 50
Next
#
EndChoice
#
#
Exit
# ON_AC_POWER_LOSS.mscr
#
# jwoegerbauer 09/04/2009
# GNU General Public License (GPL), Version 2, June 1991
#
#
#
# NO ERROR CHECKING IS DONE !!!
#
ErrorLevel("off")
#
# Before using this script add these lines to PowerNotifyFlags.ini
# [PowerOnSUSPEND]
# PowerFlag=1
#
Local()
#
#
#
# check for sufficient power or don't run anything and don't resubmit
If (BatteryPercentage() <= 35)
SleepMessage(5, "Battery level is low: " & BatteryPercentage(), "Power Warning", 1))
Exit
EndIf
#
# adjust to your needs
Set WAIT_SECS, 0
#
# prevent ourselves from doing things twice
If (not ExternalPowered())
#
#
Set ON_AC_POWER_DAEMON, "\My Flash Disk\programme\MortScript\ON_AC_POWER_DAEMON.exe"
#
# note: the turn OFF exe here defined must be the same as defined in file
# POWERNOTIFIER_PROMPT.mscr
#
#
Set TURN_OFF, "\My Flash Disk\SystemProgs\Sleep.exe"
Set INI, \
"\My Flash Disk\programme\TroNikPowerNotifier\PowerNotifyFlags.ini"
Sleep(50)
#
# assume the device is running on external power and we unplug
# the usb-powered cable or engined off, and the power is re-supplied
# we should Cancel this script automatically.
# IMO this is a useful case when we use the device in the car in
# ignition mode and then start the engine.
#
# hence we implement now an additional power state listener (a sec timer)
While(%WAIT_SECS% > 0)
#
# 1 second
Sleep(1000)
#
# query current power state
acPower = ExternalPowered()
If (acPower = TRUE )
# power is re-supplied
# therefore we don't go into Standby
Exit
EndIf
%WAIT_SECS% = %WAIT_SECS% - 1
EndWhile
#
#
PlaySound("\My Flash Disk\programme\TroNikPowerNotifier\chime_down.wav")
#
#
Set SECTION, "PowerOnOff"
Set KEY, "PowerFlag"
Sleep(50)
#
# Read PowerFlag value
PowerFlag = IniRead( %INI%, %SECTION%, %KEY% )
#
# On suspend mode we set PowerFlag=0
If(PowerFlag)
#
#
IniWrite( %INI%, %SECTION%, %KEY%, "0" )
Sleep(100)
#
# kill old notification(s) to prevent overlap
RemoveNotifications( %ON_AC_POWER_DAEMON% )
#
# set new notify (will be processed in 1 min from now on)
RunAt( TimeStamp() + 60, %ON_AC_POWER_DAEMON% )
#
# turn device into sleep mode
Run( %TURN_OFF% )
#
#
EndIf
#
#
EndIf
#
#
Exit
# ON_AC_POWER_DAEMON.mscr
#
# jwoegerbauer 09/04/2009
# GNU General Public License (GPL), Version 2, June 1991
#
#
#
# NO ERROR CHECKING IS DONE !!!
#
ErrorLevel("off")
Local()
#
#
# adjust to your needs (seconds !!!!)
Set SUBMIT_TIME, 5
Set ON_AC_POWER_DAEMON, "\My Flash Disk\programme\MortScript\ON_AC_POWER_DAEMON.exe"
Set ON_AC_POWER_RESUME, "\My Flash Disk\programme\MortScript\ON_AC_POWER_RESUME.exe"
Sleep(50)
#
#
If( not ExternalPowered())
#
# kill old notification(s) to prevent overlap
RemoveNotifications( %ON_AC_POWER_DAEMON% )
#
# set new notify
# i.e. check back in SUBMIT_TIME seconds
RunAt( TimeStamp() + %SUBMIT_TIME%, %ON_AC_POWER_DAEMON% )
Else
#
# kill old notification(s) to prevent overlap
RemoveNotifications( %ON_AC_POWER_DAEMON% )
# set new notify
# i.e. check back in SUBMIT_TIME seconds
RunAt( TimeStamp() + %SUBMIT_TIME%, %ON_AC_POWER_RESUME% )
EndIf
#
#
Exit
;PowerNotify.ini
;
PowerACOff=\My Flash Disk\programme\MortScript\ON_AC_POWER_LOSS.exe
PowerACOn=\My Flash Disk\programme\MortScript\ON_AC_POWER_RESUME.exe
;PowerCritical=
;PowerLow=
PowerResume=\My Flash Disk\programme\MortScript\ON_AC_POWER_RESUME.exe