Home API Manuals About Forum
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

InJournalBetweenTimes

Searches the journal for the specified string, but only within a given time range.

Str — the text to search for (case-insensitive substring match). Supports the pipe | separator for multi-string search, same as InJournal.

TimeBegin — start of the time range (TDateTime).

TimeEnd — end of the time range (TDateTime).

The order of TimeBegin and TimeEnd does not matter — the method automatically treats the smaller value as the start and the larger as the end.

Returns the line index of the found entry, or -1 if no match was found within the specified time range.

After a successful match, the Line* properties are updated just as with InJournal.

Ищет указанную строку в журнале, но только в заданном временном диапазоне.

Str — текст для поиска (регистронезависимый поиск подстроки). Поддерживает разделитель | для поиска нескольких строк, как и InJournal.

TimeBegin — начало временного диапазона (TDateTime).

TimeEnd — конец временного диапазона (TDateTime).

Порядок TimeBegin и TimeEnd не имеет значения — метод автоматически определяет меньшее значение как начало, а большее как конец.

Возвращает индекс найденной строки или -1, если совпадений не найдено в указанном временном диапазоне.

После успешного нахождения свойства Line* обновляются так же, как и у InJournal.

Pascal

function InJournalBetweenTimes(Str: String; TimeBegin: TDateTime; TimeEnd: TDateTime): Integer;

Python

def InJournalBetweenTimes(Str: str, TimeBegin: datetime, TimeEnd: datetime) -> int: ...

Pascal Example

var
  StartTime: TDateTime;
begin
  StartTime := Now;
  UOSay('vendors buy');
  Wait(3000);
  if InJournalBetweenTimes('gold|price', StartTime, Now) >= 0 then
    AddToSystemJournal('Vendor responded: ' + Journal(LineIndex));
end.

Python Example

from datetime import datetime

start_time = datetime.now()
UOSay('vendors buy')
Wait(3000)
if InJournalBetweenTimes('gold|price', start_time, datetime.now()) >= 0:
    AddToSystemJournal(f'Vendor responded: {Journal(LineIndex())}')

See Also

InJournal, WaitJournalLine, Journal