Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: VBScript GUI framework  (Read 18201 times)

0 Members and 1 Guest are viewing this topic.

Linux711

    Topic Starter


    Mentor

    Thanked: 59
    • Yes
    • Programming Blog
  • Certifications: List
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
VBScript GUI framework
« on: July 21, 2010, 12:37:39 AM »
I have been programming in VB6 and vbscript for a few years and have been annoyed that vbscript doesn't allow you to create any kind of interface aside from msgbox and inputbox. So I made it. I made it a while ago and discovered that it is very useful when you want to make GUIs without opening a VB6 project and creating a whole exe. I initially intended it to be used just by me, but then I got bored and decided to make it into an official project with documentation and everything. I also added a few other classes that do "AutoIt" like stuff. The actual file that creates the GUI is an ActiveX exe (28KB) that I created in VB6.

To test it:

Download the zip.
Run the install.bat (just copies to system32 and registers the exe)
Look at and run the sample vbscripts (sample1 might not work because of a path issue)
Use wshshelp in the help folder to read all of the functions that this has

Here is a quick sample of how this works encase you don't want to download:

Code: [Select]
Dim f
Set f = CreateObject("WSHSHELL.GUI")

f.OpenWindow
f.SetWindowTitle "This is a sample window"
f.SetWindowLocation 10, 50
f.SetWindowSize 320, 200
f.LinearGradient 1, 0, 0, 255, 0, 0, 0

f.NewButton 1, "Push This!", 1, 1

While Not f.XIsPushed
   Wscript.Sleep 100
   If f.IsPushed("btn", 1) Then
      f.FMsgBox "You pressed the button."
   End If
Wend

f.CloseWindow
Set f = Nothing

[recovering disk space - old attachment deleted by admin]
YouTube

"Genius is persistence, not brain power." - Me

"Insomnia is just a byproduct of, "It can't be done"" - LaVolpe

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: VBScript GUI framework
« Reply #1 on: July 21, 2010, 01:32:23 AM »
What was wrong with using GTK with VBScript Language bindings?

(http://www.gtk-server.org/embedded.vbs.txt)

I mean no offense, but I can tell your rather new to most of this- I gather this purely from your apparent fascination with gradients. One of my first Subroutines was for painting a gradient in a variety of styles, and the first ActiveX Control I created was as well.


I've experimented with similar ideas (generalized GUI framework for scripting) but I didn't want to use it for VBScript, I wanted to use it with BCScript. Unfortunately I refuse to settle for a simple premise such as adding public methods that simply add new items to a control array. Controls.Add() would have worked perfectly, but unfortunately I could not find a way to properly sink events. I already had/have a rudimentary method (I could simply hook the event to a Evaluator function, in either my older VB6 version or my newer C# revisit) the issue (at least with VB6) was that I wanted a generalized method- I didn't want a event handler set that only worked for forms or certain controls, I wanted a way to actually sink events completely generically, much as VBControlExtender allows for ActiveX Controls (but I wanted this for <all> control and object types). I managed to get a almost working version by manually implemented COM interfaces like IConnectionPoint2, but the whole thing was pretty much a rube goldberg device standing on a house of cards, something that comes with the territory when you start dealing with low level COM interfaces and literally edit the memory of Object Vtables to get around the fact that some COM interfaces have methods that are VB6 keywords. I learned this first with IEnumVariant, I had my BCFile library working so that I could use For Each and iterate through all the files in a folder, and the custom implementation would retrieve each item one by one, rather then the makeshift method usually implemented, which is to just defer to a collection class (that is, grab all files at once and return the collection's IEnumVariant Implementation) The thing worked perfectly in the IDE, but crashed when compiled. And with all the various memory copies and modified object vtables, not to mention window subclassing debugging was anything but easy. I managed to trace it to a single instruction but was never able to determine the true cause.

Thankfully, with C#, this might be a little easier to implement, if I decide to allow it to be used as a sort of scripting language. Events are far easier to handle in a more generic fashion, especially thanks to reflection. (although the typelib information library was and is a powerful tool in VB6, when you don't have to language constructs to take advantage of the information, the information is useless).


Other notes:

Is your F: drive in some way special?
I was trying to dereference Null Pointers before it was cool.

ghostdog74



    Specialist

    Thanked: 27
    Re: VBScript GUI framework
    « Reply #2 on: July 21, 2010, 01:51:27 AM »
    @linux711, heard of HTA?

    Linux711

      Topic Starter


      Mentor

      Thanked: 59
      • Yes
      • Programming Blog
    • Certifications: List
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    Re: VBScript GUI framework
    « Reply #3 on: July 21, 2010, 01:55:27 AM »
    Quote
    What was wrong with using GTK with VBScript Language bindings?

    I didn't know something like that existed and could be implemented through vbscript.

    Quote
    I mean no offense, but I can tell your rather new to most of this- I gather this purely from your apparent fascination with gradients. One of my first Subroutines was for painting a gradient in a variety of styles, and the first ActiveX Control I created was as well.

    The gradients are just use to make the gray background more interesting. That wasn't the main focus. I know gradients are kind of dull, I will probably add some kind of themes later.

    Quote
    I've experimented with similar ideas (generalized GUI framework for scripting) but I didn't want to use it for VBScript, I wanted to use it with BCScript.

    If I made my own programming language, then I probably would have used it with that except I would have used C to make it faster.

    Quote
    Other notes:

    Is your F: drive in some way special?

    The F: drive is were VB6 is installed as well as all my program files. Why do you ask?
    YouTube

    "Genius is persistence, not brain power." - Me

    "Insomnia is just a byproduct of, "It can't be done"" - LaVolpe

    Linux711

      Topic Starter


      Mentor

      Thanked: 59
      • Yes
      • Programming Blog
    • Certifications: List
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    Re: VBScript GUI framework
    « Reply #4 on: July 21, 2010, 01:58:13 AM »
    Quote
    @linux711, heard of HTA?

    Yes, but I don't like using HTML to build a GUI. I am not much of a web programmer. I find this easier than HTML (not saying that HTML is hard  ::)
    YouTube

    "Genius is persistence, not brain power." - Me

    "Insomnia is just a byproduct of, "It can't be done"" - LaVolpe

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1140
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 11
    Re: VBScript GUI framework
    « Reply #5 on: July 21, 2010, 02:31:54 AM »
    The F: drive is were VB6 is installed as well as all my program files. Why do you ask?

    I ran sysinternals' "strings" utility on it, and one of the strings was

    Code: [Select]
    F:\ProgramFiles\VB6\VB98\VB6.OLB

    also whats with the  "behzad.khazama" as the description in the manifest, as well as the url to "http://www.khazama.com/" And what is "Dosaidsoft"?

    I'd remove those, or at least change them. I know I still have a few executables on my drive floating around with "School District 68" as their author.

    I would have used C to make it faster.

    C doesn't make anything faster. it certainly makes most development a lot slower and tedious.
    I was trying to dereference Null Pointers before it was cool.

    Linux711

      Topic Starter


      Mentor

      Thanked: 59
      • Yes
      • Programming Blog
    • Certifications: List
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    Re: VBScript GUI framework
    « Reply #6 on: July 25, 2010, 09:50:04 PM »
    Quote
    also whats with the  "behzad.khazama" as the description in the manifest, as well as the url to "http://www.khazama.com/" And what is "Dosaidsoft"?

    The "behzad.khazama" manifest is what I used to apply the XP themes to my program. I got it from a forum and forgot to remove the guy's name  ::) DosaidSoft is just what I call my one-man software company.

    Quote
    I'd remove those, or at least change them. I know I still have a few executables on my drive floating around with "School District 68" as their author.

    I'll remove the "behzad.khazama" and the web site, but isn't the "F:\ProgramFiles\VB6\VB98\VB6.OLB" required or something?
    YouTube

    "Genius is persistence, not brain power." - Me

    "Insomnia is just a byproduct of, "It can't be done"" - LaVolpe

    elishakkk



      Newbie

      • Experience: Experienced
      • OS: Windows 7
      Re: VBScript GUI framework
      « Reply #7 on: May 14, 2015, 09:25:02 AM »
      Where do i download this framework

      Salmon Trout

      • Guest
      Re: VBScript GUI framework
      « Reply #8 on: May 14, 2015, 10:46:08 AM »
      Where do i download this framework
      Not here; deleted years ago; it was a home made thing; not available any more.