Book a Demo

Author Topic: JScript development and MDG Technoligies  (Read 6371 times)

SvenK

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
JScript development and MDG Technoligies
« on: January 09, 2013, 09:36:30 pm »
Hello,

as there is no feasible way to automatically import a couple of JScripts into EA, I started to investigate in MDG Technologies to do so.
However, I faced some problems:

I maintain a couple of scripts and stored them in different groups. However, the group information is lost when exporting as MDG. Do I have to maintain all scripts in a flat tree? This becomes very confusing.

It is not possible to edit scripts imported from MDG, which is on one hand obvious. However, how do I develop the scripts? Do I need a "master development project file" where the scripts are stored instead of imported as MDG and only develop functionality within this project?

Can I use variables in the !INC command to switch between script groups?
E.g.
Code: [Select]
var group="MyLocalGroup"
!INC <group>.myscript

Code: [Select]
var group="MyMdgGroup"
!INC <group>.myscript

Do you have a better workflow to develop JScripts and easily distribute/update them?

Sven

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: JScript development and MDG Technoligies
« Reply #1 on: January 10, 2013, 08:26:57 am »
It is probably easiest to have a single model where you develop scripts. Yes, they will all be grouped into a group with the technology name.

To avoid needing to change your scripts to reference a group it's probably easiest to put them in a group by that name in the model you are developing them in.

SvenK

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: JScript development and MDG Technoligies
« Reply #2 on: January 10, 2013, 06:13:16 pm »
Thanks for the hint.

In what table are the scripts stored? I was thinking of writing a script to import other scripts directly into the database.
It's is quite uncomfortable to be not able to versioning our scripts and to make diffs on changes.

Sven

SvenK

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: JScript development and MDG Technoligies
« Reply #3 on: January 10, 2013, 10:39:05 pm »
It was easier to find than expected:
t_script

SvenK

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: JScript development and MDG Technoligies
« Reply #4 on: January 10, 2013, 11:15:40 pm »
In the table t_script, the following fields are available:
ScriptCategory: Referece to an GUID; only different for Group or script
ScriptName: Unique GUID
ScriptAuthor: GUID of the Author
Notes: Short description of script type in XML
Script: The actual script content

However, in what table can the ScriptCategory be found.
And how to get a GUID when inserting an new script to the t_script table?

Any help would be appreciated.

Sven

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: JScript development and MDG Technoligies
« Reply #5 on: January 11, 2013, 03:35:53 am »
From my book Inside EA concerning ScriptCategory:
Quote
A value to distinguish between group and script. It looks like a GUID but it has no “{}”
3955A83E-9E54-4810-8053-FACC68CD4782 = group
605A62F7-BCD0-4845-A8D0-7DC45B4D2E3F = script

q.

SvenK

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: JScript development and MDG Technoligies
« Reply #6 on: January 11, 2013, 08:25:34 pm »
Thanks, so it is only a constant (same values in my project file).
With this I figured out that ScriptAuthor references to the Group where a script is stored (weird name).

So the last think I have to figure out is how to get a new GUID to use it as ScriptName if I add a new script.

Paulus

  • EA User
  • **
  • Posts: 152
  • Karma: +0/-0
    • View Profile
Re: JScript development and MDG Technoligies
« Reply #7 on: January 11, 2013, 10:33:45 pm »
Hi Sven,

I know this was answered some time ago, somewhere on this forum, bu i can't find it.

Anyways, you can use the GUID generated by the script below,

regards,

Paulus

Code: [Select]
Dim typeLib
typeLib = CreateObject("Scriptlet.TypeLib")

' GUIDs returned from typeLib have 2 unprintable characters at the end. Strip them off.
GenerateGUID = Left(typeLib.Guid, 38)

SvenK

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: JScript development and MDG Technoligies
« Reply #8 on: January 11, 2013, 11:05:00 pm »
Thanks!

For the sake of completeness, this is the corresponding JScript code.
Code: [Select]
function getNewGuid()
{
      var typeLib = new ActiveXObject("Scriptlet.TypeLib")
      return typeLib.Guid.slice(0,38) // Last two character are unreadable
}

Here are some interesting details on why using TypeLib:
http://blogs.technet.com/b/heyscriptingguy/archive/2005/02/21/how-can-i-create-a-guid-using-a-script.aspx

Sven