$a_Label[20] = GUICtrlCreateLabel("Файл", 25, 51, 165, 25)
$a_Input[20] = GUICtrlCreateInput("c:\1.xls", 244, 51, 425, 29)
$a_Button[20] = GUICtrlCreateButton("Выбрать", 672, 51, 75, 25)
$a_Label[12] = GUICtrlCreateLabel("", 25, 91, 97, 25)
$a_Input[01] = GUICtrlCreateInput("", 244, 91, 425, 29)
$a_Button[12] = GUICtrlCreateButton("", 168, 184, 123, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$a_Input[03] = GUICtrlCreateInput("", 244, 251, 425, 29)
$a_Input[04] = GUICtrlCreateInput("", 244, 291, 425, 29)
$a_Button[15] = GUICtrlCreateButton("", 672, 91, 75, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$a_Label[21] = GUICtrlCreateLabel("Размер видео, ширина", 24, 52, 185, 25)
$a_Label[22] = GUICtrlCreateLabel("Размер видео, высота", 24, 92, 180, 30)
$a_Label[23] = GUICtrlCreateLabel("Видео, частота", 24, 132, 125, 25)
$a_Label[24] = GUICtrlCreateLabel("Длительность показа одной картинки", 24, 172, 308, 25)
$a_Label[25] = GUICtrlCreateLabel("Надпись", 24, 212, 73, 25)
$a_Input[08] = GUICtrlCreateInput("", 224, 52, 121, 29)
$a_Input[09] = GUICtrlCreateInput("", 224, 92, 121, 29)
$a_Input[10] = GUICtrlCreateInput("", 224, 132, 121, 29)
$a_Input[11] = GUICtrlCreateInput("", 352, 172, 121, 29)
$a_Input[12] = GUICtrlCreateInput("", 224, 212, 417, 29)
Global $arr_ini_data[18][2]=[ _
["Path", "Path_Input_Folder_Pictires" ], _
["Path", "Path_Input_File_audio" ], _
["Path", "Path_Output_File_video" ], _
["Youtube_video_msg", "YT_msg_01" ], _
["Youtube_video_msg", "YT_msg_02" ], _
["Youtube_video_msg", "YT_msg_03" ], _
["Youtube_video_msg", "YT_msg_04" ], _
["Youtube_video_msg", "YT_msg_05" ], _
["Video_config", "Video_Width" ], _
["Video_config", "Video_Height" ], _
["Video_config", "Video_FPS" ], _
["Video_config", "Video_Image_Time" ], _
["Video_config", "Video_Image_Text" ], _
["Youtube_accaunt_data", "YT_data_01" ], _
["Youtube_accaunt_data", "YT_data_02" ], _
["Youtube_accaunt_data", "YT_data_03" ], _
["Youtube_accaunt_data", "YT_data_04" ], _
["Youtube_accaunt_data", "YT_data_05" ]]
For $i=0 To 17
GUICtrlSetData($a_Input[$i], IniRead($file_INI, $arr_ini_data[$i][0] ,$arr_ini_data[$i][1] , ""))
Next
For $i=0 To 17
If IniRead($file_INI, $arr_ini_data[$i][0] ,$arr_ini_data[$i][1] , "")<>GUICtrlRead($a_Input[$i]) Then
IniWrite ( $file_INI, $arr_ini_data[$i][0] ,$arr_ini_data[$i][1] , GUICtrlRead($a_Input[$i]) )
EndIf
Next
For $control = 3 To GUICtrlCreateDummy()
GUICtrlSetOnEvent($control, 'gui_control_event')
Next
$CONFIG_ON_TOP = GUICtrlRead($Checkbox_ontop) = 1
inververs сказал(а):Что бы для всех контролов задать одну и ту же функцию я пишу:
Код:For $control = 3 To GUICtrlCreateDummy() GUICtrlSetOnEvent($control, 'gui_control_event') Next
$Error = True
Do
...
If Ошибка Then ExitLoop
...
If Ошибка Then ExitLoop
...
If Ошибка Then ExitLoop
$Error = False
Until True
If $Error Then
...
Else
...
EndIf
Function F_600_open_URL(BrowserChromium: TChromium; url:string):string;
begin
WB100isLoaded:=False;
BrowserChromium.Load(url);
F_601_Wait_Browser(BrowserChromium);
end;
function F_602_ReturnURL(BrowserChromium: TChromium): string;
begin
try
result:=BrowserChromium.Browser.MainFrame.Url;
except
result:='ERROR F_642_ReturnURL';
_WriteLog(result);
end;
end;
Function F_610_WB_ObjectSetValue(BrowserChromium: TChromium; id,value:string):string;
var
CodeStr:string;
begin
result:='ok';
try
CodeStr := 'document.getElementById("' + id + '").value="' + value+ '";' ;
BrowserChromium.Browser.MainFrame.ExecuteJavaScript(CodeStr, 'about:blank', 0);
except
result:='ERROR 610_ObjectSetValue = ' + id;
_WriteLog(result);
end;
end;
Function F_611_WB_ObjectClick(BrowserChromium: TChromium; id:string):string;
var
CodeStr:string;
begin
WB100isLoaded:=False;
result:='ok';
try
CodeStr := 'document.getElementById("' + id + '").click();';
BrowserChromium.Browser.MainFrame.ExecuteJavaScript(CodeStr, 'about:blank', 0);
F_601_Wait_Browser(BrowserChromium);
except
result:='ERROR 611_WB_ObjectClick = ' + id;
_WriteLog(result);
end;
end;
Аналогично можно выходить из select или switchВот мой прием, когда необходимо проверять множество действий на предмет успешного выполнения (довольно часто встречается):
Do
Select
Case $a = 1
;какой то код
If $b = 3 Then ExitLoop
Case $a = 2
Case $a = 3
EndSelect
Until True
Local $string = "abc123"
$string = Execute("'" & StringRegExpReplace($string, "(\D)", "' & _test(""\1"") & '") & "'")
ConsoleWrite($string & @LF)
Func _test($in)
Return Random(1, 9, 1)
EndFunc ;==>_test
Local $sString = "Эту длинную строку я разрежу максимум по 30 символов, но никогда не поделю слово на части."
$res = StringRegExpReplace($sString, ".{1,30}(\h|$)\K", @crlf)
Msgbox(0,"", $res)
inververs сказал(а):cnm
В autoit нету механизма исключений. Поэтому ваш пример тут не в тему.