PDA

Показать полную графическую версию : [решено] Выбор цвета фона для всплывающей подсказки в окне настроек Windows


beve
13-01-2010, 21:41
Ранее пробовал создать файл *.theme из нужными мне настройками, но ввиду того что некоторые настройки пропадают при такой настройке, решил это делать походу.
Проблема в следующем, как в приведенном примере, можно выбрать Желтый цвет для вспл.подсказки, вернее не желтый а немного желтый (на глаз), если удасться, то выбрать другой цвет уже будет дело техники...
#Include <GuiTab.au3>
#Include <GuiComboBoxEx.au3>
Global $sTitle="Свойства: Экран"
Global $sTitle2="Дополнительное оформление"

; Это нужно для того, чтоб закрыть, если открыто Главное окно: "Окно Свойства:" Экран и дочерние окна, то есть одним ударом...Ну, во всяком случае для теста...
If ProcessExists ("rundll32.exe") Then
ProcessClose("rundll32.exe")
ProcessWaitClose("rundll32.exe")
EndIf

Run('rundll32 shell32, Control_RunDLL desk.cpl,,')
WinWait('Свойства: Экран','')

$hTab = ControlGetHandle($sTitle, "", "SysTabControl321")
_GUICtrlTab_ClickTab($hTab , 3)
Sleep(500)
ControlClick ($sTitle,'Оформление', '[CLASS:Button; INSTANCE:2]')
WinWait ($sTitle2,'')
WinActivate ($sTitle2,'')
WinWaitActive ($sTitle2,'')

$hCombo = ControlGetHandle($sTitle2, "", "ComboBox1")
;Настройка Всплывающая подсказка
Global $ToolTips_nFont="Microsoft Sans Serif"
Global $ToolTips_nFontSize="14"

$iIndex=_GUICtrlComboBoxEx_FindStringExact ($hCombo, "Всплывающая подсказка")
_GUICtrlComboBoxEx_SetCurSel($hCombo, $iIndex)
; ControlSend-ы нужны чтоб сделать активными соответствующее поле, пока без этого не выходит
ControlSend($sTitle2, "","ComboBox1","{DOWN}")
ControlSend($sTitle2, "","ComboBox1","{UP}")

$hCombo2 = ControlGetHandle($sTitle2, "", "ComboBox2")
$iIndex=_GUICtrlComboBoxEx_FindStringExact ($hCombo2, $ToolTips_nFont)
_GUICtrlComboBoxEx_SetCurSel($hCombo2, $iIndex)
ControlSend($sTitle2, "","ComboBox2","{DOWN}")
ControlSend($sTitle2, "","ComboBox2","{UP}")

$hCombo3 = ControlGetHandle($sTitle2, "", "ComboBox3")
$iIndex=_GUICtrlComboBoxEx_FindStringExact ($hCombo3, $ToolTips_nFontSize)
_GUICtrlComboBoxEx_SetCurSel($hCombo3, $iIndex)
ControlSend($sTitle2, "","ComboBox3","{DOWN}")
ControlSend($sTitle2, "","ComboBox3","{UP}")

#cs
; сохранить и закрыть
ControlClick($sTitle2, "","[CLASS:Button; INSTANCE:6]")
WinWaitClose ($sTitle2,'')
Sleep(500)
ControlClick($sTitle, "","[CLASS:Button; INSTANCE:3]")
WinWaitClose ($sTitle,'')
#ce
Мне нужно нажать на кнопку Цвет 1 и дальше на кнопку Другой чтоб установить нужные параметры цвета фона. Только нужно решение, которое естественно было бы без глюков.
Команда
ControlClick($sTitle2, "","[CLASS:Button; INSTANCE:1]") просто нажимает на кнопку Цвет 1 (но это по моему ненадежно), но вот никак не удается нажать на кнопку Другой.
Прошу помощи. И еще, может кто знает, где windows сохраняет эти измененные настройки темы, ибо может может можно просто подправить там некоторые параметры...

Creat0R
14-01-2010, 00:42
Как то так, но я уверен что есть метод по проще, с записью в реестр...

#include <GUITab.au3>
#include <GUIComboBoxEx.au3>
#include <Color.au3>

Opt (http://www.autoitscript.com/autoit3/docs/functions/Opt.htm)("WinWaitDelay", 1)

Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) $sTitle = "Свойства: Экран"
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) $sTitle2 = "Дополнительное оформление"

Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) $ToolTips_nFont = "Microsoft Sans Serif"
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) $ToolTips_nFontSize = "14"

Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) $ToolTips_BackColor = 0xD7D700 ;Kind of Yellow

If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) Not (http://www.autoitscript.com/autoit3/docs/keywords.htm#Not) WinExists (http://www.autoitscript.com/autoit3/docs/functions/WinExists.htm)($sTitle) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
Run (http://www.autoitscript.com/autoit3/docs/functions/Run.htm)('rundll32 shell32, Control_RunDLL desk.cpl,,')
WinWait (http://www.autoitscript.com/autoit3/docs/functions/WinWait.htm)($sTitle)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)

WinActivate (http://www.autoitscript.com/autoit3/docs/functions/WinActivate.htm)($sTitle)
WinWaitActive (http://www.autoitscript.com/autoit3/docs/functions/WinWaitActive.htm)($sTitle)

$hTab = ControlGetHandle (http://www.autoitscript.com/autoit3/docs/functions/ControlGetHandle.htm)($sTitle, "", "SysTabControl321")
_GUICtrlTab_ClickTab($hTab, 3)

WinWait (http://www.autoitscript.com/autoit3/docs/functions/WinWait.htm)($sTitle, 'Default pane')

ControlClick (http://www.autoitscript.com/autoit3/docs/functions/ControlClick.htm)($sTitle, 'Default pane', 'Button2')
WinWait (http://www.autoitscript.com/autoit3/docs/functions/WinWait.htm)($sTitle2)
WinActivate (http://www.autoitscript.com/autoit3/docs/functions/WinActivate.htm)($sTitle2)
WinWaitActive (http://www.autoitscript.com/autoit3/docs/functions/WinWaitActive.htm)($sTitle2)

$hCombo = ControlGetHandle (http://www.autoitscript.com/autoit3/docs/functions/ControlGetHandle.htm)($sTitle2, "", "ComboBox1")
;Настройка Всплывающая подсказка
$iIndex = _GUICtrlComboBoxEx_FindStringExact($hCombo, "Всплывающая подсказка")
_GUICtrlComboBoxEx_SetCurSel($hCombo, $iIndex)
; ControlSend-ы нужны чтоб сделать активными соответствующее поле, пока без этого не выходит
ControlSend (http://www.autoitscript.com/autoit3/docs/functions/ControlSend.htm)($sTitle2, "", "ComboBox1", "{DOWN}")
ControlSend (http://www.autoitscript.com/autoit3/docs/functions/ControlSend.htm)($sTitle2, "", "ComboBox1", "{UP}")

ControlSetText (http://www.autoitscript.com/autoit3/docs/functions/ControlSetText.htm)($sTitle2, "", "Edit2", $ToolTips_nFont)
ControlSetText (http://www.autoitscript.com/autoit3/docs/functions/ControlSetText.htm)($sTitle2, "", "Edit3", $ToolTips_nFontSize)

ControlClick (http://www.autoitscript.com/autoit3/docs/functions/ControlClick.htm)($sTitle2, '', 'Button1')
WinWait (http://www.autoitscript.com/autoit3/docs/functions/WinWait.htm)('[CLASS:#32770]', 'Друго&й...')
ControlClick (http://www.autoitscript.com/autoit3/docs/functions/ControlClick.htm)('[CLASS:#32770]', 'Друго&й...', 'Button1')

WinWait (http://www.autoitscript.com/autoit3/docs/functions/WinWait.htm)('[CLASS:#32770;TITLE:Цвет]')

$nRed = _ColorGetRed($ToolTips_BackColor)
$nGreen = _ColorGetGreen($ToolTips_BackColor)
$nBlue = _ColorGetBlue($ToolTips_BackColor)

ControlSetText (http://www.autoitscript.com/autoit3/docs/functions/ControlSetText.htm)('[CLASS:#32770;TITLE:Цвет]', '', 'Edit4', $nRed)
ControlSetText (http://www.autoitscript.com/autoit3/docs/functions/ControlSetText.htm)('[CLASS:#32770;TITLE:Цвет]', '', 'Edit5', $nGreen)
ControlSetText (http://www.autoitscript.com/autoit3/docs/functions/ControlSetText.htm)('[CLASS:#32770;TITLE:Цвет]', '', 'Edit6', $nBlue)

ControlClick (http://www.autoitscript.com/autoit3/docs/functions/ControlClick.htm)('[CLASS:#32770;TITLE:Цвет]', '', 'Button2')

#cs
; сохранить и закрыть
ControlClick($sTitle2, '', 'Button6')
WinWaitClose($sTitle2)
ControlClick($sTitle, '', 'Button3')
WinWaitClose($sTitle)
#ce

beve
14-01-2010, 01:12
так»
То что мне и было нужно. Спасибо за код.
но я уверен что есть метод по проще, с записью в реестр... »
Искал, но тщетно...




© OSzone.net 2001-2012