메뉴 닫기

Embeddable script editor for MFC applications


Objects Events Listing
Sample screenshot
Pop-Up Object properties and methods list
Sample screenshot
IntelliSense – like function parameters tooltips

Introduction

I’ve been searching the net for a suitable and affordable solution that will allow me to embed scripting functionality in my C++ application. What I found was either not sufficient or cost a lot of money.
So I’ve decided to make one of my own. After about a month of work and testing I’ve come up with this embeddable scripter.
I made it a separate DLL , which is really easy to use.

Usage

  1. Download the source code, and compile it. Make sure to compile the correct version (Debug\Release) or both.
  2. Include ScriptEditor.h in your project and add the library ScriptEditor.lib to your additional libraries. Make sure to reference the correct version! Debug version for debugging and release version for release!
  3. Copy the DLL to the same folder as your executable.
  4. In your code create an instance of CScripter and initialize it.
  5. Add your objects to the script and optionally the script text.

Example

In the header of your main application window add:

#include "..\ScriptEditor\Scripter.h"

Add member variable:

CScripter scripter;

Then when initializing add:

scripter.CreateEngine("VBScript");

After that add your objects to the script:

scripter.AddObject("MPlayer",(IDispatch *)m_mediaPlayer.GetControlUnknown());
scripter.AddObject("PlayButton",
      (IDispatch *)m_commandButton.GetControlUnknown());
scripter.AddObject("TabStrip",(IDispatch *)m_tabStrip.GetControlUnknown());
scripter.AddObject("SimpleObject",m_simpleObject.GetIDispatch(TRUE));

And optionally set the script text:

scripter.scriptText = "MsgBox \"Test message\"";

After that the script is ready to run, you now may do one of the following:

// Run the script
scripter.StartScript();
// Stop the script execution
scripter.StopScript();
// Open the script editor window
scripter.LaunchEditor();
// Reset the script (All added objects are removed and engine is recreated)
scripter.Reset();

39 Comments

  1. which g

    Have you ever considered writing an e-book or guest
    authoring on other websites? I have a blog centered on the same topics you discuss and would
    really like to have you share some stories/information. I know my readers would value
    your work. If you’re even remotely interested, feel free
    to send me an e mail.

  2. than g

    Nice post. I was checking continuously this
    blog and I am impressed! Extremely helpful information particularly the last
    part 🙂 I care for such info much. I was seeking this particular
    information for a long time. Thank you and good luck.

  3. Danielle Mattews

    I just want to tell you that I’m new to blogging and definitely liked you’re web page. Probably I’m likely to bookmark your website . You definitely have good well written articles. Thanks for sharing your blog.

  4. buy viagra

    I found your blog website on google as well as examine a few of your early blog posts. Remain to keep up the very good operate. I simply extra up your RSS feed to my MSN News Reader. Seeking ahead to learning more from you later!?

  5. CBD Capsules

    I simply must tell you that you have written an excellent and unique article that I really enjoyed reading. I’m fascinated by how well you laid out your material and presented your views. Thank you.

  6. top 3 benefits of cbd

    Oh my benefits! a remarkable post guy. Thank you Nevertheless I am experiencing concern with ur rss. Don?t understand why Not able to subscribe to it. Exists any person obtaining similar rss trouble? Any person who recognizes kindly respond. Thnkx

  7. Visit Website

    I?m pleased, I need to claim. Actually rarely do I experience a blog that?s both enlightening and also amusing, and also let me inform you, you have hit the nail on the head. Your idea is superior; the concern is something that not enough individuals are speaking intelligently about. I am very pleased that I stumbled across this in my look for something connecting to this.

  8. visit the site

    After study a few of the blog posts on your site now, and I genuinely like your method of blogging. I bookmarked it to my book marking web site listing as well as will certainly be checking back soon. Pls check out my internet site as well and also let me know what you assume.

  9. blog link

    I am often to blogging and also i truly appreciate your material. The short article has really peaks my interest. I am going to bookmark your website and maintain looking for brand-new info.

  10. important source

    Great post. I find out something much more difficult on different blog sites daily. It will always be stimulating to check out content from various other authors and also exercise a little something from their store. I?d favor to use some with the material on my blog site whether you don?t mind. Natually I?ll give you a link on your internet blog. Many thanks for sharing.

댓글 남기기

이메일은 공개되지 않습니다.