title: VB scripting in bartender label software
body: <p>Hi I am trying to code vb scripting for my bartender label,
  Can any one help me how can i achieve to plurge the spaces in a string and at the end of the string i need to add ~ till 14 characters.</p>
  
  <p>For example if my data in the text5 has <code>012 911 023 L</code>, then first i need to plurge as <code>012911023L</code>, then i need to  add ~ such that there are 14 characters in that text5 in total. So that output should be like <code>012911023L~~~~</code>
  Please note this is not a C# or simple scripting like vb i found scripting is something is very different here in barteneder label vb scripting.</p>
  
  <p>My code looks like below:</p>
  
  <pre><code>Dim sName
  Dim fso
  Dim fol
  
  ' get value from the text5
  Set fol = Format.Objects("Text 1").Value
  
  ' go thru each files in the folder
  For Each fil In fol.Files
      ' check if the file name contains tilde
      If InStr(1, fil.Name, "~") &lt;&gt; 0 Then
          ' replace tilde with space
          sName = Replace(fil.Name, "~", " ")
          ' rename the file
          fil.Name = sName
      End If
  Next
  </code></pre>
  
  <p>For my above script I am getting an error called " <code>OnAutoSelectedEvent (Line 7):  Object required: '[string: "sample text"]'</code></p>
  
  <p><a href="http://i.stack.imgur.com/VlnCk.jpg" rel="nofollow">Click here for my label text properties</a></p>