Moderators Melba23 Posted January 11, 2014 Moderators Share Posted January 11, 2014 kylomas,Thanks for that. I am glad you are not advocating action, because I do not intend taking any. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kylomas Posted January 11, 2014 Share Posted January 11, 2014 HMMM...perhaps if I fly in ever tightening circles.... Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
jchd Posted January 11, 2014 Share Posted January 11, 2014 Taking care of EOLs would need _StringBetweenWithinMultilineText() and probably a new batch of fancy options Not generic enough and an ad-hoc RE is certainly in order. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Gianni Posted January 11, 2014 Share Posted January 11, 2014 (edited) Hi, Please test this new version which has an additional parameter to determine the mode used: expandcollapse popup#include <Array.au3> $sTest = '<"100" tester="Things">Nowhere' $aRet = _StringBetween_New($sTest, '"', '"') ; Default mode 0 - ending delimiter is not part of next search _ArrayDisplay($aRet, "New - 8 style", Default, 8) $aRet = _StringBetween_New($sTest, '"', '"', Default, 1) ; Mode 1 - ending delimiter is part of next search _ArrayDisplay($aRet, "New - 10 Style", Default, 8) Func _StringBetween_New($sString, $sStart, $sEnd, $fCase = False, $iMode = 0) ; Set correct case sensitivity If $fCase = Default Then $fCase = False EndIf Local $sCase = "(?is)" If $fCase Then $sCase = "(?s)" EndIf ; Set mode If $iMode <> 1 Then $iMode = 0 ; If you want data from beginning then replace blank start with beginning of string $sStart = $sStart ? "\Q" & $sStart & "\E" : "\A" ; If you want data from a start to an end then replace blank with end of string If $iMode Then $sEnd = $sEnd ? "(?=\Q" & $sEnd & "\E)" : "\z" Else $sEnd = $sEnd ? "\Q" & $sEnd & "\E" : "\z" EndIf Local $aReturn = StringRegExp($sString, $sCase & $sStart & "(.*?)" & $sEnd, 3) If @error Then Return SetError(1, 0, 0) Return $aReturn EndFunc Comments welcomed. M23 @ Melba23I'm studing and experimenting with your code about the use of the Ternary Operatoris this "other way" version equivalent to the above code or is there something wrong on using ternary operation like this?It Seems That it works as well, but is not clear to me why the $sEnd variable is assigned Correctly only if used like in line number 29while not assigned if I use the code as in the line number 30 #include <Array.au3> $sTest = '<"100" tester="Things">Nowhere' $aRet = _StringBetween_New($sTest, '"', '"') ; Default mode 0 - ending delimiter is not part of next search _ArrayDisplay($aRet, "New - 8 style", Default, 8) $aRet = _StringBetween_New($sTest, '"', '"', Default, 1) ; Mode 1 - ending delimiter is part of next search _ArrayDisplay($aRet, "New - 10 Style", Default, 8) Func _StringBetween_New($sString, $sStart, $sEnd, $fCase = False, $iMode = 0) ; Set correct case sensitivity Local $sCase (Default == $fCase) ? $sCase = "(?s)" : $sCase = "(?is)" ; If you want data from beginning then replace blank start with beginning of string $sStart = $sStart ? "\Q" & $sStart & "\E" : "\A" ; If you want data from a start to an end then replace blank with end of string $sEnd = $iMode ? ($sEnd = $sEnd ? "(?=\Q" & $sEnd & "\E)" : "\z") : ($sEnd = $sEnd ? "\Q" & $sEnd & "\E" : "\z") ; $sXXX = $iMode ? ($sEnd = $sEnd ? "(?=\Q" & $sEnd & "\E)" : "\z") : ($sEnd = $sEnd ? "\Q" & $sEnd & "\E" : "\z") Local $aReturn = StringRegExp($sString, $sCase & $sStart & "(.*?)" & $sEnd, 3) If @error Then Return SetError(1, 0, 0) Return $aReturn EndFunc ;==>_StringBetween_New thanks Edited January 11, 2014 by PincoPanco Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 11, 2014 Moderators Share Posted January 11, 2014 Pincopanco, is there something wrong on using ternary operation like this?Yes - code like that makes me think my eyes look like funkey's avatar! Seriously, I prefer code that is easy to read (and debug) when you come back to it. Nested ternary operators are most definitely NOT that, so I would not recommend using them. And the 2 lines #29 and #30 are identical - why do you think they produce different results? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Gianni Posted January 11, 2014 Share Posted January 11, 2014 (edited) And the 2 lines #29 and #30 are identical - why do you think they produce different results? M23 Because if line 30 is executed instead of line 29 the $sEnd variable (that is not used at the beginning of the line, was used another variable $sXXX instead) is not assigned correctly, while it should be (I think) by this part of code inside the brackets of the same line: ($sEnd = $sEnd ? "(?=\Q" & $sEnd & "\E)" : "\z") : ($sEnd = $sEnd ? "\Q" & $sEnd & "\E" : "\z") Edited January 11, 2014 by PincoPanco Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
kaotkbliss Posted January 11, 2014 Share Posted January 11, 2014 just wanted to make a comment on the original post (but had to take the cat to the vet so many replies have since shown up) Since you are essentially telling you want the text between quotes ("") you are in fact getting what you asked for because if you look at the string (<"100" tester="Things">Nowhere') tester= is in fact in quotes (" tester=") 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 11, 2014 Moderators Share Posted January 11, 2014 kaotkbliss,That is what drove the last change to the function and caused this problem - which only occurs when the "start" and "end" strings are the same. My new version solves the dilemma by using a new parameter. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mikell Posted January 11, 2014 Share Posted January 11, 2014 Melba, If _StringBetween() means : "get what is included between the two borders of this box", one can hardly imagine that this could mean "get what is included between the border of this box and the border of the next one" In such a case the func should have better been called _StringSplit_New() Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 11, 2014 Moderators Share Posted January 11, 2014 mikell,I share your opinion and I was quite happy with the old version, but there were several requests for the new behaviour to be adopted. All I am doing now is offering the choice. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
guinness Posted January 11, 2014 Share Posted January 11, 2014 Was interested in the speed difference with nested ternary operators. $sString = '' Sleep(100) $hTimer = TimerInit() For $i = 1 To 100000 If Random(0, 1, 1) Then ; If String. $sString = Random(0, 1, 1) ? 'True' : 'False' Else $sString = Random(0, 1, 1) ? True : False EndIf Next ConsoleWrite(TimerDiff($hTimer) & @CRLF) $hTimer = TimerInit() For $i = 1 To 100000 ; Second random is if the return should be a string or not. $sString = Random(0, 1, 1) ? (Random(0, 1, 1) ? 'True' : True) : (Random(0, 1, 1) ? 'False' : False) Next ConsoleWrite(TimerDiff($hTimer) & @CRLF) UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Morthawt Posted January 12, 2014 Author Share Posted January 12, 2014 kaotkbliss, That is what drove the last change to the function and caused this problem - which only occurs when the "start" and "end" strings are the same. My new version solves the dilemma by using a new parameter. M23 Any chance this will become the new function in Autoit? With it, nothing is lost, only the choice is gained of how you want to use it. I would hate for it to be locked into one way like it is at the moment so that everyone else cannot use the function that comes with autoit in situations like myself. Free and easy Autoit scripting video tutorials (plus more videos always coming!) General video tutorials, especially correct and safe TeamSpeak permissions tutorials. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 12, 2014 Moderators Share Posted January 12, 2014 Morthawt,You will have to wait until the next Beta to see..... But the chances are pretty good that something along these lines will be in there. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Morthawt Posted January 12, 2014 Author Share Posted January 12, 2014 This made my day! Free and easy Autoit scripting video tutorials (plus more videos always coming!) General video tutorials, especially correct and safe TeamSpeak permissions tutorials. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 14, 2014 Moderators Share Posted January 14, 2014 Morthawt, #2618. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jdelaney Posted January 14, 2014 Share Posted January 14, 2014 (edited) I'm always chiming on these types of posts, to play advocate for DOM crawling to grab the necessary data, such as node text, and attributes/values....although, this might not be a DOM, given the node name is surrounded by '"' . Edited January 14, 2014 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now