"MageKing17" said: Now add a bit to the exec script that runs every script in a specific folder, e.g. "autorun". That way people can add autorunning scripts without editing the exec script every time. Put this in your exec.txt:
Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.getFolder("Scripts") Set fc = f.Files For Each f1 in fc s = f1.name if Right(s,4) = ".bas" then s2 = Left(s, Len(s) - 4) form.exec(s2 & "") end if Next Modify the getFolder thingy if you want a different folder. Feel free to improve on this script, my vbscript is a bit... Well, I started learning it half an hour ago.
[EDIT]Note that the working dir is the application dir. Also, don't assume anything about the order of loading the files.
So, script showoff time?
Sub Noise() for i = 0 to 2000 Form.DrawPixel Rnd * 640, Rnd * 480, Rgb(Rnd * 256, Rnd * 256, Rnd * 256) next End Sub Kind of stresses the system, though.
Global variables are possible, too:
Randomize Timer Dim X,Y,Speed X = Rnd * 640 Y = 0 Speed = 10 Sub Falling() Y = Y + Speed if Y > 480 then Y = 0 X = Rnd * 640 end if Form.DrawCircle CInt(X), CInt(Y), 10, Rgb(Rnd * 256, Rnd * 256, Rnd * 256) End Sub For some reason, you need to add explicit casts when using variables. Oh well. Anyway, with global variables, you could do interesting things...
|