charon Posted January 14, 2014 Share Posted January 14, 2014 I need to insert a quote at the end of a string so I thought I could use _StringInsert with a negative value for last position but doesn't seem to work. I suppose I could use stringlen to get the length of each string and insert it that way. Output is: setup channel1 input "V:MediaTVAbott-CostelloMoviesAbbott & Costello -- Meet Frankenstein (1948).div"x $sInsertString = 'setup channel' & $channel & ' input "' & $dir & '\' $sInsertString2 = '"' Local $aArray = _FileListToArrayRec($dir, "*.avi;*.mkv;*.mp4;*.divx||*.*", 13, 1, 1, 1) ConsoleWrite("Error: " & @error & " - " & " Extended: " & @extended & @CRLF) _ArrayDisplay($aArray, "Sorted tree") ;extract artist from first index and compare with previous value to see if it changes and update channel local $sString[2] $iPosition = StringInStr($aArray[2], "\") $sString[0] = StringLeft($aArray[2], $iPosition -1) ; Retrieve 5 characters from the left of the string. $sString[1] = StringLeft($aArray[2], $iPosition -1) ;MsgBox(0, "", "string: " & $sString[0]) For $i = 2 To $aArray[0] +1 $iPosition = StringInStr($aArray[$i], "\") $sString[1] = StringLeft($aArray[$i], $iPosition -1) ; Retrieve 5 characters from the left of the string. If $sString[0] <> $sString[1] Then ;MsgBox(0, "", "change found string: " & $sString[1]) $sString[0] = $sString[1] $channel = $channel +1 ;$sInsertString = 'setup channel' & $channel & ' input "v:\Media\Music-MP3\Music-Master\' $sInsertString = 'setup channel' & $channel & ' input "' & $dir & '\' ;_ArrayInsert($aArray[$i], $i, "new channel" & $channel & " broadcast enabled loop") EndIf $aArray[$i] = _StringInsert ( $aArray[$i], $sInsertString, 0) ;left side so we are inserting at the beginning of line $aArray[$i] = _StringInsert ( $aArray[$i], $sInsertString2, -1) ;right side insert a quote at end ;$aArray[$i] = StringTrimRight($aArray[$i], 1) ; Next _ArrayDisplay($aArray, "Sorted tree") EndFunc Link to comment Share on other sites More sharing options...
charon Posted January 14, 2014 Author Share Posted January 14, 2014 My bad.. I should have just did this: $aArray[$i] = $aArray[$i] & $sInsertString2 works now Link to comment Share on other sites More sharing options...
Mechaflash Posted January 14, 2014 Share Posted January 14, 2014 (edited) It doesn't exist probably because you can just $aArray[$i]&=$sInsertString2 Welp you got it I gave you the short-handed version of what you put. Edited January 14, 2014 by Mechaflash Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
guinness Posted January 14, 2014 Share Posted January 14, 2014 Good to see you're adopting new function charon. 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...
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