Sign in to follow this  
Followers 0
Hemuftw

A few questions.

7 posts in this topic

#1 ·  Posted (edited)

Hello guys, i've recently decided to learn autoIT, moving on from VB.net it's looking very dificult to me, VB seemed much easier so i'm gonna have to ask some very simple questions and hope some body got time to answer em :)

Q1: If I have this code:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Form1", 224, 132, 219, 166)
$Button1 = GUICtrlCreateButton("Button1", 16, 104, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Button2", 136, 104, 75, 25, 0)
$Edit1 = GUICtrlCreateEdit("", 16, 8, 185, 89)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Form1
    EndSwitch
WEnd

Where exactly do I put the event for Button1 Clicked?

Q2: Is there any E-Books on AutoIT, except from the included help file and examples ofcourse.

That will be all for now, thanks in advance.

Edited by Hemuftw

Share this post


Link to post
Share on other sites



Hello guys, i've recently decided to learn autoIT, moving on from VB.net it's looking very dificult to me, VB seemed much easier so i'm gonna have to ask some very simple questions and hope some body got time to answer em :)

Q1: If I have this code:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Form1", 224, 132, 219, 166)
$Button1 = GUICtrlCreateButton("Button1", 16, 104, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Button2", 136, 104, 75, 25, 0)
$Edit1 = GUICtrlCreateEdit("", 16, 8, 185, 89)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Form1
    EndSwitch
WEnd

Where exactly do I put the event for Button1 Clicked?

Q2: Is there any E-Books on AutoIT, except from the included help file and examples ofcourse.

That will be all for now, thanks in advance.

Welcome to the AutoIt Forum!

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Form1", 224, 132, 219, 166)
$Button1 = GUICtrlCreateButton("Button1", 16, 104, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Button2", 136, 104, 75, 25, 0)
$Edit1 = GUICtrlCreateEdit("", 16, 8, 185, 89)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            MsgBox(0,"BUTTON1","PRESSED")
        Case $Button2
            MsgBox(0,"BUTTON2","PRESSED")
    EndSwitch
    Sleep(20)
WEnd

To learn AutoIt check this:

http://www.autoitscript.com/forum/index.ph...st&p=145357

http://www.autoitscript.com/forum/index.ph...st&p=609033


When the words fail... music speaks

Share this post


Link to post
Share on other sites

Welcome to the AutoIt Forum!

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Form1", 224, 132, 219, 166)
$Button1 = GUICtrlCreateButton("Button1", 16, 104, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Button2", 136, 104, 75, 25, 0)
$Edit1 = GUICtrlCreateEdit("", 16, 8, 185, 89)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            MsgBox(0,"BUTTON1","PRESSED")
        Case $Button2
            MsgBox(0,"BUTTON2","PRESSED")
    EndSwitch
    Sleep(20)
WEnd

To learn AutoIt check this:

http://www.autoitscript.com/forum/index.ph...st&p=145357

http://www.autoitscript.com/forum/index.ph...st&p=609033

Thanks. Seems to make sense, could you please make an example where Button1 opens Iexplorer, so I know exactly where the event needs to be?

Case = IF?

Also, is the MsgBox lines required?

I will start reading those guides now.

Thank you very much for your help.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Form1", 224, 132, 219, 166)
$Button1 = GUICtrlCreateButton("Button1", 16, 104, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Button2", 136, 104, 75, 25, 0)
$Edit1 = GUICtrlCreateEdit("", 16, 8, 185, 89)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ShellExecute("http://www.autoitscript.com/forum")
        Case $Button2
            Run("iexplore.exe")
    EndSwitch
    Sleep(20)
WEnd

Button 1 will open autoitscript forum in your default browser, while button 2 will just launch internet explorer.

Edit: Forgot code tags.

Edited by TehWhale

Share this post


Link to post
Share on other sites

Thanks. Seems to make sense, could you please make an example where Button1 opens Iexplorer, so I know exactly where the event needs to be?

Case = IF?

Also, is the MsgBox lines required?

I will start reading those guides now.

Thank you very much for your help.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Form1", 224, 132, 219, 166)
$Button1 = GUICtrlCreateButton("Button1", 16, 104, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Button2", 136, 104, 75, 25, 0)
$Edit1 = GUICtrlCreateEdit("", 16, 8, 185, 89)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ShellExecute("http://www.google.com")
        Case $Button2
            Run("calc",@SystemDir)
    EndSwitch
    Sleep(20)
WEnd

Case is a part of Select/Switch statements and from help

If the expression is true the following statements up to the next Case or EndSelect statement are executed. If more than one of the Case statements are true, only the first one is executed.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Form1", 224, 132, 219, 166)
$Button1 = GUICtrlCreateButton("Button1", 16, 104, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Button2", 136, 104, 75, 25, 0)
$Edit1 = GUICtrlCreateEdit("", 16, 8, 185, 89)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ShellExecute("http://www.autoitscript.com/forum")
        Case $Button2
            Run("iexplore.exe")
    EndSwitch
    Sleep(20)
WEnd

Button 1 will open autoitscript forum in your default browser, while button 2 will just launch internet explorer.

Edit: Forgot code tags.

Ahhhh <3

ShellExecute, hehe same as VB,

And Run, starting look very simple heh.

Thanks guys, that is all, now I must read a big PDF on AutoIT :)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Ahhhh <3

ShellExecute, hehe same as VB,

And Run, starting look very simple heh.

Thanks guys, that is all, now I must read a big PDF on AutoIT :)

The PDF may be big but it will help you out a lot. Use it in conjunction with the helpfile and you'll be set! Edited by TehWhale

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