Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Аватара для madmasles

Ветеран


Сообщения: 812
Благодарности: 353

Профиль | Отправить PM | Цитировать


Cem,
Печально, но Вы не поняли, что $aSearch[3] используется только для примера поиска.
читать дальше »
Код: Выделить весь код
Local $sTxt, $sSearch, $sImageFile, $sVideoFile

$sSearch = InputBox('Название', 'Введите животное:', 'Здесь вводим', '', 250, 150, Default, Default, 0)
If Not $sSearch Then Exit 1
$sTxt = FileRead(@ScriptDir & '\tst.txt')
If Not StringInStr($sTxt, $sSearch, 1) Then
    If Not StringInStr($sTxt, StringLower($sSearch), 1) Then
        ConsoleWrite('No word "' & $sSearch & '" in text' & @LF)
        Exit 2
    EndIf
EndIf
$sImageFile = StringRegExpReplace($sTxt, '(?ims).*^([a-z].*?\\' & $sSearch & '\.j.*?)$.*', '$1')
If @extended <> 1 Then
    $sImageFile = StringRegExpReplace($sTxt, '(?ims).*^([a-z].*?\\' & StringLower($sSearch) & '\.j.*?)$.*', '$1')
    If @extended <> 1 Then
        ConsoleWrite('Can not search image file for word "' & $sSearch & '" in text' & @LF)
    EndIf
EndIf
$sVideoFile = StringRegExpReplace($sTxt, '(?ims).*^([a-z].*?\\' & $sSearch & '\.m.*?)$.*', '$1')
If @extended <> 1 Then
    $sVideoFile = StringRegExpReplace($sTxt, '(?ims).*^([a-z].*?\\' & StringLower($sSearch) & '\.m.*?)$.*', '$1')
    If @extended <> 1 Then
        ConsoleWrite('Can not search video file for word "' & $sSearch & '" in text' & @LF)
    EndIf
EndIf
ConsoleWrite('Image file for word "' & $sSearch & '": ' & $sImageFile & @LF)
ConsoleWrite('Video file for word "' & $sSearch & '": ' & $sVideoFile & @LF)
и
читать дальше »
Код: Выделить весь код
Local $sIni = @ScriptDir & '\tst.ini', $sSearch, $sImageFile, $sVideoFile

$sSearch = InputBox('Название', 'Введите животное:', 'Здесь вводим', '', 250, 150, Default, Default, 0)
If Not $sSearch Then Exit 1
$sImageFile = IniRead($sIni, $sSearch, 'Image', 'Error')
If $sImageFile = 'Error' Then
    $sImageFile = IniRead($sIni, StringLower($sSearch), 'Image', 'Error')
    If $sImageFile = 'Error' Then
        ConsoleWrite('Can not search image file for word "' & $sSearch & '" in text' & @LF)
    EndIf
EndIf
$sVideoFile = IniRead($sIni, $sSearch, 'Video', 'Error')
If $sVideoFile = 'Error' Then
    $sVideoFile = IniRead($sIni, StringLower($sSearch), 'Video', 'Error')
    If $sVideoFile = 'Error' Then
        ConsoleWrite('Can not search video file for word "' & $sSearch & '" in text' & @LF)
    EndIf
EndIf
If $sImageFile <> 'Error' Then ConsoleWrite('Image file for word "' & $sSearch & '": ' & $sImageFile & @LF)
If $sVideoFile <> 'Error' Then ConsoleWrite('Video file for word "' & $sSearch & '": ' & $sVideoFile & @LF)
Это сообщение посчитали полезным следующие участники:

Отправлено: 12:32, 01-03-2014 | #8