Что нового

замена с нумерацией

saraconor

Новичок
Сообщения
404
Репутация
3
в скрипте очень много повторяющихся строк:
Код:
Case $KNOP[$$$$$][0]	
			if $KNOP[$nMsg-2][1] = 0 then
			$KNOP[$nMsg-2][1] = 1
			GUICtrlSetBkColor($KNOP[$nMsg-2][0], $2_green)
			Else
			$KNOP[$nMsg-2][1] = 0
			GUICtrlSetBkColor($KNOP[$nMsg-2][0], $1_green)
		endif
		Case $KNOP[$$$$$][0]
			if $KNOP[$nMsg-2][1] = 0 then
			$KNOP[$nMsg-2][1] = 1
			GUICtrlSetBkColor($KNOP[$nMsg-2][0], $2_green)
			Else
			$KNOP[$nMsg-2][1] = 0
			GUICtrlSetBkColor($KNOP[$nMsg-2][0], $1_green)
		endif
		Case $KNOP[$$$$$][0]	
			if $KNOP[$nMsg-2][1] = 0 then
			$KNOP[$nMsg-2][1] = 1
			GUICtrlSetBkColor($KNOP[$nMsg-2][0], $2_green)
			Else
			$KNOP[$nMsg-2][1] = 0
			GUICtrlSetBkColor($KNOP[$nMsg-2][0], $1_green)
		endif
		Case $KNOP[$$$$$][0]	
			if $KNOP[$nMsg-2][1] = 0 then
			$KNOP[$nMsg-2][1] = 1
			GUICtrlSetBkColor($KNOP[$nMsg-2][0], $2_green)
			Else
			$KNOP[$nMsg-2][1] = 0
			GUICtrlSetBkColor($KNOP[$nMsg-2][0], $1_green)
		endif

как можно в SciTE автоматически заменить с нумерацией элементы: $$$$$ ?
чтобы они сверху вниз шли 31 32 33 34...
 

InnI

AutoIT Гуру
Сообщения
4,912
Репутация
1,429
saraconor
много повторяющихся строк
Код:
Switch GUIGetMsg()
        Case $KNOP[31][0] To $KNOP[34][0]
            if $KNOP[$nMsg-2][1] = 0 then
            $KNOP[$nMsg-2][1] = 1
            GUICtrlSetBkColor($KNOP[$nMsg-2][0], $2_green)
            Else
            $KNOP[$nMsg-2][1] = 0
            GUICtrlSetBkColor($KNOP[$nMsg-2][0], $1_green)
          endif
    EndSwitch
 

madmasles

Модератор
Глобальный модератор
Сообщения
7,790
Репутация
2,322
saraconor,
Код:
Global $aColor[2] = [$1_green, $2_green]

;~ ...
Case $KNOP[31][0] To $KNOP[34][0]
	$KNOP[$nMsg - 2][1] = Not $KNOP[$nMsg - 2][1]
	GUICtrlSetBkColor($KNOP[$nMsg - 2][0], $aColor[$KNOP[$nMsg - 2][1]])
;~ ...
 
Автор
S

saraconor

Новичок
Сообщения
404
Репутация
3
madmasles
Отличный пример, спасибо.
 
Верх