FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


[VB6]Making a Scriptable Macro/Engine





Monster_Hack
This Tutorial will show you the basics of The Ms Script Control in VB6

1. Intro and The Basics


First Start a new Project in Visual Basics

Now, Press Ctrl + T. Doing this will bring up your project's componants.
Look for "Microsoft Script Control 1.0"


Now you will have a little icon like so .

2. Running the 'Scripts'

Ok, now add a the script control on to your project. Name it "SC"
Now add a button and a textbox.

Your Project should now look like this:


Double Click on your Button and add this code to it.
Code:
SC.AddCode Text1.Text


* SC = Script Control.
* AddCode = Allows you to use this code
* Text1 = The Textbox we added earlier

Now you can do little things like MsgBox.
Simple Visual Basic Coding.

Example, Write this in your textbox > run > Click the Button
Code:
MsgBox "This is the Start of your Script Engine"
Congratulations! You can now run 'scripts' from your engine

3. A Little Deeper

Wish to continue? Move on to something like SunMacro?
Must have a little exp. to continue:

Easiest way to control a script, and most likely the only way, is using a Class Module to use the functions.

So now add this:
Code:
Public cScript As New clscScript
Add a Class Module into your Project.
Write your Functions in there.

Now update your 'run' (The Button) codes:
Code:
SC.Reset
SC.AllowUI = True
SC.TimeOut = NoTimeout
SC.AddObject "cscript", cScript, True
SC.AddCode Text1.Text
SC.Run "Main"
You have added Your Class Module into your Engine.
As well as Subs.

Run:
Code:
Sub Main()
MsgBox "Monster Hack's Tut pwns"
End Sub

Congratulations! You are now ready to make your own scriptable macro

Made for SunSharez(Don't worry, no sharez)
-Monster Hack
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.