Sign in to follow this  
Followers 0
Gunner

Making my first GUI, lost.

10 posts in this topic

Hi all.

I created a script I really enjoy using, but everytime I want it to repeat a function less or more times I have to go in and edit the Do...Untill part, which is a pain. I'd like to create a GUI where I can control what it does and how many times easier. It does neet to be anything fancy just a simple GUI which will allow me to do one of 10 different (but near identical) functions, all 10 or any number of those functions (wheather it be Function A, or A & B, or A & C & I).

Function A [Check Box] [Times to do Function A]

Function B [Check Box] [Times to do Function B]

Function C [Check Box] [Times to do Function C]

Function D [Check Box] [Times to do Function D]

Function E [Check Box] [Times to do Function E]

Function F [Check Box] [Times to do Function F]

Function G [Check Box] [Times to do Function G]

Function H [Check Box] [Times to do Function H]

Function I [Check Box] [Times to do Function I]

Function J [Check Box] [Times to do Function J]

[start Button]

My problem is even with reading the Help File I am completely lost as to where to start on this. If needed I can provide the script I am using right now, but more then anythign I just need a list of functions to read up on in the help file.

Thanks.

Share this post


Link to post
Share on other sites



Gunner,

Good for you that you only want some hints at this stage - makes a change.... ;-)

First create a GUI by using GUICreate and GUISetState.

In between those 2 statements you will need several GUICtrlCreateLabel's (for the "Function x" part), GUICtrlCreateCheckBox's (to show that the function is to run) and GUICtrlCreateInput's (for the number of times) - although you could preset the inputs to 0 and then omit the checkboxes because you would only run the function if a positive number is set.

Then you will need a GUICtrlCreateButton to press when all is ready.

After creating the GUI you will need a While...WEnd loop to wait until the button is pressed. To detect that you will need to poll GUIGetMsg within the loop.

Read up on that lot in the Help file and run the examples for each command in SciTE - try changing some of the parameters to see what happens. Have a go at coding something yourself and come back if you have problems.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

A great way to build and "design" the look of a GUI is to use Koda.

In SciTe press > Tools > Koda form designer

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Ok I have the visual look of it down, now I just need to make it work, the acctual front end was easy to make once I had the right areas to look in, thank you Melba23.

Couple of problems,

First off the top corner X (to close it) doesn't work, but I figure that is because somewhere I didn't put in the needed script.

Second, accutally making it do what I need it to do.

GUICreate("GUI Test", 200, 350)
$checkCN = GUICtrlCreateCheckbox("Function 1", 10, 10, 120, 20)
; INPUT
GuiCtrlCreateInput("", 135, 10, 50, 20)
$checkCN = GUICtrlCreateCheckbox("Function 2", 10, 40, 120, 20)
; INPUT
GuiCtrlCreateInput("", 135, 40, 50, 20)
$checkCN = GUICtrlCreateCheckbox("Function 3", 10, 70, 120, 20)
; INPUT
GuiCtrlCreateInput("", 135, 70, 50, 20)
$checkCN = GUICtrlCreateCheckbox("Function 4", 10, 100, 120, 20)
; INPUT
GuiCtrlCreateInput("", 135, 100, 50, 20)
$checkCN = GUICtrlCreateCheckbox("Function 5", 10, 130, 120, 20)
; INPUT
GuiCtrlCreateInput("", 135, 130, 50, 20)
$checkCN = GUICtrlCreateCheckbox("Function 6", 10, 160, 120, 20)
; INPUT
GuiCtrlCreateInput("", 135, 160, 50, 20)
$checkCN = GUICtrlCreateCheckbox("Function 7", 10, 190, 120, 20)
; INPUT
GuiCtrlCreateInput("", 135, 190, 50, 20)
$checkCN = GUICtrlCreateCheckbox("Function 8", 10, 220, 120, 20)
; INPUT
GuiCtrlCreateInput("", 135, 220, 50, 20)
$checkCN = GUICtrlCreateCheckbox("Function 9", 10, 250, 120, 20)
; INPUT
GuiCtrlCreateInput("", 135, 250, 50, 20)
$checkCN = GUICtrlCreateCheckbox("Function 10", 10, 280, 120, 20)
; INPUT
GuiCtrlCreateInput("", 135, 280, 50, 20)
GUICtrlCreateButton ( "Run", 10, 325, 100, 20)
GUISetState(@SW_SHOW)
Sleep(50000)

That is what I have so far. Once agian i just need some hintas and ideas where to look, I won't learn other wise.

Edited by Gunner

Share this post


Link to post
Share on other sites

Gunner,

You missed reading the last part of my post:

After creating the GUI you will need a While...WEnd loop to wait until the button is pressed. To detect that you will need to poll GUIGetMsg within the loop.

Look at Switch...Case...EndSwitch to see how you can have different code for the different controls.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Gunner,

You missed reading the last part of my post:

Look at Switch...Case...EndSwitch to see how you can have different code for the different controls.

M23

M23 - Thanks I did miss that, i got that closing part fixed now. It's all trial and error.

Share this post


Link to post
Share on other sites

Gunner,

It's all trial and error

That is how you learn best! Just blindly copying someone else's code is not the way - but, as you can see around here on most days, some people will just not be told...

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Only SOME ?? Try Far To Many.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

PM'd me

You will probably be more lost with this

#include <GUIConstantsEx.au3>

Global $checkCN[11], $Input[11]

$GUI = GUICreate("GUI Test", 200, 350)
$top = 10

For $x = 1 To UBound($Input) - 1
    $checkCN[$x] = GUICtrlCreateCheckbox("Function " & $x, 10, $top, 120, 20)
    $Input[$x] = GUICtrlCreateInput("", 135, $top, 50, 20)
    $top += 30
Next

$Button = GUICtrlCreateButton("Run", 10, 325, 100, 20)
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case - 3
            Exit
        Case $Button
            For $x = 1 To UBound($Input) - 1
                If _IsChecked($checkCN[$x]) Then
                    Runner(GUICtrlRead($Input[$x]))
                EndIf
            Next

    EndSwitch
WEnd

Func Runner($Num)
    ; do your thing here....

    MsgBox(4096, "Test", $Num, 5)
EndFunc   ;==>Runner

Func _IsChecked($control)
    Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

PM'd me

You will probably be more lost with this

#include <GUIConstantsEx.au3>

Global $checkCN[11], $Input[11]

$GUI = GUICreate("GUI Test", 200, 350)
$top = 10

For $x = 1 To UBound($Input) - 1
    $checkCN[$x] = GUICtrlCreateCheckbox("Function " & $x, 10, $top, 120, 20)
    $Input[$x] = GUICtrlCreateInput("", 135, $top, 50, 20)
    $top += 30
Next

$Button = GUICtrlCreateButton("Run", 10, 325, 100, 20)
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case - 3
            Exit
        Case $Button
            For $x = 1 To UBound($Input) - 1
                If _IsChecked($checkCN[$x]) Then
                    Runner(GUICtrlRead($Input[$x]))
                EndIf
            Next

    EndSwitch
WEnd

Func Runner($Num)
    ; do your thing here....

    MsgBox(4096, "Test", $Num, 5)
EndFunc   ;==>Runner

Func _IsChecked($control)
    Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked

8)

Your right that did confuse me more, but I never wanted code, just where to look in the help files :)

Ok what I want my Script to do is ustomate a mindnumbing part of a website I play on.

The functions are different 'vending machines' on the website. All give out different items. What I want to do is make it so if I have Check boxes 1, 3, 10 checked it does the following.

1] Open the vending page for Check box 1 in my browser.

2] Vends as many times as is specified in the input field.

3 Repeat this with any other check boxes.

Right now the script I have doing this is a do until based one, but everytime I want to vend a different about. Say 15 at 1, 25 at another, I have to open the script and reedit it , which frankly annoys me. Plus I want to learn more about using AutoIT so i decided to make it into a GUI.

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