Sign in to follow this  
Followers 0
jaberwacky

GUIObjects Demo

18 posts in this topic

#1 ·  Posted (edited)

This is the first useful application of my GUIObjects project.

A little background on GUIObjects.

GUIObjects wraps all (soon will be all) GUI controls and forms into self contained objects. The use of handles and IDs are managed behind the scenes. This won't make your programs any faster however it will make them easier to manage and to create. I don't honestly expect anyone to use this, however, I will be using it in my future projects. I will attempt to answer any questions you may have -- other than "Will this make my script run faster?". I will also not entertain any queries as to the utility of this project. With that said I present the first useful application.

On my machine, for future reference, whenever I download an installer EXE I then store that EXE in a separate folder after installation. The same goes for when I uninstall programs. I remove the EXE from the 'installed EXEs' folder to the 'uninstalled EXEs' folder. The purpose of which has served me well from time to time. These folders are located on another partition. Whenever I reinstall Windows then I already have my EXEs within easy reach. Oh sure, I could just slipstream them into Windows and whenever I reinstall they are installed automatically. But won't I have to do that every time I reinstall? And also, I keep track of uninstalled programs in case I ever need to revert to an earlier version.

I now have this process automated. Whenever I uninstall a program I just open this script up, select the uninstalled EXE, and then click move.

The point is not what the demo does but how it does it.

previous: 13


Run "Installer Manager.au3" (BUT DON"T ACTUALLY TRY TO USE IT)  Just look at the code really.

Tested in Windows 7 Pro x64 and Windows XP Pro x86 on an ancient Dell Inspiron 8100 (FTW!) without obvious problems.

Edited by jaberwocky6669

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

What are the advantages? My script will run faster?

You use functions that call native functions... I do not see benefits

Edited by jscript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

Why use this:

Func Ctrl_SetData( $this , Const $data )
    #forceref $this
    $this.Data = $data
    GUICtrlSetData( $this.ID , $this.Data )
    Return $this
EndFunc

And not this:

GUICtrlSetData( $this.ID , $this.Data )

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

You said ass :unsure:


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

You did too.

So, if I would take your script, change it a bit, compile it to this (follow the link) and wrote another:

#include <GUIConstantsEx.au3>
#include <AutoItObject.au3>

Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
Func _ErrFunc()
    ConsoleWrite("COM Error, ScriptLine(" & $oError.scriptline & ") : Number 0x" & Hex($oError.number, 8) & " - " & $oError.windescription & @CRLF)
EndFunc   ;==>_ErrFunc

Global Const $gui_width = 800
Global Const $gui_height = 600

_AutoItObject_Startup()

Global $hGUI = _AutoItObject_ObjCreateEx(@ScriptDir & "\GUIObj.server", "cbi:GUIObjectsDemo.Application")

$hGUI.Create("Button Demon -- Hours of Fun!", $gui_width, $gui_height)
$hGUI.SetBkColor(0x1F0000)
$hGUI.OnEvent($GUI_EVENT_CLOSE, "_exit")

Global $hButton1 = $hGUI.Button
$hButton1.Create("Click Me!  }:>", $gui_width, $gui_height)

Global $hButton2 = $hGUI.Button
$hButton2.Create("Click Me! Too }:>", $gui_width, $gui_height)

Global $MouseNFO

While 1
    $MouseNFO = $hGUI.GUIGetCursorInfo()
    If $oError.number Or Not IsArray($MouseNFO) Then ExitLoop

    Switch $MouseNFO[4]
        Case $hButton1.ID
            $hButton1.SetRandPos()
        Case $hButton2.ID
            $hButton2.SetRandPos()
    EndSwitch
    Sleep(10)
WEnd

...Then place both in the same directory and run latter.

Several instances at once maybe even. That would be cool I say.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

I couldn't get it to run. I put GUIObjects.server in a folder. Then I put two copies of your posted script into that same folder. I run the two scripts but here are the error messages:

COM Error, ScriptLine(16) : Number 0x000000A9 - Variable must be of type 'Object'.

COM Error, ScriptLine(17) : Number 0x000000A9 - Variable must be of type 'Object'.

COM Error, ScriptLine(18) : Number 0x000000A9 - Variable must be of type 'Object'.

COM Error, ScriptLine(20) : Number 0x000000A9 - Variable must be of type 'Object'.

COM Error, ScriptLine(21) : Number 0x000000A9 - Variable must be of type 'Object'.

COM Error, ScriptLine(23) : Number 0x000000A9 - Variable must be of type 'Object'.

COM Error, ScriptLine(24) : Number 0x000000A9 - Variable must be of type 'Object'.

COM Error, ScriptLine(29) : Number 0x000000A9 - Variable must be of type 'Object'.

Share this post


Link to post
Share on other sites

I have used #include <AutoItObject.au3> (as you can see). Probably the version of AutoItObject that gets run with you is some older one.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

1.2.3.0

DOH! Now I have the latest version: 1.2.4!!!!!

WELL actually, origo or whatever it's called isn't acting right.

Ok, I can only get one window to run at a time. And yes I compiled the two scripts. Whenever I run the first script everything is as expected. However, when I run the second script only one window remains but then I get four buttons on the one window.

Edited by LaCastiglione

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

1.2.3.0

DOH! Now I have the latest version: 1.2.4!!!!!

WELL actually, origo or whatever it's called isn't acting right.

Ok, I can only get one window to run at a time. And yes I compiled the two scripts. Whenever I run the first script everything is as expected. However, when I run the second script only one window remains but then I get four buttons on the one window.

You don't need to compile anything.

Every new instance adds two more buttons to the main GUI, that is the idea and that's what makes it interesting.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

You don't need to compile anything.

Well, if I don't compile them then I can only run one at a time from SciTE.

Every new instance adds two more buttons to the main GUI, that is the idea and that's what makes it interesting.

That is quite an interesting twist. I had in mind using two different GUIs running from the same GUIObjects.server. The two GUIs interpret the data in their own unique ways.

Edited by LaCastiglione

Share this post


Link to post
Share on other sites

right-click the script -> Run

No need to do it from Scite every time.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0