Page 1 of 1

VBScript / How to use standard VB syntax

Posted: 21 Feb 2012, 22:16
by florian
Hi

I'm looking for using standard VB syntax like Trim or Chr.
How to activate them under the script editor ?
I get Compilation error each time I use these functions

Code: Select all

		outChapitreBool = False
		If Trim(B_chapitre) <> "" Then
			outChapitre = Trim(B_chapitre)
			outChapitreBool = True
			
			changed = True
		End If
			
		outSessionBool = False
		If Trim(C_titre) <> "" Then
			outSession = Trim(C_titre)
			outSessionBool = True

			changed = True
		End If				
		
		' outIntervenants = 
		outDebug = A_heure & ". " & B_chapitre & chr(13) & chr(10)&  C_titre

Re: VBScript / How to use standard VB syntax

Posted: 22 Feb 2012, 11:54
by Daniel Willer
There are syntax errors in your code have a look here.

Re: VBScript / How to use standard VB syntax

Posted: 22 Feb 2012, 12:02
by florian
Oups, right !
I used to code in Perl so i still have my old reflex...

Do you have any web link with condensed references about basic VB scripting?
Thanks,

Re: VBScript / How to use standard VB syntax

Posted: 26 Feb 2012, 02:39
by florian
Hi,

I tried several way to code and i still have some incompatibilities like this one :

(VBscript)

Code: Select all

		'	json   =     {"id":123264,"username":"cobalt","user_id":1,"quote":"Azerazerzaerzaera","url_avatar":"","posted_at":1330018915,"votes":0,"time":1330018915,"type":0,"posted_via":0,"moderation":1,"favori":0},
		debug = ""
		
		Dim regex As String = "quote"":"""  
		Dim tableau() As String = json.Split(regex)
		
		For i As Integer = 0 To tableau.Length - 1
			debug = debug & tableau(i) & "__"
		Next		
my regex variable would be interpret as a Char ("q") and not as a string ("quote...")
The tooltip when i type a Split( indicates 6 ways to use sur function (3 with Char delimiter, 3 with String Delimiter) but no way to use the String delimiter

String Splitter node use only Char delimiter

I discover several way to code on MSDN
http://msdn.microsoft.com/fr-fr/library ... split.aspx
http://msdn.microsoft.com/en-us/library/tabh47cf.aspx

Code: Select all

Dim phrase As String = "The quick brown fox"
Dim words() As String

words = phrase.Split(TryCast(Nothing, String()),  
                       StringSplitOptions.RemoveEmptyEntries)

words = phrase.Split(New String() {},
                     StringSplitOptions.RemoveEmptyEntries)

With 2 ways to do it, and different arguments
which one should i use ?

Thanks for your help,

Re: VBScript / How to use standard VB syntax

Posted: 04 Mar 2012, 19:06
by florian
up