Sign in to follow this  
Followers 0
DicatoroftheUSA

High Contrast/Night Mode

12 posts in this topic

#1 ·  Posted (edited)

Questions in short.

1. How can I detect if windows is in high contrast mode. Here are MS' notes, but I don't know how to translate that into AI.

http://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation.highcontrast%28v=vs.110%29.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-2

1. How is it possible to switch themes without an abnoxious popup. I found the the following tool which I will use for now but I would prefer it to be in autoit, but shows that it may be possible. For my example script below it is needed.

http://winaero.com/comment.php?comment.news.209 
(I am not affilated in any way)  

Scenario

I am pushing out new laptops for guys who work both day and night. They require dark/high contrast at night. The software they use, would automatically toggle the theme for them in XP , however it no longer works with windows 7.

Windows 7 has a hotkey to switch to high contrast mode, but the hotkey "left Shift + left Alt + PrtScn" is a pain to use on the laptops, because they need to use the fn (function) key to access the print screen and you need both hands to do it. Which is a problem as they are used in vehicles with limited space, and gear they wear is restrictive.

So my plan was to write a script that automatically toggles it on for them at sunset/sunrise.

Example Script

This is what I have came up with so for, it uses the themeswitcher from the above link.

Warning! this only has been tested on windows 7, and will probably any other OS to explode violently.

Below is a rouph draft of my script that I am testing. Basically it checks if it after sunsent, if so, it switches to dark theme. To trick it into thinking it is after sunset hack the @hour under the seconds from midnight function.

 

I have to give thanks to tim292stro for  and those who replied.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include<array.au3>
if @OSVersion<>"WIN_7" then
    MsgBox(0,"","Warning this was meant for windows 7 and may cause other OS to violently explode")
    Exit
EndIf
AutoItSetOption("TrayIconDebug", True)
AutoItSetOption("ExpandEnvStrings", True)
AutoItSetOption("TrayAutoPause", False)
Opt("TrayMenuMode", 3)
Opt("TrayOnEventMode", 1)




#Region #inifile globals============

Global Const $gcsINI_File = @ScriptDir & "\DarkThemeToggle.ini"
Global Const $gcsINI_Section = @UserName
Global Const $gcsDisabledKey = "Disabled"
#EndRegion #inifile globals============

#Region #themswitcher globals
Global Const $gcsThemeSwitcherContainerDir = _Inier("ThemeSwitcherContainter", @ScriptDir)
Global Const $gcsThemeSwitcher = "ThemeSwitcher.exe"
#EndRegion

#Region #Theme Switching globals============
Global Const $gsLightTHeme = _Inier("LightTheme", RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes", "CurrentTheme"))
Global Const $gsDarkTHeme = _Inier("DarkTheme", "C:\Windows\resources\Ease of Access Themes\hcblack.theme")
#EndRegion #Theme Switching globals============

#Region Tray icon globals
Global $gbDisabled = _Inier("Disabled", "False")
if $gbDisabled="False" OR 0 then
    $gbDisabled=False
Else
    $gbDisabled=True
    EndIf
Global $ghDisableItem
Global $ghCloseItem
#EndRegion Tray icon globals
#Region #Solar Sunset CONSTANTS# ===================================================================================================================
Global Const $gcPi = 4 * ATan(1)
Global Const $gcaMonthLength[12] = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
Global Const $iMonthAbrev[12] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
global $gcnLatitude=IniRead($gcsINI_File,$gcsINI_Section,"Latitude",-1111)

While $gcnLatitude<-90 OR $gcnLatitude >90
    $nReturn=InputBox("Latitude","Enter Latitude, use negative number for South")
    if @error then Exit
    _inier("Latitude",$nReturn)
WEnd


global $gcnLongitude=IniRead($gcsINI_File,$gcsINI_Section,"Latitude",-1111)

While $gcnLongitude<-180 OR $gcnLatitude >180
    $nReturn=InputBox("Longitude","Enter Longitude, use negative number for east")
    if @error then Exit
    _inier("Longitude",$nReturn)
WEnd


#EndRegion #Solar Sunset CONSTANTS# =========

Func _CheckThemeSwitch()
    If Not FileExists($gcsThemeSwitcherContainerDir & "\" & $gcsThemeSwitcher) Then
        MsgBox(0, "error", "Could not find themeswitcher, please download it and put it in the following path:" & $gcsThemeSwitcherContainerDir)
        ShellExecute("http://winaero.com")
        Exit
    EndIf
EndFunc   ;==>_CheckThemeSwitch


_main()

Func _Inier($sKey, $xValue)
    $sReturn = IniRead($gcsINI_File, $gcsINI_Section, $sKey, -1)
    ConsoleWrite("read ini key:" & $sKey & ",   value:" & $xValue & @LF)
    If $sReturn = -1 Then
        $sReturn = $xValue
        IniWrite($gcsINI_File, $gcsINI_Section, $sKey, $xValue)
        ConsoleWrite("Wrote ini key:" & $sKey & ",  value:" & $xValue & @LF)
    EndIf
    Return $sReturn
EndFunc   ;==>_Inier

Func _TraySetup()
    $ghDisableItem = TrayCreateItem("Disable Night Mode")
    TrayItemSetOnEvent($ghDisableItem, "_ToggleEnabled")
    $ghCloseItem = TrayCreateItem("Close")
    TrayItemSetOnEvent($ghCloseItem, "_exit")
    _CheckDisableTray()
EndFunc   ;==>_TraySetup
Func _ToggleEnabled()

    $gbDisabled = Not $gbDisabled

    IniWrite($gcsINI_File, $gcsINI_Section, $gcsDisabledKey, $gbDisabled)
    _CheckDisableTray()

EndFunc   ;==>_ToggleEnabled

Func _CheckDisableTray()
    $TRAY_CHECKEd=1
    $TRAY_unchecked=4
    $Tray_enabled=64
    local $state=""
    ConsoleWrite("Disabled?:"&$gbDisabled & @LF)

    if $gbDisabled then
        $state=BitOR($Tray_enabled,$TRAY_CHECKEd)
    Else
        $state=BitOR($Tray_enabled,$TRAY_unchecked)
    EndIf
    TrayItemSetState($ghDisableItem, $state)


EndFunc   ;==>_CheckDisableTray



Func _main()
    _TraySetup()

    Const $ciSunriseIndex = 1
    Const $ciSunsetIndex = 3
    CONST $icSecondsInADay=86400
    Const $cbWarningDialogPrompt = 8
    Const $cbNoiseOnToggle = 16
    Const $csRegThemeKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes"
    Const $csRegValue = "CurrentTheme"
    Local $iSleepSeconds = 60
    LOCAL $iSecondsTillChange=""
    Local $bNight = False
    Local $sCurrent = ""
    While 1
        $aSolarTimes = _GetSolarAstronimicalData($gcnLatitude,$gcnLongitude)
        ConsoleWrite("sunrise:" & _SecondsFromMidnight($aSolarTimes[$ciSunriseIndex]) & @LF)
        ConsoleWrite("Now:&" & _SecondsFromMidnight() & @LF)
        ConsoleWrite("sunset:" & _SecondsFromMidnight($aSolarTimes[$ciSunsetIndex]) & @LF)
        $iSunriseFromMidnightSeconds=_SecondsFromMidnight($aSolarTimes[$ciSunriseIndex])
        $iNowFromMidnightSeconds=_SecondsFromMidnight()
        $iSunsSetFromMidnightSeconds=_SecondsFromMidnight($aSolarTimes[$ciSunsetIndex])

        SELECT
        CASE $iNowFromMidnightSeconds<$iSunriseFromMidnightSeconds
            $iSecondsTillChange=$iSunriseFromMidnightSeconds-$iNowFromMidnightSeconds
            $bNight=True

        CASE $iNowFromMidnightSeconds>$iSunsSetFromMidnightSeconds
            $iSecondsTillChange=$icSecondsInADay-$iNowFromMidnightSeconds

            $bNight=True
        case Else
            $iSecondsTillChange=$iSunsSetFromMidnightSeconds-$iNowFromMidnightSeconds
            $bNight=False
        EndSelect





        $sCurrentTheme = RegRead($csRegThemeKey, $csRegValue)

        If StringInStr($sCurrentTheme, $gsDarkTHeme) Then
            $bDarkThemeActive = True
        Else
            $bDarkThemeActive = False
        EndIf




        If $bNight * (not $bDarkThemeActive) * (Not $gbDisabled) Then _theme($gsDarkTHeme)

        If (Not $bNight) and $bDarkThemeActive or $gbDisabled Then _theme($gsLightTHeme)
        $bLast = $gbDisabled
        For $i = 1 To $iSecondsTillChange
            Sleep(1000)

            If $bLast <> $gbDisabled Then ExitLoop
        Next
    WEnd
EndFunc   ;==>_main
Func _test()
    ConsoleWrite(BitAND(4199, 32) & @LF)
EndFunc   ;==>_test
Func _exit()

    _theme($gsLightTHeme)
    Exit
EndFunc   ;==>_exit

Func _theme($sThemeFile)
    static $_sLast=""
    if $_sLast=$sThemeFile then Return
    Run('themeswitcher.exe "' & $sThemeFile & '"', $gcsThemeSwitcherContainerDir)
    ConsoleWrite("Setting theme to " & $sThemeFile & @LF)
    $_sLast=$sThemeFile

EndFunc   ;==>_theme

Func _SecondsFromMidnight($sHHMM = "")

    If $sHHMM = "" Then
        $iSeconds =@HOUR * 3600 + @MIN * 60
    Else
        Const $cHourIndex = 1
        Const $cMinuteIndex = 2
        $aTime = StringSplit($sHHMM, ":")
        $iSeconds = $aTime[$cHourIndex] * 3600 + $aTime[$cMinuteIndex] * 60
    EndIf
    Return ($iSeconds)
EndFunc   ;==>_SecondsFromMidnight




; #CURRENT# =====================================================================================================================
;_GetSolarAstronimicalData
; ===============================================================================================================================

; #FUNCTION# ====================================================================================================================
; Name...........: _GetSolarAstronimicalData
; Description ...: CalcuLatitudee the position of the sun reLatitudeive to a position on earth for a given time/date.
; Syntax.........: _GetSolarAstronimicalData ( $Latitudeitude, $Longitude, $iMonth, $MDay, $iYear, $nTotalJulianTimeimeZone, $nHour, $nMinute, $Second, $iDayLightSavingsTime )
; Parameters ....: $Latitudeitude     - The Latitudeitude portion of the earth position to calcuLatitudee the sun's position reLatitudeive to (float)
;                  $Longitude     - The Latitudeitude portion of the earth position to calcuLatitudee the sun's position reLatitudeive to (float)
;                  $iMonth     - The month of the year you are calcuLatitudeing for (numeric-string: "1-12")
;                  $MDay     - The day of the month you are calcuLatitudeing for (numeric-string: "1-31")
;                  $iYear     - The year you are calcuLatitudeing for (numeric-string: "-2000 to 3000")
;                  $nTotalJulianTimeimeZone     - The time zone you are calcuLatitudeing for (numeric-string: "-11 to 12")
;                  $nHour     - Optional!  The hour you are calcuLatitudeing for in 24-hrs (numeric-string: "0-23")
;                  $nMinute     - Optional!  The minute you are calcuLatitudeing for (numeric-string: "00-59")
;                  $Second    - Optional!  The second you are calcuLatitudeing for (numeric-string: "00-59")
;                  $iDayLightSavingsTime     - Optional!  Is Daylight Saving's Time in effect? (boolean)
; Return values .: Success - Returns an array with the following values:
;                            0 = Element count. If count = 3, then only items 1-3 available.  If count = 6, then all elements available)
;                            1 = Sunrise time "07:12" 24-hr time, or "07:12 Jul 17" if position is near international date line
;                            2 = Solar Noon "13:16:46" 24-hr time with seconds.  Higest point of sun in sky.
;                            3 = Sunset time "19:22" 24-hr time, or "19:22 Jul 19" if position is near international date line
;                            4 = Sun Azimuth in Degreerees reLatitudeive to computed position (0Degree = true north, 180Degree = true south, 90Degree = East, 270 = West)
;                            5 = Sun Elevation is Degreerees reLatitudeive to computed position at sea-level
;                            6 = Ambient light disposition (possibilities: Day, Civil Twilight, Nautical Twilight, Astronomical Twilight, Night)
; Author ........: Tim Strommen (tim292stro)
; Modified.......:
; Remarks .......: Again, special thanks to NOAA for allowing re-use of their code!!  See: "http://www.esrl.noaa.gov/"
; ReLatitudeed .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _GetSolarAstronimicalData($nAstroLatitude = "", $nAstroLong = "", $nAstroMonth = "", $nAstroDay = "", $nAstroYear = "", $nAstroTimeZone = "", $nAstroHour = "", $nAstroMinute = "", $nAstroSecond = "", $AstroDST = False)
    Local $aSolarTimes[7]

    If ($nAstroLatitude = "") Or ($nAstroLong = "") Then
        ; Return current Greenwich, UK basic times with current solar position
        $nAstroLatitude = "51.48"
        $nAstroLong = "0.000000001"
        $nAstroTimeZone = "0"
        $nAstroMonth = @MON
        $nAstroDay = @MDAY
        $nAstroYear = @YEAR
        $nAstroHour = @HOUR
        $nAstroMinute = @MIN
        $nAstroSecond = @SEC
        $aSolarTimes = _SolarCalcuLatitudee($nAstroLatitude, $nAstroLong, $nAstroMonth, $nAstroDay, $nAstroYear, $nAstroTimeZone, $nAstroHour, $nAstroMinute, $nAstroSecond, $AstroDST, True)
        Return $aSolarTimes
    ElseIf $nAstroHour = "" Then
        ; Just return the specified day's basic times, no current solar position
        $nAstroHour = "12"
        $nAstroMinute = "00"
        $nAstroSecond = "00"
        $aSolarTimes = _SolarCalcuLatitudee($nAstroLatitude, $nAstroLong, $nAstroMonth, $nAstroDay, $nAstroYear, $nAstroTimeZone, $nAstroHour, $nAstroMinute, $nAstroSecond, $AstroDST, False)
        Return $aSolarTimes
    Else
        ; Return both the basic times, plus the current solar position
        $aSolarTimes = _SolarCalcuLatitudee($nAstroLatitude, $nAstroLong, $nAstroMonth, $nAstroDay, $nAstroYear, $nAstroTimeZone, $nAstroHour, $nAstroMinute, $nAstroSecond, $AstroDST, True)
        Return $aSolarTimes
    EndIf
EndFunc   ;==>_GetSolarAstronimicalData

Func _CalcTimeJulianCent($nJulianDay = 0)
    Local $nJulianTime = ($nJulianDay - 2451545.0) / 36525.0
    Return $nJulianTime
EndFunc   ;==>_CalcTimeJulianCent

Func _CalcJDFromJulianCent($nTotalJulianTime = 0)
    Local $nJulianDay = $nTotalJulianTime * 36525.0 + 2451545.0
    Return $nJulianDay
EndFunc   ;==>_CalcJDFromJulianCent

Func _isLeapYear($yr = 0)
    Return ((Mod($yr, 4) And Mod($yr, 100)) Or (Mod($yr, 400) = 0))
EndFunc   ;==>_isLeapYear

Func _calcDoyFromJD($nJulianDay = 0)
    Local $z = Floor($nJulianDay + 0.5)
    Local $f = ($nJulianDay + 0.5) - $z
    Local $iStepA, $alpha, $iStepB, $iStepC, $iStepD, $nDayOfYear, $iStepE, $iDay, $iMonth, $iYear, $iLeapYear
    If $z < 2299161 Then
        $iStepA = $z
    Else
        $alpha = Floor(($z - 1867216.25) / 36524.25)
        $iStepA = $z + 1 + $alpha - Floor($alpha / 4)
    EndIf
    $iStepB = $iStepA + 1524
    $iStepC = Floor(($iStepB - 122.1) / 365.25)
    $iStepD = Floor(365.25 * $iStepC)
    $iStepE = Floor(($iStepB - $iStepD) / 30.6001)
    $iDay = $iStepB - $iStepD - Floor(30.6001 * $iStepE) + $f
    If $iStepE < 14 Then
        $iMonth = $iStepE - 1
    Else
        $iMonth = $iStepE - 13
    EndIf
    If $iMonth > 2 Then
        $iYear = $iStepC - 4716
    Else
        $iYear = $iStepC - 4715
    EndIf
    If _isLeapYear($iYear) Then
        $iLeapYear = 1
    Else
        $iLeapYear = 2
    EndIf
    $nDayOfYear = Floor((275 * $iMonth) / 9) - $iLeapYear * Floor(($iMonth + 9) / 12) + $iDay - 30
    Return $nDayOfYear
EndFunc   ;==>_calcDoyFromJD

Func _RadeanToDegree($AngleRadean = 0)
    Return 180.0 * $AngleRadean / $gcPi
EndFunc   ;==>_RadeanToDegree

Func _DegreeToRadean($nAngleDegree = 0)

    Return $gcPi * $nAngleDegree / 180.0
EndFunc   ;==>_DegreeToRadean

Func _calcGeomMeanLongSun($nTotalJulianTime = 0)
    Local $nlLongitudinalMeanSunDegrees = 280.46646 + $nTotalJulianTime * (36000.76983 + $nTotalJulianTime * (0.0003032))
    While $nlLongitudinalMeanSunDegrees > 360.0
        $nlLongitudinalMeanSunDegrees -= 360.0
    WEnd
    While $nlLongitudinalMeanSunDegrees < 0.0
        $nlLongitudinalMeanSunDegrees += 360.0
    WEnd
    Return $nlLongitudinalMeanSunDegrees ; in Degreerees
EndFunc   ;==>_calcGeomMeanLongSun

Func _calcGeomMeanAnomalySun($nTotalJulianTime = 0)
    Local $nSunMeanAnomalyRadeans = 357.52911 + $nTotalJulianTime * (35999.05029 - 0.0001537 * $nTotalJulianTime)
    Return $nSunMeanAnomalyRadeans ; in Degreerees
EndFunc   ;==>_calcGeomMeanAnomalySun

Func _calcEccentricityEarthOrbit($nTotalJulianTime = 0)
    Local $iStepE = 0.016708634 - $nTotalJulianTime * (0.000042037 + 0.0000001267 * $nTotalJulianTime)
    Return $iStepE ; unitless
EndFunc   ;==>_calcEccentricityEarthOrbit

Func _calcSunEqOfCenter($nTotalJulianTime = 0)
    Local $nSunMeanAnomalyRadeans = _calcGeomMeanAnomalySun($nTotalJulianTime)
    Local $mRadean = _DegreeToRadean($nSunMeanAnomalyRadeans)
    Local $nSinmRadeans = Sin($mRadean)
    Local $sin2m = Sin($mRadean + $mRadean)
    Local $sin3m = Sin($mRadean + $mRadean + $mRadean)
    Local $iStepC = $nSinmRadeans * (1.914602 - $nTotalJulianTime * (0.004817 + 0.000014 * $nTotalJulianTime)) + $sin2m * (0.019993 - 0.000101 * $nTotalJulianTime) + $sin3m * 0.000289
    Return $iStepC
EndFunc   ;==>_calcSunEqOfCenter

Func _calcSunTrueLong($nTotalJulianTime = 0)
    Local $lo = _calcGeomMeanLongSun($nTotalJulianTime)
    Local $iStepC = _calcSunEqOfCenter($nTotalJulianTime)
    Local $O = $lo + $iStepC
    Return $O ; in Degreerees
EndFunc   ;==>_calcSunTrueLong

Func _calcSunTrueAnomaly($nTotalJulianTime = 0)
    Local $nSunMeanAnomalyRadeans = _calcGeomMeanAnomalySun($nTotalJulianTime)
    Local $iStepC = _calcSunEqOfCenter($nTotalJulianTime)
    Local $v = $nSunMeanAnomalyRadeans + $iStepC
    Return $v
EndFunc   ;==>_calcSunTrueAnomaly

Func _calcSunRadeanVector($nTotalJulianTime = 0)
    Local $v = _calcSunTrueAnomaly($nTotalJulianTime)
    Local $iStepE = _calcEccentricityEarthOrbit($nTotalJulianTime)
    Local $R = (1.000001018 * (1 - $iStepE * $iStepE)) / (1 + $iStepE * Cos(_DegreeToRadean($v)))
    Return $R ; in AUs
EndFunc   ;==>_calcSunRadeanVector

Func _calcSunApparentLong($nTotalJulianTime = 0)
    Local $O = _calcSunTrueLong($nTotalJulianTime)
    Local $omega = 125.04 - 1934.136 * $nTotalJulianTime
    Local $lambda = $O - 0.00569 - 0.00478 * Sin(_DegreeToRadean($omega))
    Return $lambda ; in Degreerees
EndFunc   ;==>_calcSunApparentLong

Func _calcMeanObliquityOfEcliptic($nTotalJulianTime = 0)
    Local $seconds = 21.448 - $nTotalJulianTime * (46.8150 + $nTotalJulianTime * (0.00059 - $nTotalJulianTime * (0.001813)))
    Local $e0 = 23.0 + (26.0 + ($seconds / 60.0)) / 60.0
    Return $e0 ; in Degreerees
EndFunc   ;==>_calcMeanObliquityOfEcliptic

Func _calcObliquityCorrection($nTotalJulianTime = 0)
    Local $e0 = _calcMeanObliquityOfEcliptic($nTotalJulianTime)
    Local $omega = 125.04 - 1934.136 * $nTotalJulianTime
    Local $iStepE = $e0 + 0.00256 * Cos(_DegreeToRadean($omega))
    Return $iStepE
EndFunc   ;==>_calcObliquityCorrection

Func _calcSunRtAscension($nTotalJulianTime = 0)
    Local $iStepE = _calcObliquityCorrection($nTotalJulianTime)
    Local $lambda = _calcSunApparentLong($nTotalJulianTime)
    Local $nTotalJulianTimeananum = (Cos(_DegreeToRadean($iStepE)) * Sin(_DegreeToRadean($lambda)))
    Local $nTotalJulianTimeanadenom = (Cos(_DegreeToRadean($lambda)))
    Local $alpha = _RadeanToDegree(_atan2($nTotalJulianTimeananum, $nTotalJulianTimeanadenom))
    Return $alpha ; in Degreerees
EndFunc   ;==>_calcSunRtAscension

Func _atan2($x, $nYRadeans)

    If $nYRadeans < 0 Then
        Return -_atan2($x, -$nYRadeans)
    ElseIf $x < 0 Then
        Return $gcPi - ATan(-$nYRadeans / $x)
    ElseIf $x > 0 Then
        Return ATan($nYRadeans / $x)
    ElseIf $nYRadeans <> 0 Then
        Return $gcPi / 2
    Else
        MsgBox(16, "Error - Division by zero", "Domain Error in Function: ATan2()" & @LF & "$x and $nYRadeans cannot both equal zero")
        SetError(1)
    EndIf
EndFunc   ;==>_atan2


Func _calcSunDeclination($nTotalJulianTime = 0)
    Local $iStepE = _calcObliquityCorrection($nTotalJulianTime)
    Local $lambda = _calcSunApparentLong($nTotalJulianTime)
    Local $sint = Sin(_DegreeToRadean($iStepE)) * Sin(_DegreeToRadean($lambda))
    Local $nTotalJulianTimeheta = _RadeanToDegree(ASin($sint))
    Return $nTotalJulianTimeheta ; in Degreerees
EndFunc   ;==>_calcSunDeclination

Func _calcEquationOfTime($nTotalJulianTime = 0)
    Local $nObligiquityCorrection = _calcObliquityCorrection($nTotalJulianTime)
    Local $nlLongitudinalMeanSunDegrees = _calcGeomMeanLongSun($nTotalJulianTime)
    Local $iEccentricEarthOrbit = _calcEccentricityEarthOrbit($nTotalJulianTime)
    Local $nSunMeanAnomalyRadeans = _calcGeomMeanAnomalySun($nTotalJulianTime)
    Local $nYRadeans = Tan(_DegreeToRadean($nObligiquityCorrection) / 2.0)
    $nYRadeans *= $nYRadeans
    Local $nSin2l0Radeans = Sin(2.0 * _DegreeToRadean($nlLongitudinalMeanSunDegrees))
    Local $nSinmRadeans = Sin(_DegreeToRadean($nSunMeanAnomalyRadeans))
    Local $cos2l0Radeans = Cos(2.0 * _DegreeToRadean($nlLongitudinalMeanSunDegrees))
    Local $sin4l0Radeans = Sin(4.0 * _DegreeToRadean($nlLongitudinalMeanSunDegrees))
    Local $sin2m = Sin(2.0 * _DegreeToRadean($nSunMeanAnomalyRadeans))
    Local $Etime = $nYRadeans * $nSin2l0Radeans - 2.0 * $iEccentricEarthOrbit * $nSinmRadeans + 4.0 * $iEccentricEarthOrbit * $nYRadeans * $nSinmRadeans * $cos2l0Radeans - 0.5 * $nYRadeans * $nYRadeans * $sin4l0Radeans - 1.25 * $iEccentricEarthOrbit * $iEccentricEarthOrbit * $sin2m
    Return _RadeanToDegree($Etime) * 4.0 ; in minutes of time
EndFunc   ;==>_calcEquationOfTime

;SunRise = Horizon+0.8333
Func _calcHourAngleSunrise($Latitude, $solarDec)
    Local $LatitudeRadean = _DegreeToRadean($Latitude)
    Local $sdRadean = _DegreeToRadean($solarDec)
    Local $HAarg = (Cos(_DegreeToRadean(90.833)) / (Cos($LatitudeRadean) * Cos($sdRadean)) - Tan($LatitudeRadean) * Tan($sdRadean))
    Local $nSunAngleTerminationRadeans = ACos($HAarg)
    Return $nSunAngleTerminationRadeans ;  in Radeanians for morning (for evening, use -HA)
EndFunc   ;==>_calcHourAngleSunrise




;CivilTwilight = (Horizon+6) < SunCenter < (Horizon+0.8333)
Func _calcHourAngleCivilTwilight($Latitude, $solarDec)
    Local $LatitudeRadean = _DegreeToRadean($Latitude)
    Local $sdRadean = _DegreeToRadean($solarDec)
    Local $HAarg = (Cos(_DegreeToRadean(96.0)) / (Cos($LatitudeRadean) * Cos($sdRadean)) - Tan($LatitudeRadean) * Tan($sdRadean))
    Local $nSunAngleTerminationRadeans = ACos($HAarg)
    Return $nSunAngleTerminationRadeans ;  in Radeanians for morning (for evening, use -HA)
EndFunc   ;==>_calcHourAngleCivilTwilight





Func _isNumber($inputval)
    Return (IsFloat($inputval) Or IsNumber($inputval) Or IsInt($inputval))
EndFunc   ;==>_isNumber

Func _zeroPad($n, $digits)
    $n = String($n)
    While StringLen($n) < $digits
        $n = "0" & $n
    WEnd
    Return $n
EndFunc   ;==>_zeroPad

Func _GetJulianDay($CompJDMon = "", $CompJDDay = "", $CompJDYear = "")

    If ((_isLeapYear($CompJDYear)) And ($CompJDMon = 2)) Then
        If $CompJDDay > 29 Then
            $CompJDDay = 29
        EndIf
    Else
        If $CompJDDay > $gcaMonthLength[$CompJDMon] Then
            $CompJDDay = $gcaMonthLength[$CompJDMon]
        EndIf
    EndIf
    If $CompJDMon <= 2 Then
        $CompJDYear -= 1
        $CompJDMon += 12
    EndIf
    Local $iStepA = Floor($CompJDYear / 100)
    Local $iStepB = 2 - $iStepA + Floor($iStepA / 4)
    Local $nJulianDay = Floor(365.25 * ($CompJDYear + 4716)) + Floor(30.6001 * ($CompJDMon + 1)) + $CompJDDay + $iStepB - 1524.5
    Return $nJulianDay
EndFunc   ;==>_GetJulianDay

Func _getTimeLocal($CompHour = "", $CompMin = "", $CompSec = "", $CompDST = False)
    If ($CompDST) Then
        $CompHour -= 1
    EndIf
    Local $mins = $CompHour * 60 + $CompMin + $CompSec / 60.0
    Return $mins
EndFunc   ;==>_getTimeLocal

Func _CalcuLatitudeeAzimuthElivation($nTotalJulianTime, $localtime, $Latitudeitude, $longitude, $zone)
    Local $SolarReturnAzEl[1] = [0]
    Local $SolarLightStatus, $nAzimuthRadean
    Local $eqTime = _calcEquationOfTime($nTotalJulianTime)
    Local $nTotalJulianTimeheta = _calcSunDeclination($nTotalJulianTime)

    Local $solarTimeFix = $eqTime + 4.0 * $longitude - 60.0 * $zone
    Local $nTotalJulianTimerueSolarTime = $localtime + $solarTimeFix
    While $nTotalJulianTimerueSolarTime > 1440
        $nTotalJulianTimerueSolarTime -= 1440
    WEnd
    Local $nHourAngle = $nTotalJulianTimerueSolarTime / 4.0 - 180.0;
    If $nHourAngle < -180 Then
        $nHourAngle += 360.0
    EndIf
    Local $haRadean = _DegreeToRadean($nHourAngle)
    Local $csz = Sin(_DegreeToRadean($Latitudeitude)) * Sin(_DegreeToRadean($nTotalJulianTimeheta)) + Cos(_DegreeToRadean($Latitudeitude)) * Cos(_DegreeToRadean($nTotalJulianTimeheta)) * Cos($haRadean)
    If $csz > 1.0 Then
        $csz = 1.0
    ElseIf $csz < -1.0 Then
        $csz = -1.0
    EndIf
    Local $zenith = _RadeanToDegree(ACos($csz))
    Local $azDenom = (Cos(_DegreeToRadean($Latitudeitude)) * Sin(_DegreeToRadean($zenith)))
    If Abs($azDenom) > 0.001 Then
        $nAzimuthRadean = ((Sin(_DegreeToRadean($Latitudeitude)) * Cos(_DegreeToRadean($zenith))) - Sin(_DegreeToRadean($nTotalJulianTimeheta))) / $azDenom
        If Abs($nAzimuthRadean) > 1.0 Then
            If $nAzimuthRadean < 0 Then
                $nAzimuthRadean = -1.0
            Else
                $nAzimuthRadean = 1.0
            EndIf
        EndIf
        Local $azimuth = 180.0 - _RadeanToDegree(ACos($nAzimuthRadean))
        If $nHourAngle > 0.0 Then
            $azimuth = -$azimuth
        EndIf
    Else
        If $Latitudeitude > 0.0 Then
            $azimuth = 180.0
        Else
            $azimuth = 0.0
        EndIf
    EndIf
    If $azimuth < 0.0 Then
        $azimuth += 360.0
    EndIf
    Local $exoatmElevation = 90.0 - $zenith
    ; Atmospheric Refraction correction
    If $exoatmElevation > 85.0 Then
        Local $refractionCorrection = 0.0
    Else
        Local $nTotalJulianTimee = Tan(_DegreeToRadean($exoatmElevation))
        If $exoatmElevation > 5.0 Then
            $refractionCorrection = 58.1 / $nTotalJulianTimee - 0.07 / ($nTotalJulianTimee * $nTotalJulianTimee * $nTotalJulianTimee) + 0.000086 / ($nTotalJulianTimee * $nTotalJulianTimee * $nTotalJulianTimee * $nTotalJulianTimee * $nTotalJulianTimee)
        ElseIf $exoatmElevation > -0.575 Then
            $refractionCorrection = 1735.0 + $exoatmElevation * (-518.2 + $exoatmElevation * (103.4 + $exoatmElevation * (-12.79 + $exoatmElevation * 0.711)))
        Else
            $refractionCorrection = -20.774 / $nTotalJulianTimee
        EndIf
        $refractionCorrection = $refractionCorrection / 3600.0
    EndIf

    Local $solarZen = $zenith - $refractionCorrection

    If $solarZen > 108.0 Then
        $SolarLightStatus = "Night"
    ElseIf ((108.0 > $solarZen) And ($solarZen >= 102.0)) Then
        $SolarLightStatus = "Astronomical Twilight"
    ElseIf ((102.0 > $solarZen) And ($solarZen >= 96.0)) Then
        $SolarLightStatus = "Nautical Twilight"
    ElseIf ((96.0 > $solarZen) And ($solarZen >= 90.8333)) Then
        $SolarLightStatus = "Civil Twilight"
    Else
        $SolarLightStatus = "Day"
    EndIf

    _ArrayAdd($SolarReturnAzEl, Floor((($azimuth * 100) + 0.5) / 100.0))
    _ArrayAdd($SolarReturnAzEl, Floor((90.0 - $solarZen) * 100 + 0.5) / 100.0)
    _ArrayAdd($SolarReturnAzEl, $SolarLightStatus)
    _ArrayDelete($SolarReturnAzEl, 0)

    Return ($SolarReturnAzEl)
EndFunc   ;==>_CalcuLatitudeeAzimuthElivation



Func _calcSolNoon($nJulianDay, $longitude, $nTotalJulianTimeimezone, $iDayLightSavingsTime)
    Local $nJulianTimeNoon = _CalcTimeJulianCent($nJulianDay - $longitude / 360.0)
    Local $eqTime = _calcEquationOfTime($nJulianTimeNoon)
    Local $solNoonOffset = 720.0 - ($longitude * 4) - $eqTime ; in minutes
    Local $nJulianNoonOffset = _CalcTimeJulianCent($nJulianDay + $solNoonOffset / 1440.0)

    $eqTime = _calcEquationOfTime($nJulianNoonOffset)
    Local $nSunAtNoonLocal = 720 - ($longitude * 4) - $eqTime + ($nTotalJulianTimeimezone * 60.0) ; in minutes
    If $iDayLightSavingsTime Then $nSunAtNoonLocal += 60.0
    Return _timeString($nSunAtNoonLocal, 3)
EndFunc   ;==>_calcSolNoon

Func _dayString($nJulianDay, $next, $iFlag)
    ; returns a string in the form DDMMMYYYY[ next] to display prev/next rise/set
    ; flag=2 for DD MMM, 3 for DD MM YYYY, 4 for YYYYMMDD next/prev
    Local $sOutPut, $iStepA
    If ($nJulianDay < 900000) Or ($nJulianDay > 2817000) Then
        $sOutPut = "error"
        SetError(1)
        Return $sOutPut
    EndIf

    Local $z = Floor($nJulianDay + 0.5)
    Local $f = ($nJulianDay + 0.5) - $z
    If $z < 2299161 Then
        $iStepA = $z
    Else
        Local $alpha = Floor(($z - 1867216.25) / 36524.25)
        $iStepA = $z + 1 + $alpha - Floor($alpha / 4)
    EndIf
    Local $iStepB = $iStepA + 1524
    Local $iStepC = Floor(($iStepB - 122.1) / 365.25)
    Local $iStepD = Floor(365.25 * $iStepC)
    Local $iStepE = Floor(($iStepB - $iStepD) / 30.6001)
    Local $iDay = $iStepB - $iStepD - Floor(30.6001 * $iStepE) + $f
    Local $iMonth
    If $iStepE < 14 Then
        $iMonth = $iStepE - 1
    Else
        $iMonth = $iStepE - 13
    EndIf
    Local $iYear
    If $iMonth > 2 Then
        $iYear = $iStepC - 4716
    Else
        $iYear = $iStepC - 4715
    EndIf
    Switch $iFlag
        Case 2
            $sOutPut = _zeroPad($iDay, 2) & " " & $iMonthAbrev[$iMonth - 1]
        Case 3
            $sOutPut = _zeroPad($iDay, 2) & $iMonthAbrev[$iMonth - 1] & String($iYear)
        Case 4
            If $next Then
                $sOutPut = String($iYear) & $iMonthAbrev[$iMonth - 1] & _zeroPad($iDay, 2)
            Else
                $sOutPut = String($iYear) & $iMonthAbrev[$iMonth - 1] & _zeroPad($iDay, 2)
            EndIf
    EndSwitch

    Return $sOutPut
EndFunc   ;==>_dayString





Func _TimeDateString($nJulianDay, $nMinutes)
    Local $sOutPut = _timeString($nMinutes, 2) & " " & _dayString($nJulianDay, 0, 2)
    Return $sOutPut
EndFunc   ;==>_TimeDateString

Func _timeString($nMinutes, $iFlag)
    ; timeString returns a zero-padded string (HH:MM:SS) given time in minutes
    ; flag=2 for HH:MM, 3 for HH:MM:SS
    If (($nMinutes >= 0) And ($nMinutes < 1440)) Then
        Local $bFloatHour = $nMinutes / 60.0
        Local $nHour = Floor($bFloatHour)
        Local $nFloatMinute = 60.0 * ($bFloatHour - Floor($bFloatHour))
        Local $nMinute = Floor($nFloatMinute)
        Local $nFloatSecond = 60.0 * ($nFloatMinute - Floor($nFloatMinute))
        Local $second = Floor($nFloatSecond + 0.5)
        If ($second > 59) Then
            $second = 0
            $nMinute += 1
        EndIf
        If (($iFlag = 2) And ($second >= 30)) Then $nMinute += 1
        If ($nMinute > 59) Then
            $nMinute = 0
            $nHour += 1
        EndIf
        Local $sOutPut = _zeroPad($nHour, 2) & ":" & _zeroPad($nMinute, 2)
        If $iFlag > 2 Then $sOutPut = $sOutPut & ":" & _zeroPad($second, 2)
    Else
        $sOutPut = "error"
    EndIf
    Return $sOutPut
EndFunc   ;==>_timeString

Func _calcSunriseSetUTC($rise, $nJulianDay, $Latitudeitude, $longitude)
    Local $nTotalJulianTime = _CalcTimeJulianCent($nJulianDay)
    Local $eqTime = _calcEquationOfTime($nTotalJulianTime)
    Local $solarDec = _calcSunDeclination($nTotalJulianTime)
    Local $RiseSetAngle = _calcHourAngleSunrise($Latitudeitude, $solarDec)
    If Not $rise Then $RiseSetAngle = -$RiseSetAngle
    Local $delta = $longitude + _RadeanToDegree($RiseSetAngle)
    Local $nTotalJulianTimeimeUTCRS = 720 - (4.0 * $delta) - $eqTime
    Return $nTotalJulianTimeimeUTCRS ; in minutes
EndFunc   ;==>_calcSunriseSetUTC

Func _calcSunriseSet($rise, $nJulianDay, $Latitudeitude, $longitude, $nTotalJulianTimeimezone, $iDayLightSavingsTime)
    ; rise = 1 for sunrise, 0 for sunset
    Local $nTotalJulianTimeimeUTC = _calcSunriseSetUTC($rise, $nJulianDay, $Latitudeitude, $longitude)
    Local $nJulianNoonOffsetimeUTC = _calcSunriseSetUTC($rise, $nJulianDay + $nTotalJulianTimeimeUTC / 1440.0, $Latitudeitude, $longitude)
    If IsNumber($nJulianNoonOffsetimeUTC) Then
        Local $nTimeLocal = $nJulianNoonOffsetimeUTC + ($nTotalJulianTimeimezone * 60.0)

        If $iDayLightSavingsTime Then
            $nTimeLocal += 60.0
        Else
            $nTimeLocal += 0.0
        EndIf
        If (($nTimeLocal >= 0.0) And ($nTimeLocal < 1440.0)) Then
            Return _timeString($nTimeLocal, 2)
        Else

            Local $nIncrement
            If $nTimeLocal < 0 Then
                $nIncrement = 1
            Else
                $nIncrement = -1
            EndIf
            While (($nTimeLocal < 0.0) Or ($nTimeLocal >= 1440.0))
                $nTimeLocal += $nIncrement * 1440.0
                $nJulianDay -= $nIncrement
            WEnd
            Return _TimeDateString($nJulianDay, $nTimeLocal)
        EndIf
    Else
        Local $nDayOfYear = _calcDoyFromJD($nJulianDay)
        If ((($Latitudeitude > 66.4) And ($nDayOfYear > 79) And ($nDayOfYear < 267)) Or (($Latitudeitude < -66.4) And (($nDayOfYear < 83) Or ($nDayOfYear > 263)))) Then
            If ($rise) Then
                $nJulianDay = _calcJulianDayofNextPrevRiseSet(0, $rise, $nJulianDay, $Latitudeitude, $longitude, $nTotalJulianTimeimezone, $iDayLightSavingsTime)
            Else
                $nJulianDay = _calcJulianDayofNextPrevRiseSet(1, $rise, $nJulianDay, $Latitudeitude, $longitude, $nTotalJulianTimeimezone, $iDayLightSavingsTime)
            EndIf
            ;Return _dayString ( $nJulianDay, 0, 3 )
        Else
            If ($rise) Then
                $nJulianDay = _calcJulianDayofNextPrevRiseSet(1, $rise, $nJulianDay, $Latitudeitude, $longitude, $nTotalJulianTimeimezone, $iDayLightSavingsTime)
            Else
                $nJulianDay = _calcJulianDayofNextPrevRiseSet(0, $rise, $nJulianDay, $Latitudeitude, $longitude, $nTotalJulianTimeimezone, $iDayLightSavingsTime)
            EndIf
            ;Return _dayString ( $nJulianDay, 0, 3 )
        EndIf
    EndIf
EndFunc   ;==>_calcSunriseSet

Func _calcJulianDayofNextPrevRiseSet($next, $rise, $nJulianDay, $Latitudeitude, $longitude, $nTotalJulianTimez, $iDayLightSavingsTime)

    Local $nIncrement
    If $next Then
        $nIncrement = 1.0
    Else
        $nIncrement = -1.0
    EndIf
    Local $nTotalJulianTimeime = _calcSunriseSetUTC($rise, $nJulianDay, $Latitudeitude, $longitude)
    While Not IsNumber($nTotalJulianTimeime)
        $nJulianDay += $nIncrement
        $nTotalJulianTimeime = _calcSunriseSetUTC($rise, $nJulianDay, $Latitudeitude, $longitude)
    WEnd
    Local $nTimeLocal
    If $iDayLightSavingsTime Then
        $nTimeLocal = $nTotalJulianTimeime + $nTotalJulianTimez * 60.0 + 60.0
    Else
        $nTimeLocal = $nTotalJulianTimeime + $nTotalJulianTimez * 60.0
    EndIf
    While (($nTimeLocal < 0.0) Or ($nTimeLocal >= 1440.0))
        Local $nIncrement2
        If $nTimeLocal < 0 Then
            $nIncrement2 = 1
        Else
            $nIncrement2 = -1
        EndIf
        $nTimeLocal += ($nIncrement2 * 1440.0)
        $nJulianDay -= $nIncrement2
    WEnd
    Return $nJulianDay
EndFunc   ;==>_calcJulianDayofNextPrevRiseSet

Func _SolarCalcuLatitudee($nCalcLatitudeitude, $bCalcLongitude, $CalcMonth, $CalcDay, $CalcYear, $CalcTz, $nCalcHour, $nCalcMinute, $nCalcSecond, $nCalcDaylighSavingsTime, $CalcCurrent)
    Local $aSolarCalcuLatitudeeResult[1] = [0]
    Local $nJulianDay = _GetJulianDay($CalcMonth, $CalcDay, $CalcYear)
    Local $nTotalJulianTimel = _getTimeLocal($nCalcHour, $nCalcMinute, $nCalcSecond, $nCalcDaylighSavingsTime)
    Local $nTotalJulianTimez
    If $CalcTz = "" Then
        $nTotalJulianTimez = Int($bCalcLongitude / 15)
    Else
        $nTotalJulianTimez = $CalcTz
    EndIf
    Local $nTotalJulianTimeotal = $nJulianDay + $nTotalJulianTimel / 1440.0 - $nTotalJulianTimez / 24.0
    Local $nTotalJulianTime = _CalcTimeJulianCent($nTotalJulianTimeotal)
    Local $CalcSolNoon = _calcSolNoon($nJulianDay, $bCalcLongitude, $nTotalJulianTimez, $nCalcDaylighSavingsTime) ; Returns String: "HH:MM:SS"
    ;MsgBox ( 0, "Solar Noon:", $CalcSolNoon )
    Local $rise = _calcSunriseSet(1, $nJulianDay, $nCalcLatitudeitude, $bCalcLongitude, $nTotalJulianTimez, $nCalcDaylighSavingsTime) ; Returns String: "HH:MM" or "HH:MM DD Mon"
    ;MsgBox ( 0, "Sun Rise:", $rise )
    Local $set = _calcSunriseSet(0, $nJulianDay, $nCalcLatitudeitude, $bCalcLongitude, $nTotalJulianTimez, $nCalcDaylighSavingsTime) ; Returns String: "HH:MM" or "HH:MM DD Mon"
    ;MsgBox ( 0, "Sun Set:", $set )
    _ArrayAdd($aSolarCalcuLatitudeeResult, $rise)
    _ArrayAdd($aSolarCalcuLatitudeeResult, $CalcSolNoon)
    _ArrayAdd($aSolarCalcuLatitudeeResult, $set)
    $aSolarCalcuLatitudeeResult[0] += 3
    If $CalcCurrent Then
        Local $CalcAzEl = _CalcuLatitudeeAzimuthElivation($nTotalJulianTime, $nTotalJulianTimel, $nCalcLatitudeitude, $bCalcLongitude, $nTotalJulianTimez) ; Returns Array: 0 - Azimuth, 1 - Elevation, 2 - Illumination-Disposition
        _ArrayConcatenate($aSolarCalcuLatitudeeResult, $CalcAzEl)
        $aSolarCalcuLatitudeeResult[0] += 3
    EndIf
    Return $aSolarCalcuLatitudeeResult
EndFunc   ;==>_SolarCalcuLatitudee

I will use the method in the following link unless someone has a better idea

'?do=embed' frameborder='0' data-embedContent>>

Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

That is an awesome window, cant even interact via mouseclick.  It just acts as a cancel on all buttons, as sending alt+y and enter are behaving with this window.

This is what i tried in case you are marking things off the list.

opt ("wintitlematchmode" , 2)

Run("sethc 251")

winwaitactive("High Contrast" , "Yes")
mouseclick("left" , 442 , 280 , 1 , 50)

Exit
Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

Changing the themes is simple enough

Then you could set it up to change through speech recognition

HotKeySet("{F7}", "_normContrast")
HotKeySet("{F8}", "_hiContrast")

While 1
        Sleep(1000)
WEnd

Func _normContrast()
ShellExecute("C:\Windows\Resources\Ease of Access Themes\basic.theme")
EndFunc

Func _hiContrast()
ShellExecute("C:\Windows\Resources\Ease of Access Themes\hc1.theme")
EndFunc

'?do=embed' frameborder='0' data-embedContent>>

Bill

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@BILL

Thanks for the tip, but that creates a pop windows, still annoying but not as bad as one that autoit can't seem to interact with.

Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@BOTHTHOSE

Thanks, I found that if I run the script as x64 it works when I manually click on it, but still does not automate for some reason.

Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thanks for the tip, but that creates a pop windows, still annoying but not as bad as one that autoit can't seem to interact with.

What Pop Window are you referring to? Pop up?

On my windows 7 32 bit setup the change is seamless...except for the few second wait for the theme to load which you will have regardless...

Bill

Edited by l3ill

Share this post


Link to post
Share on other sites

on mine it pops the theme panel, then the theme changes, and then leaves the window behind.  win 7 x64


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

You have to open the "Ease of Access Center" in the control panel, click the button that says "Set Up High Contrast", and then uncheck the box that says "Display a warning message when turning a setting on". Save the choice by clicking OK, and you will never see the warning box again.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

You have to open the "Ease of Access Center" in the control panel, click the button that says "Set Up High Contrast", and then uncheck the box that says "Display a warning message when turning a setting on". Save the choice by clicking OK, and you will never see the warning box again.

 

I made those changes, yet I still get the prompt when running the script from autoit, strangely the same command does not cause the prompt from windows command prompt.

RunWait("C:\Windows\System32\sethc.exe 251")

 

on mine it pops the theme panel, then the theme changes, and then leaves the window behind.  win 7 x64

Mine does that as well.

Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites

@Dictator

I dont know how no one but us is baffled by that prompt.  Even if it only behaves like that on x64, the ability to build automation resistant GUIs for server apps would be very useful.


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0