Results 1 to 5 of 5

Thread: [RESOLVED] [2005] Scriptable Application

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Resolved [RESOLVED] [2005] Scriptable Application

    I've recently completed an app that controls a heap of test equipment (that does board testing). Using my App, the user sets up tests for different voltages, frequencies, temperatures etc, the App drives the test equipment over GPIB and also captures/plots the results. The user can access the PC using VNC, which saves them having to turn up at the lab to switch the oven temperature over, restart it, view the results or whatever. This all works great.

    But... the various tests are currently hardcoded and the user just chooses which ones to run in sequence (from checkboxes in a ListView). It would be really neat to be able to support user written 'scripts' that would look something like this...

    For Temp = -40 to +140 step 20
    For V1 = 2.5 to 3.5 step 0.1
    For F1 = 1M to 100M step log 1 decade
    Measure Vout
    Next F1
    Next V1
    Next Temp
    Plot (x=F1,y=Vosc,z=V1) etc.

    I can hardcode each such test and add it to the existing list of tests, but this needs "me" to do it. Since I effectively have a library of subs/functions that does all the necessary stuff, it would be good if my App could read/run a script. Any suggestions how I could make my App's inner functions scriptable? Users could then code their own tests and I dont need to be summoned every couple of hours to write a new one. (Originally I was told there was a well defined fixed set of tests, hence I assumed hardcoding them was fine. So I'm trying to retrofit a new feature that wasnt requested, yuk!).

    I was thinking of adding an edit window and writing a parser which checks the script and then calls the various subs, but this is like writing a compiler and needs error checking galore (lot of work). To avoid exposing my code, I could also create DLL's which the user then calls, but there would be no error checking.

    Do I need to do all this or is there a better way? Any advice appreciated.
    Last edited by Bulldog; Dec 31st, 2006 at 10:16 AM.

  2. #2
    Fanatic Member Mr.No's Avatar
    Join Date
    Sep 2002
    Location
    Mauritius
    Posts
    651

    Re: [2005] Scriptable Application

    A couple of pointers for you.
    Have a look at System.Reflection and see how you can dynamically call methods and properties.
    You haven't mentioned up to what level your users could write scripts. Its more likely that you want users to set start/end values of particular property values. I would suggest showing them how to write these in a specific text file format or you could user XML. You could then read that file and use Reflection to invoke you DLL.

    e.g

    VB Code:
    1. <?xml version="1.0" ?>
    2. <tests>
    3. <test method="dllname.CheckRange">
    4. <startval></starval>
    5. <endval></endval>
    6. </test>
    7. </tests>
    Using VB.NET 2003/.NET 1.1/C# 2.0
    http://del.icio.us/rajoo
    Blow your mind, smoke gunpowder
    Ashes to ashes, dust to dust
    If God won't have you, the devil will. - Author unknown
    Don't follow me, I'm lost too ...

  3. #3
    Addicted Member
    Join Date
    Sep 2004
    Location
    UK
    Posts
    129

    Re: [2005] Scriptable Application


  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Scriptable Application

    Excellent links guys. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width