Imbuter2000
Active Members-
Posts
211 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Imbuter2000's Achievements
Polymath (5/7)
0
Reputation
-
I have a script that does safe things most of time. When particular situations are detected, it sends an email and log the action ("email xyz sent - timestamp") into a file. Some times I want to manually Exit the script (for making corrections or just pausing it) by clicking Exit on the tray icon of the script, or by ctrl+break if launched inside SciTE. In this, there is a minimal risk that I exit the script in the middle between the send email and the log actions, although there're immediately consecutive. What's the most proper way to avoid this risk? I'd like something like this: - code... - code... - code... - #disable Exit <- how to do this? - send email - log email sent - #enable Exit <- how to do this? - code... - code...
-
I would to press the button "Save" of this tiny IE window(?) but the "AutoIt v3 Window Info" don't go deeper than this whole large white window(?). Does the fact that "AutoIt v3 Window Info" doesn't go deeper (doesn't identify the button) mean that there's no way for AutoIt to press it without using mouse/keyboard simulation?
-
jhcd, I didn't unswer to post #8 because the second image is broken (not visible) and I didn't understand your points. If you read again my first message, the question is not why $regex_one doesn't match. It's correct, it doesn't have to match in this example. The question, as you can read in my first post, is why $regex_test_one - that includes an alternation or both the not matching and matching versions - doesn't match! P.S.: StringMid to validate a text screen is impossible and to parse multiple elements in a whole text screen would require multiple StringMids and minutes for counting the position and lenght of any field. With a single regex built in less time I validate and parse the multiple elements. Validation is necessary as many pages could show unexpected fields and rows. The two regexes in alternation are there because of this, to work well in both the situations, where StringMid would blindly fail.
-
Guys, the regexps that I wrote and seem terrible to you were simplifyied by me to the minimum necessary to display the bug. The original regexps that I'm using are the following and they're used in alternation because yes, only one at a time matches, in the $screen of the example only $regex_two matches, and further in my script I have an "if" that makes different things depending on what of the two matches. local $regex_one=" .* A N A G R A F E INTERROGAZIONE SINTETICA.* " _ & "\r\n=============================================================================== " _ & "\r\nNdg: " & $ndg & " +Tipo: \d{5} +.* Sorvegl\. .*" _ & "\r\n(.*?) +" _ & "\r\n(.*?) +c/o .*" _ & "\r\n {0,4}(\d{2,5}) ([^ ].*?) +(\w\w) +" _ & "\r\n" local $regex_two=" .* A N A G R A F E INTERROGAZIONE SINTETICA.* " _ & "\r\n=============================================================================== " _ & "\r\nNdg: " & $ndg & " +Tipo: \d{5} +(P\.F\. -|COINT -) .* Sorvegl\. .*" _ & "\r\n(.*?) +" _ & "\r\n(.*?) +c/o .*" _ & "\r\n {0,4}(\d{2,5}) ([^ ].*?) +(\w\w) +Cittad: +([^ ].*?) +" _ & "\r\nNato il: (\d\d/\d\d/\d\d\d\d) A: ([^ ].*?) +Prov\.: (\w\w) +Sesso: (\w) *" _ & "\r\nC\.F\. +(\w+|) +P\.I\. +Tel\..*" _ & "\r\n(?s:.*)" _ & "\r\nCODTX: ____ .*" _ & "\r\n" So, is there a valid reason why the order in the following alternations makes the difference between not matching and matching over $screen? this doesn't match: "(?s:"&$regex_one&"|"&$regex_two&")" this matches: "(?s:"&$regex_two&"|"&$regex_one&")" Why??? I was also always confident that there were no need to add the parenthesis like czardas suggested. I learned to not use parenthesis when they're not needed. Should I start using them again around every elements in every alternations to be sure to bypass this bug/weird limitation of regexes in AutoIT? P.S.: I use regular expressions like this for 20 years for reading and parsing AS/400 terminal screens, if you think that my regexps are terrible can you please explain what's the problem in these?
-
Jchd your code has the same wrong results of mine: as far as I can see it doesn match with $regex_test_one while it matches with $regex_test_two and $regex_test_simple It's like saying that the regex "A|B" doesn't match over the text "B" (while the regex "B|A" or just "B" correctly match). Do you understand why in my example the regex "A|B" doesn't match the text "B"?
-
I'm really going mad for a regular expression that doesn't work if I add or just invert the alternation. Try this script: $screen = "" _ & " AFASN0M A N A G R A F E INTERROGAZIONE SINTETICA - ABC 22/04/16 " _ & @CRLF & "=============================================================================== " _ & @CRLF & "Ndg: 12345678 Tipo: 10100 P.F. - EFF/COMPL. Sorvegl. " _ & @CRLF & "GHILARDI ABCDEF " _ & @CRLF & "VIA IV OTTOBRE 12 c/o " _ & @CRLF & "12345 PONTENUCOLA BG Cittad: ITALIANA " _ & @CRLF & "Nato il: 12/12/1912 A: MARISOLE Prov.: BG Sesso: M " _ & @CRLF & "C.F. ABCDEFGHM14I858O P.I. Tel. " _ & @CRLF & "SAE/RAE 200/ Data Visura: 12/12/1912 Prof. 000007 " _ & @CRLF & "Cod. C.R. 1234567890 Data: 01/2000 Cod. C.R.A. Data: " _ & @CRLF & "Segmento cliente: 12 MASS " _ & @CRLF & "Informazioni da altre societa' del gruppo " local $regex_one="\r\n(.*?) +" _ & "\r\n(.*?) +c/o .*" _ & "\r\n {0,4}(\d{2,5}) ([^ ].*?) +(\w\w) +" _ & "\r\n" local $regex_two="\r\n(.*?) +" _ & "\r\n(.*?) +c/o .*" _ & "\r\n {0,4}(\d{2,5}) ([^ ].*?) +(\w\w) +Cittad: +([^ ].*?) +" $regex_test_one = "(?s:"&$regex_one&"|"&$regex_two&")" ; it DOESN'T MATCH :( $regex_test_two = "(?s:"&$regex_two&"|"&$regex_one&")" ; it MATCHES :) $regex_test_simple = $regex_two ; it MATCHES :) If StringRegexp($screen,$regex_test_one) = 1 Then Msgbox(0,"","match") Else Msgbox(0,"","NOT match") EndIf What the hell is the reason why $regex_test_one doesn't match while $regex_test_two and $regex_test_simple match, when they should all match????!
-
Ah mikell you are a lifesaver! thank you so much!!!I didn't read that new part of the AutoIT help page of StringRegExp and I read on this Microsoft page https://msdn.microsoft.com/en-us/library/4edbef7e(v=vs.110).aspx (about .NET Framework) that "\v Matches a vertical tab, \u000B." that confused me. Actually what happened is that I used this function that converts CSV to 2D array https://www.autoitscript.com/forum/topic/96357-csv-to-2d-array-with-regexp/?do=findComment&comment=692864This function contains the "StringRegExp($sCSV & @CR, '(\V*)\v{1,2}', 3)" and started to truncate the lines when the CSV started to contain the null in the middle of each line.Unfortunately I don't have the right to modify the CSV.Is there a way in the regex to cross the null(s)?
-
I'm going mad for a regular expression that works not like expected. The source with the regular expression is this: #include <array.au3> $string = FileRead("with_null.CSV") ;$string = FileRead("without_null.CSV") Local $array = StringRegExp($string, '(\V*)\v{1,2}', 3) _ArrayDisplay($array) with_null.CSVI read that "\v" matches a vertical tab (\u000B) so: question 1) why and where does it find occurrencies of \v? it seems that \v matches new line characters too (unexpectedly) question 2) why is the result with "with_null.CSV" trunked (unexpected) while the result with "without_null.CSV" is not trunked (expected)? with_null.CSV without_null.CSV
-
Sorry for insisting so much but I try to be more simple than I can because I'm getting crazy in understanding your logic. My code has 3 lines: line 1: #include "F:AutoItmyscriptsmy_big_library_of_functions.au3" line 2: #include <WindowsConstants.au3> line 3: msgbox(0,"",$WC_ANIMATE) $WC_ANIMATE is declared inside WindowsConstants.au3 (line 2 expanded) Variable is used in line 3. Line 3 comes after line 2, even after expansions of includes, even in execution. Variable is used after declaration. Where am I wrong? And anyway, if an holy rule of not inserting includes in functions exists, why not writing this rule in the AutoIt Help page about #include?
-
Melba, thanks for your tip about Au3Stripper. but I'm still convinced that all of you didn't try my second/last example, that is the (only) correct one showing the problem. Please, I invite you to forget my first example (in opening post) and to only try the following, I'm pretty sure that you will find something either wrong or missing in the compiler output: ; test1.au3: #include "F:\AutoIt\myscripts\my_big_library_of_functions.au3" #include <WindowsConstants.au3> msgbox(0,"",$WC_ANIMATE) ; F:\AutoIt\myscripts\my_big_library_of_functions.au3: ; [omissis...] func one_of_many_functions() #include <WindowsConstants.au3> ; [omissis...] EndFunc ; [omissis...] ; WindowsCostants.au3 (originally included in AutoIT): #include-once ; [omissis...] ; Window Classes Global Const $WC_ANIMATE = 'SysAnimate32' ; [omissis...] This is the compiler output: Compiler execution output: "F:\AutoIt\myscripts\test1.au3" (4) : ==> Variable used without being declared.: msgbox(0,"",$WC_ANIMATE) msgbox(0,"",^ ERROR ->15:06:07 AutoIt3.exe ended.rc:1