Sign in to follow this  
Followers 0
GodForsakenSoul

learning gui

12 posts in this topic

my attempts to learn some autoit has led me to find the GUI section of the help file.

so now, instead of making one script, i'm going to learn to make a few buttons that execute different scripts.

so far i understand two basic things:

1) every button has an ID number, which i can't figure out how to set or make use of (the help file is somewhat confusing, but i'm overcoming the confusion).

2) when i make a window, i individually write what size i want everything to be and where.

Posted Image

the red dots are the coordinates of the stuff i set and the blue things are the size of whatever i set the coordinates for.

i can set size of text window and the window in which all the action happents, but i can not set the size of the buttons.

the point of the thread: two requests: 1) confirm the theory i purposed explaining basic thing #2. am i right or not?

2) explain to me how to make use of the ID of the button explained in basic thing #1.

all help and making things clear on the subject of GUIs is very welcome in general. :)

Share this post


Link to post
Share on other sites



If you want an easy way to make GUI's then I suggest that you use Koda. If you have downloaded the full version of SciTe then you will find it "C:\Program Files\AutoIt3\SciTE\Koda".



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

eh... i tried that koda thing when i posted a little less detailed thread on the topic. it's more confusing.

i prefer the old (?) way of typing everything like

GuiCreateWhatever

myself. that way i have more control and i actually understand what i'm doing. it worked when i did something similar in actool quite well and i don't want to screw with what i see as perfection.

also, right now i have about 50 more questions, but i have to go. be back in like half an hour and then the first post will get a massive update of more questions.

Share this post


Link to post
Share on other sites

If you want an easy way to make GUI's then I suggest that you use Koda. If you have downloaded the full version of SciTe then you will find it "C:\Program Files\AutoIt3\SciTE\Koda".

scite? koda?

i'm more of a notepad kinda guy personally.

Share this post


Link to post
Share on other sites

Welcome to Autoit is a tut for beginers, give it a look

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Here is a GUI for you which approximates your drawing and I've included some explanations.

#include <GUIConstantsEx.au3>
;; Greate the main form with a size of 300 wide by 450
;;Where "My Test GUI" is the title bar text, 300 = Width and 450 = Height
$Frm_Main = GUICreate("MyTest Form", 300, 450)
;; Create an edit control and set the initial data
;; Where 10 = left start point, 10 = top start, 280 = width, 380 = height
$Edit = GUICtrlCreateEdit("This is some text", 10, 10, 280, 380)
;; Create a button where 120 = Left stqrt, 410 = top start &etc
$Btn = GUICtrlCreateButton("Button", 120, 410, 60, 30)
GUISetState();; Display the GUI
While 1;; Keep it open until an exit event occurs
   $Msg = GUIGetMsg();; declare a variable for the GUIGetMsg just for simplicity.
   Switch $Msg
      Case $Btn
         If GUICtrlRead($Edit) = "" Then;; If there is no text in the edit control
            GUICtrlSetData($Edit, "The identifier for the edit control is>> " & $Edit & @CRLF & "The identifier for the button is>> " & $Btn)
         Else;; Remove the existing text
            GuiCtrlSetData($Edit, "")
         EndIf
      Case $GUI_EVENT_CLOSE;; Close message from the GUI (-3 could be used here instead eliminating the need for the #include <GUIConstantsEx.au3> line
         Exit
   EndSwitch
Wend

Save it in a new au3 file, run it and click the button 3 or 4 times.

Edit: Error in comment

Edited by GEOSoft

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

A fully commented script just looks more confusing to me...

._.

http://www.autoitscript.com/forum/index.php?showtopic=21048

:)

I could have put in pretty colors for you(Crayola code) but that's confusing for me to read. That makes it you vs me and guess what? I win!!

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

Just for @info ( so he can understand it) here is the same code without the comments and without the #includeed file.

$Frm_Main = GUICreate("MyTest Form", 300, 450)
$Edit = GUICtrlCreateEdit("This is some text", 10, 10, 280, 380)
$Btn = GUICtrlCreateButton("Button", 120, 410, 60, 30)
GUISetState()
While 1
   $Msg = GUIGetMsg()
   Switch $Msg
      Case $Btn
         If GUICtrlRead($Edit) = "" Then
            GUICtrlSetData($Edit, "The identifier for the edit control is " & $Edit & @CRLF & "The identifier for the button is " & $Btn)
         Else
            GuiCtrlSetData($Edit, "")
         EndIf
      Case -3
         Exit
   EndSwitch
Wend

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

._.

Share this post


Link to post
Share on other sites

scite? koda?

i'm more of a notepad kinda guy personally.

Are you serious? Scite is the most useful tool I use for AutoIt. Koda is also extremely nice. Using notepad is unefficient compared to using scite because with scite you can spot errors with much more ease. My advice: try using Scite for a while.

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Are you serious? Scite is the most useful tool I use for AutoIt. Koda is also extremely nice. Using notepad is unefficient compared to using scite because with scite you can spot errors with much more ease. My advice: try using Scite for a while.

yeah i have always been a notepad kind of guy. i don't even like textpad. i could never get into scite, all of those colors going on, it was madness. The only errors i really make are usually very easy to find for me if i have the syntax right. in most cases if i have an error it is just the syntax. like if i use a function i have never used before, i might leave one of paramaters out, but that doesn't happen much. notepad > textpad > scite

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