From a2d0a7f5444df1b3f55fa8975277255a791f40c6 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Tue, 15 Aug 2023 13:55:44 +0200 Subject: [PATCH] Fix OCR value not being assigned to variables with enabled regex --- .../video/macro-condition-video.cpp | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/macro-external/video/macro-condition-video.cpp b/src/macro-external/video/macro-condition-video.cpp index b5bb3e91..27b8525e 100644 --- a/src/macro-external/video/macro-condition-video.cpp +++ b/src/macro-external/video/macro-condition-video.cpp @@ -315,19 +315,17 @@ bool MacroConditionVideo::CheckOCR() auto text = RunOCR(_ocrParameters.GetOCR(), _screenshotData.image, _ocrParameters.color, _ocrParameters.colorThreshold); - - if (_ocrParameters.regex.Enabled()) { - auto expr = _ocrParameters.regex.GetRegularExpression( - _ocrParameters.text); - if (!expr.isValid()) { - return false; - } - auto match = expr.match(QString::fromStdString(text)); - return match.hasMatch(); - } - SetVariableValue(text); - return text == std::string(_ocrParameters.text); + if (!_ocrParameters.regex.Enabled()) { + return text == std::string(_ocrParameters.text); + } + auto expr = + _ocrParameters.regex.GetRegularExpression(_ocrParameters.text); + if (!expr.isValid()) { + return false; + } + auto match = expr.match(QString::fromStdString(text)); + return match.hasMatch(); } bool MacroConditionVideo::CheckColor()