Jump to content

Recommended Posts

  • Moderators
Posted

PhoenixXL,

I'm late

Beating you to a Regex has made my day! :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • 2 weeks later...
Posted (edited)

sorry to re-open this... i am still missing some matches.

i think this would work...

so if this is the string

$sString = ";<-------------------- begin MustHave --------------------->" & @CRLF & _

"" & @CRLF & _

";<-------------------- begin PC_Anywhere --------------------->" & @CRLF & _

"" & @CRLF & _

";<-------------------- begin Window Context Menu --------------------->" & @CRLF & _

"" & @CRLF & _

";<-------------------- begin Web, File, Folder Notes Links --------------------->" & @CRLF & _

"" & @CRLF & _

"$changelog_all_entries[898] = 'New|PC_Anywhere: option to PC Anywhere remote PCs where available.|0.4.1.7'" & @CRLF & _

"$changelog_all_entries[899] = 'Changed|MustHave: entries automatically sort alphabetically after editing or adding items.|0.4.1.8'" & @CRLF & _

"$changelog_all_entries[900] = 'Changes|MustHave: parent categories do not need to be selected for adding and editing items.|0.4.1.8'" & @CRLF & _

"$changelog_all_entries[898] = 'New|PC Anywhere: option to PC Anywhere remote PCs where available.|0.4.1.9'" & @CRLF & _

"$changelog_all_entries[900] = 'Changes|Window Context Menu: another of gcues little gotchas|0.4.1.10'" & @CRLF & _

"$changelog_all_entries[900] = 'Changes|Web, File, Folder Notes Links: and yet another one - when will it end?|0.4.1.11'"

strip out underscores, spaces and comma's from both the search text (begin ....) and where it searches in the changelog entries.

thank you!!!

Edited by gcue
  • Moderators
Posted

gcue,

And what have you tried so far that has not worked? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

this is what i have so far...

; Get list of begin "text"
$aBegin = StringRegExp($data, "(?U)begin\s(.*)\s-", 3)

;~ _ArrayDisplay($aBegin)

; Now look for data
Local $aFinal[1] = [0]
For $i = 0 To UBound($aBegin) - 1
$text = StringReplace($aBegin[$i], " ", "")
$text = StringReplace($text, "_", "")
$text = StringReplace($text, ",", "")

    ; Amend underscore and spaces to look for both
;~     $sLine = StringRegExpReplace($aBegin[$i], "[\s|_]", "\[\\s\|_\]")

   ; Extract lines
    $aRet = StringRegExpReplace($data, "(?U)" & $text & ":\s(.*)'", "")



    ; Add to list
    _ArrayConcatenate($aFinal, $aRet)
    $aFinal[0] += UBound($aRet)

ConsoleWrite($text & @CRLF)

for $j = 1 to UBound($aRet)-1
ConsoleWrite($aRet[$j] & @CRLF)
Next
ConsoleWrite(@CRLF)
Next

;~ _ArrayDisplay($aFinal)
  • Moderators
Posted

gcue,

This strips the spaces, commas and underscores as you asked: :)

#include <Array.au3>

$sString = ";<-------------------- begin MustHave --------------------->" & @CRLF & _
    "" & @CRLF & _
    ";<-------------------- begin PC_Anywhere --------------------->" & @CRLF & _
    "" & @CRLF & _
    ";<-------------------- begin Window Context Menu --------------------->" & @CRLF & _
    "" & @CRLF & _
    ";<-------------------- begin Web, File, Folder Notes Links --------------------->" & @CRLF & _
    "" & @CRLF & _
    "$changelog_all_entries[898] = 'New|PC_Anywhere: option to PC Anywhere remote PCs where available.|0.4.1.7'" & @CRLF & _
    "$changelog_all_entries[899] = 'Changed|MustHave: entries automatically sort alphabetically after editing or adding items.|0.4.1.8'" & @CRLF & _
    "$changelog_all_entries[900] = 'Changes|MustHave: parent categories do not need to be selected for adding and editing items.|0.4.1.8'" & @CRLF & _
    "$changelog_all_entries[898] = 'New|PC Anywhere: option to PC Anywhere remote PCs where available.|0.4.1.9'" & @CRLF & _
    "$changelog_all_entries[900] = 'Changes|Window Context Menu: another of gcues little gotchas|0.4.1.10'" & @CRLF & _
    "$changelog_all_entries[900] = 'Changes|Web, File, Folder Notes Links: and yet another one - when will it end?|0.4.1.11'"


; Simulate loading the file into an array
$aLines = StringSplit($sString, @CRLF, 1)

Global $aBegin[1] = [0]
For $i = 1 To $aLines[0]
    ; Is it a "begin" line
    If StringInStr($aLines[$i], ";<-") Then
        ; Extract the text
        $sExtract = StringRegExpReplace($aLines[$i], "(?U)\A.*begin\s(.*)\s-.*\z", "$1")
        ; Strip spaces, commas and underscores
        $sExtract = StringReplace(StringReplace(StringStripWS($sExtract, 8), "_", ""), ",", "")
        ; Add to array
        $aBegin[0] += 1
        ReDim $aBegin[$aBegin[0] + 1]
        $aBegin[$aBegin[0]] = $sExtract
    EndIf
Next

; Result
_ArrayDisplay($aBegin)

; Now look for data
Local $aFinal[1] = [0]
For $i = 1 To $aLines[0]
    ; Is it a "changelog" line
    If StringInStr($aLines[$i], "$changelog") Then
        ; Extract the section which might match
        $sExtract = StringRegExpReplace($aLines[$i], "(?U)\A.*\|(.*):.*\z", "$1")
        ; Strip spaces, commas and underscores
        $sExtract = StringReplace(StringReplace(StringStripWS($sExtract, 8), "_", ""), ",", "")
        ; See if we have a match
        $iIndex = _ArraySearch($aBegin, $sExtract)
        If $iIndex <> -1 Then
            ; ; Extract the section which we need
            $sExtract = StringRegExpReplace($aLines[$i], "(?U)\A.*:\s(.*)'\z", "$1")
            ; Add to array
            $aFinal[0] += 1
            ReDim $aFinal[$aFinal[0] + 1]
            $aFinal[$aFinal[0]] = $sExtract
        EndIf
    EndIf

Next

; And here we are!
_ArrayDisplay($aFinal)

But does it work as you expected? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (edited)

hmm not really dealing with the string.. the string was just an example of what the text looked like in the script...

your example works wonderfully though.. =)

$file = "C:\script.au3"

$data = FileRead($file)

; Get list of begin "text"
$aBegin = StringRegExp($data, "(?U)begin\s(.*)\s-", 3)

haha love the changelog text edits too =)

Edited by gcue
Posted (edited)

ok so here's what im trying to do...

im trying to list out all the functions in the script.... they all are bunched up with ;<--- begin FUNCTION

then im trying to pull together the descriptions for each of those functions in the change logs

so

<Function>

----

(any thing found in the changelog regarding that function)

-entry1

-entry2

-etc

i have around 100 functions that i want to gather descriptions for and also do put together a training manual.. so i figure if this could be automated... that much easier to get this project going...

hope that makes sense =)

thank you!!!

Edited by gcue
  • Moderators
Posted

gcue,

You need to read the file into an array using _FileReadToArray - not the simple FileRead you are using. I tried to explain that with the "; Simulate loading the file into an array" comment: ;)

$file = "C:\script.au3"
Global $aLines
FileReadToArray($file, $aLines)

Now you have the file in a format that the script can use. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • Moderators
Posted

gcue,

ok so here's what im trying to do...

So after 27 posts you spring yet another suprise. You told me on the previous page:

haha nope sorry man - no more "gotchas"

and yet here you are again moving the goal-posts in mid-match. I am afraid that is one too many - I am out and extemely annoyed. :mad:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

so sorry Melba - i failed to communicate accurately. like you said, i should have come out and laid out my goal from the getgo.

my sincere apologies.

at any rate, thank you again for all your help.

definitely a learning experience in more than one respect.

thanks again

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...