Valnurat

String search

9 posts in this topic

How can I go though a one dimention array that contains "|" as separator?

 

Like this:
Blue | Red | Green

Blue | Yellow

Blue | Black | Orange | Brown

But the separator is not constant. It could be zero or it could 4, 5, 6 maybe 7

I need to add this in excel sheet like a treeview

Blue

     Red

          Green

     Yellow

     Black

          Orange

               Brown

 


Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites



If you add _ArrayDisplay after line 

ReDim $aTreeView[$iIndexTV + 1][3]

in function _AD_GetOUTreeView you will see that in the first column you have a number of trailing spaces before the character "#".

Grab this array and write it to Excel (untested):

Global $aExcelData[$aTreeView[0][0] - 1][99]
For $i = 1 to $aTreeView[0][0]
    $iPos = StringInStr($aTreeView[$i][0], "#")
    $aExcelData[$i - 1][$iPos - 1] = $aTreeView[$i][0]
Next
_Excel_RangeWrite($oWorkbook, Default, $aExcelData)


 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Is it already an array or just a string with delimeters?

If just a string, then create an array by using StringSplit.

With an array, you can then loop through it's parts.

Global $a, $array, $string, $value

$string = "Blue | Black | Orange | Brown"
$array = StringSplit($string, " | ", 1)
For $a = 1 To $array[0]
    $value = $array[$a]
    MsgBox(0, "Value", $value)
Next
Exit

 


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

Start with splitting it (You may also want to strip whitspace)

$sData = "Blue | Black | Orange | Brown"
$aData = StringSplit($sData, "|")

Then use Waters Exel UDF to feed that array to excel. 

Share this post


Link to post
Share on other sites

TheSaint, ViciousXUSMC,

It's not that easy. He needs a treeview like structure. A posted a solution above.
And - as soon as I find some spare time - will add an Excel export function to the _AD_GetOUTreeView example script.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

There is no space in the line and the scoure I got from using:

 

$aGroupMember = _AD_RecursiveGetGroupMembers($aGroup[$i])


Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites

TheSaint, ViciousXUSMC,

It's not that easy. He needs a treeview like structure. A posted a solution above.
And - as soon as I find some spare time - will add an Excel export function to the _AD_GetOUTreeView example script.

We all posted so close together, that I never saw your post.

My reply was just to get him started, and get more info and some code.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

There is no space in the line and the scoure I got from using:

$aGroupMember = _AD_RecursiveGetGroupMembers($aGroup[$i])

Sorry, my post was a bit misleading. I mean you could grab array $aTreeView in function _AD_GetOUTreeView.
But if you could wait 1 or 2 days I'm sure I can come up with a function to let you export the treeview returned by _AD_GetOUTreeView to Excel.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Ok. I can wait.


Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites

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