Book a Demo

Author Topic: VB scripting problem  (Read 6035 times)

Dave.B

  • EA User
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
VB scripting problem
« on: September 29, 2009, 02:30:06 am »
I thought I'd give EA's new scripting feature a go today (v7.5.846), but have run into a problem. It seems that it is not possible to create a variable with built-in VB type.
Code: [Select]
dim a as stringresults in a cryptic "Expected end of line" error message whereas
Code: [Select]
dim aon its own does not. However, in the latter case variable "a" is not a string object and I cannot therefore access any of the string object's methods or properties.

I'm now also getting cross because EA has developed a bad case of the crashes every time I try and do something with my script.

Has the built-in VB scripting support forgotten to load the VB type library? Do I give this up as bad job and write an external plug-in?

Regards
Dave B.

Takeshi K

  • EA User
  • **
  • Posts: 630
  • Karma: +43/-1
    • View Profile
    • Sparx Systems Japan
Re: VB scripting problem
« Reply #1 on: September 29, 2009, 10:35:07 am »
Hello Dave,

If I understand correctly, VBScript does not support to specify type for Dim statement. All variable is always VARIANT type.
(EA's scripting feature uses Microsoft VBScript internally.)


--
t-kouno

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: VB scripting problem
« Reply #2 on: September 29, 2009, 04:33:34 pm »
Dave,

I think the message is: only use VBScript for small disposable quickies.
If you want to do anything decent, use a real programming language ;)

Geert

Code: [Select]
dim a as string
-- Im sorry Dave, I'm afraid I can't do that
;D

Dave.B

  • EA User
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
Re: VB scripting problem
« Reply #3 on: September 29, 2009, 06:15:18 pm »
Code: [Select]
dim a as stringworks in the MS Excel VBA. Is there a difference between VBA (VB for Applications) and VBS (VB Scripting)?

Dave B.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: VB scripting problem
« Reply #4 on: September 29, 2009, 06:38:31 pm »
Yes, the difference is that VB(A) is strong typed, and VBScript is not.

Geert

Dave.B

  • EA User
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
Re: VB scripting problem
« Reply #5 on: September 29, 2009, 06:52:48 pm »
Geert,
OK, thanks for the clarification. I'll approach it with the right frame of mind now! :)

Regards
Dave B.

Dave.B

  • EA User
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
Re: VB scripting problem
« Reply #6 on: September 29, 2009, 11:09:55 pm »
For reference the MS VBS documentation/help page can be found at http://msdn.microsoft.com/en-us/library/t0aew7h6%28VS.85%29.aspx

Dave B.