Valnurat Posted November 18, 2015 Share Posted November 18, 2015 How can I go though a one dimention array that contains "|" as separator? Like this:Blue | Red | GreenBlue | YellowBlue | Black | Orange | BrownBut the separator is not constant. It could be zero or it could 4, 5, 6 maybe 7I need to add this in excel sheet like a treeviewBlue Red Green Yellow Black Orange Brown Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
water Posted November 18, 2015 Share Posted November 18, 2015 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
TheSaint Posted November 18, 2015 Share Posted November 18, 2015 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 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) Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted November 18, 2015 Share Posted November 18, 2015 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. Link to comment Share on other sites More sharing options...
water Posted November 18, 2015 Share Posted November 18, 2015 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Valnurat Posted November 18, 2015 Author Share Posted November 18, 2015 There is no space in the line and the scoure I got from using: $aGroupMember = _AD_RecursiveGetGroupMembers($aGroup[$i]) Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
TheSaint Posted November 18, 2015 Share Posted November 18, 2015 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. 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) Link to comment Share on other sites More sharing options...
water Posted November 18, 2015 Share Posted November 18, 2015 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Valnurat Posted November 19, 2015 Author Share Posted November 19, 2015 Ok. I can wait. Yours sincerely Kenneth. 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