Jump to content

Is this the right way to do this?


 Share

Recommended Posts

Hi all

Noob question time again...sorry

Im writing a frontend to install a given set of programs so its click a button get an install type of thing

I tried using While > Wend but for every 1 at the end i got a duplicate frontend on top of the exisitng one, then i went to Func > EndFunc and its sort of working

Now ive been reading up and im wondering if Switch...Case...EndSwitch is what i should be using?

Below is an example of the download and install part, i havent added the progress bars yet for each

If $msg = $tech_but_1 Then
            If $net_test = 0 Then
                MsgBox (0, "Connection Error", "        No Internet Connection Is Currently Available. ", 5)
                    Else
                        $URL = "http://www.piriform.com/ccleaner/download/slim/downloadfile/"
                            $file = @ScriptDir & "\file_includes\tech\tech_ccleaner.exe"
                        InetGet ($URL , $file, 1, 0)
                    If FileExists(@ScriptDir & "\file_includes\tech\tech_ccleaner.exe") Then
                RunWait(@ScriptDir & "\file_includes\tech\tech_ccleaner.exe /S")
            EndIf
        EndIf

And i will have another 8 or 10 of these but with different installs should i put them in a Case for each install?

Or what is the correct way to call a program from a button.

and one small question to finish.

I often see around the forums things like this

_Install()
Func _Install()

What is the significance of the _Install bit and why does it have to be named twice?

Im assuming it is some kind of expression? and can it be called like a $msg?

Thanks for any help

Chimaera

Link to comment
Share on other sites

  • Moderators

Chimaera,

Using a Switch/Select structure within an infinite loop is the "normal" way to check for button presses on a GUI when using AutoIt in GetMessage mode. So if you have 8/10 buttons you would need 8/10 Case elements within the structure (or possibly less if some buttons do the same thing! :( ).

_Install()          ; Run the function
Func _Install()     ; Declare the function

All this does run the subsequently declared function called _Install. Some programmers prefer nearly all script activity to occur in functions, others are less concerned. One for the main reasons for wanting to keep activity in functions is that it effectively limits the scope of variables - although it can mean a lot of parameter passing between the various functions. :graduated:

If all that sounds like Chinese, go and read the Variables - using Global, Local and ByRef tutorial in the Wiki - it should help clarify "scope"! :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks for the advice M23 ill follow up that link you gave me.

As for the first bit

should the switch statement always be within a Func statement

Or just on its own eg..

_Install() 
Func _Install()
        Switch = GUIGetMsg()
            Case
                1st Program setup
            Case 
                2nd program setup
            Case Else
                Do nothing
        EndSwitch
EndFunc

Is that correct?

Link to comment
Share on other sites

  • Moderators

Chimaera,

should the switch statement always be within a Func statement [...] Is that correct?

Not really - I think you have got very much the wrong end of the stick! :(

Look at the example for GUICreate in the Help file - you can see that it starts:

; Some initialisation lines

Example1()
Example2()

; example 1
Func Example1()
; Lots more code

Here the whole script is actually in the 2 functions Example1 and Example2. Study the example script and you will see that everything from GUI creation to the GUIGetMsg loop for each example is contained within the relevant function. Now this is an extreme case of the "everything in a function" programming style that I mentioned earlier, but it is perfectly valid.

In your case I imagine you have your GUI creation code earlier in your script, so there is little to be gained by passing the GUIGetMsg return value to a function which only contains the Switch structure. What you might think of doing is to make a function for each of the install selections - something along these lines:

; code

Switch = GUIGetMsg()
    Case
        ;1st Program setup
        _Install1()
    Case 
        ;2nd program setup
        _Install2()
    Case Else
        Do nothing ; No need for this - if nothing matches, nothing happens!
EndSwitch

Func _Install1()
    ; code to install app 1
EndFunc

Func _Install2()
    ; code to install app 2
EndFunc

That way you keep your GUIGetMsg loop nice and tidy and put all the messy code in a function. I am a great believer in trying to keep code as tidy as possible - I find it helps in debugging if you keep things nice and clear. Besides, you often find you can reuse functions in other scripts (even if they do require a little tweaking for different variable names at times) - this is known as modular coding where you use generic functions to do standard things, a bit like the UDFs if you like.

But all this is just a matter of coding style. If you look at the scripts posted by those members who have been here a while you will see that they tend to use the sort of methods I have mentioned above. No-one has the perfect solution - a lot depends on exactly what the script is for and how the particular coder likes to set up his code.

I hope that helps explain a bit more. :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks again M23

Reverting to what i know more about

In CMD the _Install1() is basically a type of goto then?, could it also be done $_Install1 as well? or is it better to keep it as you have shown

And another thought i have often seen

_Install1(with a load of stuff in here between the brackets) is that saying goto with these conditions?

Odd now im getting errors using your example

C:\Users\Jez\Desktop\Autoit Stuff\Modules\Tech_Tools\Tech_Tools_4.au3(96,8) : ERROR: syntax error

Switch =

~~~~~~~^

C:\Users\Jez\Desktop\Autoit Stuff\Modules\Tech_Tools\Tech_Tools_4.au3(98,9) : ERROR: syntax error

Case

~~~~~~~~^

C:\Users\Jez\Desktop\Autoit Stuff\Modules\Tech_Tools\Tech_Tools_4.au3(101,9) : ERROR: syntax error

Case

~~~~~~~~^

code is like this

Switch = GUIGetMsg()
    ;==;
    Case
        ;1st Program setup
        _AVG_32()
    Case
        ;2nd program setup
        _AVG_64()
    ;==;
EndSwitch

Chimaera

Edited by Chimaera
Link to comment
Share on other sites

  • Moderators

Chimaera,

_Install1() is basically a type of goto then?

NO! :D

From the Help file:

"A function is a section of code that can be called from the script to perform a certain "function"."

So when you call a function you are asking for this section of code to be run at that point in the script. Regardless of what that section of code does, you always return to that same point in the script at some point - unless the script comes across an "Exit" command beforehand. :D

Perhaps this will help to clarify: :graduated:

; Some code                                                Func Function_1
Function_1()--------------------------------------------->     ; Code for Function_1
                                                               ; Some more code for Function_1
; We restart the main script with this code <-------------     ; Even more code for Function_1
; And yet more code                                        EndFunc
; [...]
; Even more code                                           Func Function_2
Function_2()--------------------------------------------->     ; Code for Function_2
                                                               ; Some more code for Function_2
; And return to the main script here <--------------------     ; Even more code for Function_2
; And continue with more code                              EndFunc
; And even more code

And you most certainly cannot use $_Install1 - again from the Help file:

"Function names must start with either a letter or an underscore, and the remainder of the name can contain any combination of letters and numbers and underscores.".

Only variables begin with $:

"Each variable [...] must start with the $ character and may only contain letters, numbers and the underscore _ character".

Of course, another of the advantages of using functions is the ability to use the same code at several points in your script - saves a lot of wear on your typing fingers. :D

Clearer now? :(

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thank you for being patient with a stupid person ;O)

i very much doubt ill ever come up with the insane stuff like some off you do, as long as i conquer my little bits of code all will be well...

Ive tried a number of permutations to try and get your example working, i shoved a couple of msgboxes just to be able to test it but it still throws the errors

Switch = GUIGetMsg()
    Case
        ;$install_but_3
        _Install1()
    Case
        ;$install_but_4
        _Install2()
EndSwitch

Func _Install1()
       MsgBox(4096, "avg32", "test")
EndFunc

Func _Install2()
     MsgBox(4096, "avg64", "test")
EndFunc

the buttons that call these 2 are

$install_but_3

$install_but_4

Am i missing an include or something? the error i get is

C:\Users\Jez\Desktop\Autoit Stuff\Modules\Tech_Tools\Tech_Tools_4.au3(96,8) : ERROR: syntax error

Switch =

~~~~~~~^

C:\Users\Jez\Desktop\Autoit Stuff\Modules\Tech_Tools\Tech_Tools_4.au3(98,9) : ERROR: syntax error

Case

~~~~~~~~^

C:\Users\Jez\Desktop\Autoit Stuff\Modules\Tech_Tools\Tech_Tools_4.au3(101,9) : ERROR: syntax error

Case

~~~~~~~~^

Link to comment
Share on other sites

  • Moderators

Chimaera,

Go and look at the Switch page in the Help file and see where your syntax differs from what you see there - the errors give you a very good indication of where you need to look. :graduated:

M23

P.S. If you really cannot see where it is wrong:

Switch GUIGetMsg()       ; <<<<<<<<<<<<<<<< no = here
    Case $install_but_3  ; <<<<<<<<<<<<<<<< you need a value here
        _Install1()
    Case $install_but_4  ; <<<<<<<<<<<<<<<< you need a value here too!
        _Install2()
EndSwitch

Func _Install1()
       MsgBox(4096, "avg32", "test")
EndFunc

Func _Install2()
     MsgBox(4096, "avg64", "test")
EndFunc

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

That was one of the permutations i ran , it makes the gui appear but the buttons dont produce the msgboxes for some reason

I assumed it was something id done so discounted it as a working one

here is the log from the bottom of autoit using that example

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\Jez\Desktop\Autoit Stuff\Modules\Tech_Tools\Tech_Tools_4.au3" /autoit3dir "C:\Program Files (x86)\AutoIt3" /UserParams

+>17:31:12 Starting AutoIt3Wrapper v.2.0.1.24 Environment(Language:0409 Keyboard:00000809 OS:WIN_7/ CPU:X64 OS:X64)

>Running AU3Check (1.54.19.0) from:C:\Program Files (x86)\AutoIt3

+>17:31:12 AU3Check ended.rc:0

>Running:(3.3.6.1):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\Jez\Desktop\Autoit Stuff\Modules\Tech_Tools\Tech_Tools_4.au3"

+>17:32:02 AutoIT3.exe ended.rc:0

Link to comment
Share on other sites

  • Moderators

Chimaera,

Please post the script - the log just tells me it ran! :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Chimaera,

Please post the script - the log just tells me it ran! :graduated:

M23

here you go

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs
    Tech Tools ,  Created And Designed By Jez (Chimaera)
    Author: Jez (Chimaera)
    Date: 13/10/2010
    Description: Tech Tools
    Usage: For Installing Software Silently On Customers Pc's
    ;
#ce
#Include <GuiButton.au3>
#include <ButtonConstants.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
;
Global $net_test, $gl_font, $Gui_Run, $i
;
Opt('MustDeclareVars', 1)
;
$net_test = Ping("www.google.com", 4000)
;
;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;
;Gui start
$Gui_Run = GUICreate("  Tech Tools ,  Created And Designed By Jez (Chimaera)  ", 600, 600)
Global $URL, $file, $msg, $cmd
Local $tab_make_1, $tab_label_1, $install_but_1, $install_but_2, $install_but_3, $install_but_4, $install_grp_1, $install_grp_2, $install_grp_3
;Tab 1
    $tab_make_1 = GUICtrlCreateTab(15, 15, 575, 575)
        $tab_label_1 = GUICtrlCreateTabItem("  Install And Tech Tools  ")
            GUICtrlSetFont($tab_make_1,10, "600","","Tahoma")
                $gl_font = GUISetFont(10, "600", "", "Tahoma")
                    $install_grp_2 = GUICtrlCreateGroup(" Multi Install ", 32, 315, 265, 61)
                        GUICtrlSetColor(-1, 0xFF0000)

                ;==;
                    $install_grp_3 = GUICtrlCreateGroup(" Single Install ", 32, 46, 265, 330)
                        GUICtrlSetColor(-1, 0xFF0000)
                        $install_but_3 = GUICtrlCreateButton("Avg 32", 40, 72, 58)
                        $install_but_4 = GUICtrlCreateButton("Avg 64", 102, 72, 58)

GUICtrlCreateTabItem("")
;
GUISetState();==;Gui end
;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;
Switch GUIGetMsg()

    Case $install_but_3
        _Install1()
;==;
    Case $install_but_4
        _Install2()
;==;
EndSwitch

Func _Install1()
    MsgBox(4096, "avg32", "test")
EndFunc

Func _Install2()
    MsgBox(4096, "avg64", "test")
EndFunc

;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;
_Exit()
Func _Exit()
    While 1
        $Gui_Run = GUIGetMsg()
        If $Gui_Run = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete()
EndFunc   ;==>Exit

i tried compiling as well but no joy

Edited by Chimaera
Link to comment
Share on other sites

Your script only checks for the buttons being pushed once, and then goes to the while...wend loop looking for the exit. You need to write it this way.

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs
    Tech Tools ,  Created And Designed By Jez (Chimaera)
    Author: Jez (Chimaera)
    Date: 13/10/2010
    Description: Tech Tools
    Usage: For Installing Software Silently On Customers Pc's
    ;
#ce
#include <GuiButton.au3>
#include <ButtonConstants.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
;
Global $net_test, $gl_font, $Gui_Run, $i
;
Opt('MustDeclareVars', 1)
;
$net_test = Ping("www.google.com", 4000)
;
;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;
;Gui start
$Gui_Run = GUICreate("  Tech Tools ,  Created And Designed By Jez (Chimaera)  ", 600, 600)
Global $URL, $file, $msg, $cmd
Local $tab_make_1, $tab_label_1, $install_but_1, $install_but_2, $install_but_3, $install_but_4, $install_grp_1, $install_grp_2, $install_grp_3
;Tab 1
$tab_make_1 = GUICtrlCreateTab(15, 15, 575, 575)
$tab_label_1 = GUICtrlCreateTabItem("  Install And Tech Tools  ")
GUICtrlSetFont($tab_make_1, 10, "600", "", "Tahoma")
$gl_font = GUISetFont(10, "600", "", "Tahoma")
$install_grp_2 = GUICtrlCreateGroup(" Multi Install ", 32, 315, 265, 61)
GUICtrlSetColor(-1, 0xFF0000)
;==;
$install_grp_3 = GUICtrlCreateGroup(" Single Install ", 32, 46, 265, 330)
GUICtrlSetColor(-1, 0xFF0000)
$install_but_3 = GUICtrlCreateButton("Avg 32", 40, 72, 58)
$install_but_4 = GUICtrlCreateButton("Avg 64", 102, 72, 58)
GUICtrlCreateTabItem("")
;
GUISetState();==;Gui end
;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;
;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;
While 1
    $Gui_Run = GUIGetMsg()
    Switch $Gui_Run
        Case $install_but_3
            _Install1()
            ;==;
        Case $install_but_4
            _Install2()
            ;==;
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd
Func _Install1()
    MsgBox(4096, "avg32", "test")
EndFunc   ;==>_Install1
Func _Install2()
    MsgBox(4096, "avg64", "test")
EndFunc   ;==>_Install2

This puts your button checks inside the While...Wend loop where it belongs, so that the buttons are continuously monitored, and still allows you to exit the script.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

Chimaera,

You have your idle loop is in the wrong place. At present you check the buttons once only and then go to the exit, where you loop to no purpose. :(

Take a look at this: :graduated:

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs
    Tech Tools ,  Created And Designed By Jez (Chimaera)
    Author: Jez (Chimaera)
    Date: 13/10/2010
    Description: Tech Tools
    Usage: For Installing Software Silently On Customers Pc's
    ;
#ce
#include <GuiButton.au3>
#include <ButtonConstants.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
;
Global $net_test, $gl_font, $Gui_Run, $i
;
Opt('MustDeclareVars', 1)
;
$net_test = Ping("www.google.com", 4000)
;
;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;
;Gui start
$Gui_Run = GUICreate("  Tech Tools ,  Created And Designed By Jez (Chimaera)  ", 600, 600)
Global $URL, $file, $msg, $cmd
Local $tab_make_1, $tab_label_1, $install_but_1, $install_but_2, $install_but_3, $install_but_4, $install_grp_1, $install_grp_2, $install_grp_3
;Tab 1
$tab_make_1 = GUICtrlCreateTab(15, 15, 575, 575)
$tab_label_1 = GUICtrlCreateTabItem("  Install And Tech Tools  ")
GUICtrlSetFont($tab_make_1, 10, "600", "", "Tahoma")
$gl_font = GUISetFont(10, "600", "", "Tahoma")
$install_grp_2 = GUICtrlCreateGroup(" Multi Install ", 32, 315, 265, 61)
GUICtrlSetColor(-1, 0xFF0000)

;==;
$install_grp_3 = GUICtrlCreateGroup(" Single Install ", 32, 46, 265, 330)
GUICtrlSetColor(-1, 0xFF0000)
$install_but_3 = GUICtrlCreateButton("Avg 32", 40, 72, 58)
$install_but_4 = GUICtrlCreateButton("Avg 64", 102, 72, 58)

GUICtrlCreateTabItem("")
;
GUISetState();==;Gui end
;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;
While 1 ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<  loop here!
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _Exit()
                        ;==;
        Case $install_but_3
            _Install1()
            ;==;
        Case $install_but_4
            _Install2()
            ;==;
    EndSwitch
WEnd

Func _Install1()
    MsgBox(4096, "avg32", "test")
EndFunc   ;==>_Install1

Func _Install2()
    MsgBox(4096, "avg64", "test")
EndFunc   ;==>_Install2

;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;    ;==;

Func _Exit()
    GUIDelete()
EndFunc   ;==>_Exit

As you are obviously very new to scripting (and we all started at that point :D ) have you read the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References)? This will help you enormously to get an idea of how AutoIt scripts are structured. You should also look at the excellent tutorials that you will find here and here.

Given the problems you are having with such fundamental concepts as functions and the idle loop, I feel that it would be time well spent. :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks for the assistance M23 you are definatly a very helpfull person

I actually wasnt aware i had an idle loop in the script

As for the helpfile god ive spent hours reading the damn thing

And the learning to script tut i have printed and i read at night

Its not i dont read or try, i think with me some of the concepts are to highbrow for me to grasp, im beginning to see little bits here and there that sort of make sense

Ive not spent a lifetime writing code, i only came to CMD a year ago and at best i copy and paste from google and write my stuff to bring it together.

Im trying :graduated:

Chimaera

Edited by Chimaera
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...