Jump to content

Kyan

Active Members
  • Posts

    543
  • Joined

  • Last visited

Everything posted by Kyan

  1. When you're inside another loop than the main loop (the one that receives user inputs from your gui) you can't get those inputs, to circumvent that issue you have to use events, what I usually do is this: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $Flag = 1 #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("TEST", 202, 65, 192, 124) $Button1 = GUICtrlCreateButton("Button", 64, 32, 75, 25) $Checkbox1 = GUICtrlCreateCheckbox("OnEvent", 120, 8, 65, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 If GUICtrlRead($Checkbox1) = $GUI_CHECKED And $Flag Then LOOP() $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(64,"MSG","NORMAL") EndSwitch WEnd Func LOOP() $Flag = 0 Opt("GUIOnEventMode",1) GUISetOnEvent($GUI_EVENT_CLOSE,"_exit") GUICtrlSetOnEvent($Button1,"Button1") GUICtrlSetOnEvent($Checkbox1,"checkbox") While 1 Sleep(20) If $Flag Then ExitLoop WEnd Opt("GUIOnEventMode",0) EndFunc Func Button1() MsgBox(64,"MSG","I'm inside a LOOP") EndFunc Func _exit() Exit EndFunc Func checkbox() $Flag = 1 EndFunc
  2. Is the requested data splited in parts, you just have to merge them. https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2
  3. Hi, I'm trying to get the language tags (pt_pt, en_gb,...) and their data "ALLWORK" in this case, why isn't it working? $aPreDATA = '<div data-type="inputText" name="title" data-multilang data-legend="Título" data-force><pt_pt>ALLWORK</pt_pt><en_gb>ALLWORK</en_gb><fr_fr>ALLWORK</fr_fr><de_de>ALLWORK</de_de></div>' $atitle = StringRegExp($aPreDATA,'(?i)<div data-type="inputText" name="title".*?>(?:<(\w{2}_\w{2})>(.+?)</\g-1>)+?</div>',3) _ArrayDisplay($atitle) Also tried this and no luck $aPreDATA = '<div data-type="inputText" name="title" data-multilang data-legend="Título" data-force><pt_pt>ALLWORK</pt_pt><en_gb>ALLWORK</en_gb><fr_fr>ALLWORK</fr_fr><de_de>ALLWORK</de_de></div>' $atitle0 = StringRegExp($aPreDATA,'(?i)<div data-type="inputText" name="title".*?>(.+?)</div>',3) $atitle = StringRegExp($atitle0,'(?i)<(\w{2}_\w{2})>(.*?)</',3) Thanks in advance
  4. Expected Match: ISO/IEC 11770-2:2008/Cor.1:2009(E) Expected Output: ISO/IEC 11770-2:2009(E) #1 GlobalMatch Mode: (?i)((?:bs )?(?:en )?(?:np )?(?:is[o0]|DIN)\V{1,10}[-\d]+)(.+:)?(\d{4}(?:\(\w\))?) output: #2 On global match (3), greedy match: (?i)((?:bs )?(?:en )?(?:np )?(?:is[o0]|DIN)\V{1,10}[-\d]+)(.*:)?(\d{4}(?:\(\w\))?) Same regexp PHP match (2): Row|Col 0 [0]|ISO/IEC 11770-2:2008 [1]|ISO/IEC 11770-2 [2]|: [3]|2008 The thing is that it never outputs the same number of rows. The only possibility I see is to use to output: $a[ubound($a)-3]&$a[ubound($a)-1] to always output the "Expected Output". #1 and #2 end up with the same matches (using in the first the "+" and in the last "*") The things change when I only use "*": (?i)((?:bs )?(?:en )?(?:np )?(?:is[o0]|DIN)\V{1,10}[-\d]*)(.*:)?(\d{4}(?:\(\w\))?) Global Matches (3): PHP Match:
  5. so using .* would only match the last one? (I thought that quantifier matches 0 or more times)
  6. @jchd, there's some way that I start matching from the end of the document?
  7. thank you @jchd! I made it to match other standards than ISO (DIN) and the letter between parenthesis isn't always a (E), that's a revision letter, so I placed a \w instead of "e" https://regex101.com/r/jezYus/3
  8. First of all, thanks to all of you for helping me out. @jchd wow, great website, so your proposal is to match them in groups then use StringRegExpReplace to place them correctly? Can you give me a advice how should I include other standards variants in the first capture group? There're BS EN ISO... EN ISO.., EN NP ISO...and sometimes my OCR fails and translates ISO to IS0 so I tried with this but doesn't look good: ((?:BS\h+)?(?:EN\h+)?(?:NP\h+)?IS[0o]) @InunoTaishou don't be confused, because that's a correct input-output
  9. yes, but that changes how I was capturing strings previously, I was outputting one liners with these (using StringRegExp flag 2): BS( EN ISO)?.+?[\d-]+:[\d-]+(\(\w\))?|DIN.+?[\d-]+:[\d-]+(\(\w\))?|EN\s+?NP\s+?ISO.+?[\d-]+?:[\d-]+(\(\w\))?|EN\s+?ISO.+?[\d-]+:[\d-]+(\(\w\))?|ISO.+?[\d-]+:[\d-]+(\(\w\))? the thing is that I found those "Amd..." that I only wanted the year preceeded by "Amd.\d:" Sorry if this is kinda complicated, but it's kinda hard to understand how a non capturing group is captured.
  10. With stringregexpreplace works fine, but why can't (?:) work properly? $text="ISO 11784:1996/Amd.2:2010(E)|ISO 11784:1996/Amd.1:2007|ISO 11784-1-2:1989(B)" $aText = StringSplit($text,"|") For $x In $aText $l = StringRegExp($x,'(?i)iso\s+\d+:(?:\d{4}.+?amd.+?\:)\d{4}(?:\(\w\))?',2) If Not @error Then ConsoleWrite($l[0]&@LF) Next outputs: ISO 11784:1996/Amd.2:2010(E) ISO 11784:1996/Amd.1:2007 EDIT: This one also doesn't work, is a zero width look behind $text="ISO 11784:1996/Amd.2:2010(E)|ISO 11784:1996/Amd.1:2007|ISO 11784-1-2:1989(B)" $aText = StringSplit($text,"|") For $x In $aText $l = StringRegExp($x,'(?i)iso\s+[-\d]+:(?<=\d{4}.+?amd.+?\:)?\d{4}(?:\(\w\))?',2) If Not @error Then ConsoleWrite($l[0]&@LF) Next @Melba23 I need your expertise pls
  11. Already said what they are but there it goes an example Inputs: ISO 11784:1996/Amd.2:2010(E) ISO 11784:1996/Amd.1:2007 ISO 11784-1-2:1989(B) Outputs: ISO 11784:2010(E) ISO 11784:2007 ISO 11784-1-2:1989(B)
  12. Hey mikell Can't be done with the regular expression? I could do that, I do that to remove multiple consecutive spaces after capturing it (?i)iso\s+\d+:(?:\d{4}.+amd.+:)?\d{4}(?:\(e\))? This one also doesn't work, it displays 1996
  13. Hi jchd, It doesn't work, outputs: Row|Col 0 [0]|ISO 11784:1996(E) [1]|ISO 11784: [2]| [3]|1996(E) on the line [0] should have outputted: ISO 11784:2010(E) there's also standards with hyphens: ISO 11412-2-1:2001, that's why I used a class
  14. Hey everyone I'm stuck with this regular expression, for matching a iso standard version what I want to do is match the text in green: ISO 11784:1996/Amd.2:2010(E) there is also others that look like this: ISO 11789:1999(E), and without the (E) part, Só I did this one  (?i)ISO.+?[\d-]+:(?:\d+/Amd.+?:)?[\d-]+(?:\(\w\))* to match both cases but doesn't ignore the text in red Can somebody point out what I'm doing wrong here?
  15. Thank you so much zedna, that's really helpful
  16. Hi, this is a noob and simple question, that's why I'm asking it here Does Excel udf use microsoft excel from office suite? I look into udf's code and only saw this ObjCreate("Excel.Application"), which made me wonder if it can run without excel being installed Sorry if this question is stupid.
  17. Neat So Excel udf is the way to go, thanks water
  18. with 1.6.3.6 works output --------------------------- REDIRECTION: --------------------------- About to automatically redirect the request to: http://www.google.pt/?gfe_rd=cr&ei=JSZRVe2qB_Kr8we6goCQAg --------------------------- OK ---------------------------
  19. @water, 3k lines are okay for it? I know for sql 3k lines aren't anything, but for excel I'm sceptical xD I was going to use this code to add the lines to the bottom of the xls file https://www.autoitscript.com/forum/topic/126570-insert-row-into-excel/ EDIT: @SadBunny, add lines to a excel file for 1-2months which is 2880-5760lines
  20. jchd will not be please by this dig up. Can you provide your code? I'm using winhttp v1.6.3.6, and to disable redirects so far I'm doing like this: _WinHttpSetOption($hRequest, $WINHTTP_OPTION_DISABLE_FEATURE, $WINHTTP_OPTION_REDIRECT_POLICY_NEVER) ... ... _WinHttpSendRequest($hRequest) _WinHttpReceiveResponse($hRequest) If _WinHttpQueryDataAvailable($hRequest) Then $sLocation = _WinHttpQueryHeaders($hRequest, 33) ;33=location: Endif
  21. Hi I never had to do this, my ISP in the last trimester force me to downgrade my internet speed due to high deman on my area (new homes coming to the grid), and my line max speed changes on hour to hour basis, so I'm going to register in every 15min my wan speed for a month or two. The problem is, can I store it right a way to a excel file or it should be done in other way? Just asking this to avoid crashes in the middle of the data gathering
  22. Malkey, so SRE is not delimited by the text you enter? (thought it would be constrained inside the curve brackets "\{\}") So, if it behaves like a inline script is more complex to imagine how it is gonna to behave :|, can this be done with lookahead?
  23. I removed the line but it gives me this error from the msgbox -2146697210 I used your last code: #include-once #include <_XMLDomWrapper.au3> #include <Array.au3> _XMLFileOpen(@ScriptDir & "\example.xml") MsgBox(0, '@error', @extended) $aNodes = _XMLGetChildNodes("/compactdiscs") For $iNode = 1 To $aNodes[0] $POLY_COORDS = _XMLGetChildren("compactdiscs/" & $aNodes[$iNode]) ConsoleWrite("/compactdiscs/" & $aNodes[$iNode] & "[" & $iNode & "]" & @CRLF) $ID = _XMLGetAttrib("/compactdiscs/" & $aNodes[$iNode] & "[" & $iNode & "]", "id") MsgBox(0, $ID, StringReplace($POLY_COORDS[1][1], @TAB, "")) Next and example.xml had been edited to <?xml version="1.0"?> <compactdiscs> <compactdisc> <artist type="individual">Frank Sinatra</artist> <title numberoftracks="4">In The Wee Small Hours</title> <tracks> <track>In The Wee Small Hours</track> <track>Mood Indigo</track> <track>Glad To Be Unhappy</track> <track>I Get Along Without You Very Well</track> </tracks> <price>$12.99</price> </compactdisc> <compactdisc> <artist type="band">The Offspring</artist> <title numberoftracks="5">Americana</title> <tracks> <track>Welcome</track> <track>Have You Ever</track> <track>Staring At The Sun</track> <track>Pretty Fly (For A White Guy)</track> </tracks> <price>$12.99</price> </compactdisc> </compactdiscs>
  24. Hi, I don't know why this is happening, but better post the code #include <Array.au3> $json = '[{"Id":"2","button":"#random#","status":"ok"},{"Id":"56","button":"#random#","status":"checking"},{"Id":"61","button":"#random#","status":">"},{"Id":"42","button":"#random#",' & _ '"status":">"},{"Id":"43","button":"#random#","status":"ok"},{"Id":"45","button":"#random#","status":"failed"}]' $aJSON = StringRegExp($json, '(?i)\{"Id":"(\d+?)","button":".+?","status":"(?:ok|checking)"\}',3) _ArrayDisplay($aJSON)output: 2 56 61 expected 2 56 43 I don't know why SRE is capturing 61
  25. See if this works (don't know how should I test this xD), I only used IE udf one or three times...and I hate it $oButtons = _IEGetObjByName($oForm,"administrace",-1) For $oBtn In $oButtons If _IEFormElementGetValue($oBtn) = "Zmazat" Then _IEAction($oBtn, "focus") _IEAction($oBtn, "click") ExitLoop EndIf Next
×
×
  • Create New...