cyanidemonkey Posted September 24, 2015 Share Posted September 24, 2015 This is probably a very simple thing to resolve, but I could not figure it out from the AutoIt Help, or find it on the forums.I want to use _ArrayAdd with delimiter feature off. I have an issue where a randomly generated string sometimes contains a pipe and is splitting the string. Because it is random string generation (not controlled by me) I can not simply switch the delimiter to another character without the probability it would also randomly break the string. My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator Link to comment Share on other sites More sharing options...
czardas Posted September 24, 2015 Share Posted September 24, 2015 (edited) You could probably use something like ChrW(63743) for the delimiter. How many characters are in the random selection? How is the random string generated?_ArrayAdd ($aArray, $vValue, $iStart, ChrW(63743)) Edited September 24, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 24, 2015 Moderators Share Posted September 24, 2015 cyanidemonkey,Are you adding a single item each time to a 1D array?If so, use the $ARRAYFILL_FORCE_SINGLEITEM parameter as explained in the Help file.If not, then you need to do as czardas has suggested and force the delimiter to a character which is not going to be used - 0xEF0F is from the user-defined set and should pose no problems with normal characters in any language.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...
czardas Posted September 24, 2015 Share Posted September 24, 2015 Ah, I didn't know about that. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 24, 2015 Moderators Share Posted September 24, 2015 czardas,I added that after the last round of complaints.M23 czardas 1 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...
TheSaint Posted September 24, 2015 Share Posted September 24, 2015 Cannot you just do some replacement (substitution) method in the randomly generated string, before the array is made, which gets restored during a read of the array. For example, use an uncommon ASC II character or combination. 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...
czardas Posted September 24, 2015 Share Posted September 24, 2015 (edited) Not really because the problem still remains and you would also have to loop through the array to make the replacements. The characters me and M23 suggested do not exist in any language. In fact this Unicode range is intended for private use, and this is an example of where such characters can come into play. If they do happen to occur within the string (highly unlikely), then you can simply loop through the range until one is found that is not contained within the string. The likelihood of a string containing all Unicode characters (being generated randomly) is so remote that it's hardly worth consideration at all.* On the other hand if the string can contain these private range characters, you should loop through as I suggested. This is actually implemented in my CSV UDF, but I very much doubt the loop ever ran more than once before a suitable delimiter was found* To try and create such a string using AutoIt would actually be quite difficult. Edited September 24, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
cyanidemonkey Posted September 24, 2015 Author Share Posted September 24, 2015 Thank You Guys.It is part of an automated test script that is retrieving the random generated password (sent from our server) from our test email account using POP3 etc.I could not find $ARRAYFILL_FORCE_SINGLEITEM in the Help file. I am currently running on v3.3.12.0 so I suspect I am needing to update to the latest version. My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator Link to comment Share on other sites More sharing options...
TheSaint Posted September 24, 2015 Share Posted September 24, 2015 Not really because the problem still remains and you would also have to loop through the array to make the replacements.* To try and create such a string using AutoIt would actually be quite difficult.Why would you not do the replacement before the string gets added to the array? In other words you test each string for your delimiter first. When you extract (or read) a string from the array, you apply the reverse treatment.Now that we know it is a password, that gives quite a few replacement characters for use outside the norm, but just to be sure, you could also use a combination of two or three characters that just would never appear together. 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...
czardas Posted September 25, 2015 Share Posted September 25, 2015 (edited) Why would you not do the replacement before the string gets added to the array? In other words you test each string for your delimiter first. When you extract (or read) a string from the array, you apply the reverse treatment.The reason is that it is a slow process. You need to first run a check. Then you replace the characters. At the end you loop through the array and undo all the replacements. Instead of all that - simply add the string and be done (in this case). I think this should be the default behaviour of the function _ArrayAdd(). Further delimiters can be included - depending on the number of dimensions in the array* ...2, 3, 4 etc. I don't think default delimiters should be used, but rather specified by the developer. If no delimiter is specified, I would put everything in the first element created - but that's just my own take on it.* or the number of additions. Edited September 25, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
czardas Posted September 25, 2015 Share Posted September 25, 2015 I could not find $ARRAYFILL_FORCE_SINGLEITEM in the Help file. I am currently running on v3.3.12.0 so I suspect I am needing to update to the latest version.Yep! operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
guinness Posted September 25, 2015 Share Posted September 25, 2015 v3.3.14.0 or above to be exact. 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...
TheSaint Posted September 25, 2015 Share Posted September 25, 2015 (edited) The reason is that it is a slow process. You need to first run a check. Then you replace the characters.It seemed to me that we were most likely looking at a fraction of a second here, so I guess "slow" is relative, dependent on the number of passwords to be processed at any one time, and I would not actually do a separate check or test, just apply the StringReplace to every string before adding it to the array. I don't see where looping through the array comes into it. Replacements occur before add and then only again (the reverse) when reading an entry in the array (loop method or otherwise).The real question I guess, is whether the array is an array full of passwords or just a single password with some other user data, and if that last is so, then it is likely that slowness is not relevant at all, unless you are processing a whole database of passwords at one time, and they are numbered in the hundreds etc.Anyway this is a mote point now, seeing as it is not necessary, due to the string being a password, any ASC II character that will not be in the password (if all passwords are standard keyboard based) would be suitable as the delimiter. Then again, perhaps not, if the password is being stored encrypted, which means it could contain any character.P.S. Obviously I always opt for the simplest approach, but you and Melba23 seem to have the solution well in hand, and the OP seems to understand, so really I'm not arguing against that, just continuing for my own enlightenment and or offering what seems a suitable alternative, just in case. In any case, we lack full knowledge of the complete scenario ... number of passwords, etc. Edited September 25, 2015 by TheSaint 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...
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