$MyFile = @ScriptDir & '\MyiniFile.ini'
While 1 ;Бесконечный цикл
If FileExists($MyFile) Then ;Проверка наличия файла $MyFile
If IniRead($MyFile, 'SomeSection', 'AnyKey', 'AnyDefault') = 'AnyDefault' Then
;Выполняем действия , если значение 'AnyKey' не найдено и установлено по умолчанию
Else
; Выполняем действия, если значение 'AnyKey' определено и отлично от значения по умолчанию
EndIf
Else
Sleep(500)
EndIf
WEnd
GUICtrlSetData ( controlID, data [, default ] )
Допустим , Вы в форме поместили "Label" , вот и меняйте его содержимое в зависимости от результата:Ну типа если так, то появляется строка в форме с определенной надписью.
;...............................................................................
;Где-то в создании самой формы Вы создали Label
$MyLabel = GUICtrlCreateLabel ( "Можно оставить пустым, если не нужно никакой надписи изначально",10, 10 , 20 ,300)
;Дальше куча всяких строк заполнения формы итд
;................................................................................
; В нужный момент
If IniRead($MyFile, 'SomeSection', 'AnyKey', 'AnyDefault') = 'AnyDefault' Then
;Выполняем действия , если значение 'AnyKey' не найдено и установлено по умолчанию
GUICtrlSetData ($MyLabel, 'Надпись в случае, если значение "AnyKey" не найдено и установлено по умолчанию')
Else
; Выполняем действия, если значение 'AnyKey' определено и отлично от значения по умолчанию
GUICtrlSetData ($MyLabel, 'Надпись в случае, если значение "AnyKey" определено и отлично от значения по умолчанию')
EndIf
#include <GUIConstants.au3>
GUICreate('1', 280, 280)
GUICtrlSetState(-1, $GUI_DISABLE)
$font = "Times new roman"
$Button1 = GUICtrlCreateButton('<1 >', 20, 20, 240, 50)
GUICtrlSetFont(-1, 14, 700, 0, $font)
$Button2 = GUICtrlCreateButton('< 2 >', 20, 85, 240, 50)
GUICtrlSetFont(-1, 14, 700, 0, $font)
$Button3 = GUICtrlCreateButton('< 3 >', 20, 150, 240, 50)
GUICtrlSetFont(-1, 14, 700, 0, $font)
$Button4 = GUICtrlCreateButton('< 4 >', 20, 215, 240, 50)
GUICtrlSetFont(-1, 14, 700, 0, $font)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Run(run ("1"))
Exit
Case $Button2
Run(run ("2"))
Exit
Case $Button3
Run(run ("3"))
Exit
Case $Button4
Run(run ("4"))
Exit
EndSwitch
WEnd
Вы хотите кнопки в цикле создавать ?Как правильно вставить это в цикл
#include <GUIConstants.au3>
Global $MyFile = @ScriptDir & '\MyiniFile.ini'
GUICreate('1', 280, 280)
GUICtrlSetState(-1, $GUI_DISABLE)
$font = "Times new roman"
$Button1 = GUICtrlCreateButton('<1 >', 20, 20, 240, 50)
GUICtrlSetFont(-1, 14, 700, 0, $font)
$Button2 = GUICtrlCreateButton('< 2 >', 20, 85, 240, 50)
GUICtrlSetFont(-1, 14, 700, 0, $font)
$Button3 = GUICtrlCreateButton('< 3 >', 20, 150, 240, 50)
GUICtrlSetFont(-1, 14, 700, 0, $font)
$Button4 = GUICtrlCreateButton('< 4 >', 20, 215, 240, 50)
GUICtrlSetFont(-1, 14, 700, 0, $font)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Run(run ("1"))
Exit
Case $Button2
Run(run ("2"))
Exit
Case $Button3
Run(run ("3"))
Exit
Case $Button4
Run(run ("4"))
Exit
EndSwitch
_FileExist()
WEnd
Func _FileExist()
If FileExists($MyFile) Then ;Проверка наличия файла $MyFile
If IniRead($MyFile, 'SomeSection', 'AnyKey', 'AnyDefault') = 'AnyDefault' Then
;Выполняем действия , если значение 'AnyKey' не найдено и установлено по умолчанию
Else
; Выполняем действия, если значение 'AnyKey' определено и отлично от значения по умолчанию
EndIf
EndIf
EndFunc
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
Opt("GUIOnEventMode", 1)
Global $g_iState = False, $g_iInput, $g_iButton1, $g_iButton2
GUICreate("Пример", 400, 80)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUICtrlCreateLabel("IniRead: ", 10, 10, 45, 20, BitOR($GUI_SS_DEFAULT_LABEL, $SS_CENTERIMAGE, $SS_RIGHT))
$g_iInput = GUICtrlCreateInput(Null, 55, 10, 335, 20, BitOR($GUI_SS_DEFAULT_INPUT, $ES_READONLY))
GUICtrlCreateButton("Старт", 50, 40, 95, 30)
GUICtrlSetOnEvent(-1, "_Toggle")
$g_iButton1 = GUICtrlCreateButton("Кнопка 1", 155, 40, 95, 30)
GUICtrlSetOnEvent(-1, "_Events")
$g_iButton2 = GUICtrlCreateButton("Кнопка 2", 260, 40, 95, 30)
GUICtrlSetOnEvent(-1, "_Events")
GUISetState()
While Sleep(10)
WEnd
Func _Toggle()
If Not $g_iState Then
$g_iState = True
GUICtrlSetData(@GUI_CtrlId, "Стоп")
AdlibRegister("_Update")
Else
$g_iState = False
AdlibUnRegister("_Update")
GUICtrlSetData(@GUI_CtrlId, "Старт")
EndIf
EndFunc ;==>_Toggle
Func _Events()
Switch @GUI_CtrlId
Case $g_iButton1
ToolTip("Кнопка 1" & @CRLF & "Control ID: " & @GUI_CtrlId)
Case $g_iButton2
TrayTip("Кнопка 2", "Control ID: " & @GUI_CtrlId, 5)
ToolTip(Null)
EndSwitch
EndFunc ;==>_Event
Func _Update()
IniWrite("Temp.ini", "Section", "Key", Random(0, 65535))
GUICtrlSetData($g_iInput, IniRead("Temp.ini", "Section", "Key", Null))
EndFunc ;==>_Update
Func _Exit()
Exit FileDelete("Temp.ini")
EndFunc ;==>_Exit
Автор темы | Похожие темы | Форум | Ответы | Дата |
---|---|---|---|---|
P | Проверка подключения интернета через прокси | Общие вопросы по AutoIt | 2 | |
X | Проверка значения в буфере | Общие вопросы по AutoIt | 3 | |
H | [Автоматизация] Проверка запуска - условие AHK | Общие вопросы по AutoIt | 5 | |
K | Проверка запуска 1С | Стол заказов | 0 | |
D | Циклическая обработка | Общие вопросы по AutoIt | 7 |