Jump to content

Label Problem


Encryption
 Share

Recommended Posts

#include <GUIConstants.au3>

GUICreate("My GUI") ; will create a dialog box that when displayed is centered



$cell = ""
$cell2 = " this works"
GUICtrlCreateLabel ($cell,  10, 30) 
GUICtrlCreateLabel ($cell2,  40, 30) 
GUISetState ()   ; will display an empty dialog box

; Run the GUI until the dialog is closed
Do
    $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE

8)

NEWHeader1.png

Link to comment
Share on other sites

;Testing Functions
ClientInfo("EasyBot Test", "mason", "b4sketcase@gmail.com")
InitBot()

;Client Info Variables and Client Info Function
$botName = " "
$author = " "
$email = " "
Func ClientInfo($NAMEOFBOT, $CREATOR, $EMAILADDRESS)
    $botName = $NAMEOFBOT
    $author = $CREATOR
    $email = $EMAILADDRESS
EndFunc

;GUI On Start Creation with Script Info
Func InitBot()
    GuiCreate("EasyBot v1.0", 402, 181,(@DesktopWidth-402)/2, (@DesktopHeight-181)/2)
    
    $Button_Start = GuiCtrlCreateButton("Start", 80, 140, 90, 30)
    $Button_Exit = GuiCtrlCreateButton("Exit", 230, 140, 90, 30)
    $Label_1 = GuiCtrlCreateLabel("EasyBot v1.0", 165, 10, 70, 20)
    $Label_2 = GUICtrlCreateLabel("By Mason", 175, 25)
    $Label_3 = GUICtrlCreateLabel("Script Info", 175, 50)
    $Label_4 = GUICtrlCreateLabel("Bot Name:", 140, 70)
    $Label_5 = GUICtrlCreateLabel("Author:", 155, 85)
    $Label_6 = GUICtrlCreateLabel("Author's Email:", 120, 100)
    $Label_7 = GUICtrlCreateLabel($botName, 170, 70)
    
    GuiSetState()
    
    While 1
        $msg = GuiGetMsg()
        Select
            
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $Button_Exit
                Exit
            Case $msg = $Button_Start
                ExitLoop
        EndSelect
    WEnd
EndFunc

Explain whats wrong?

Link to comment
Share on other sites

;Testing Functions
ClientInfo("EasyBot Test", "mason", "b4sketcase@gmail.com")
InitBot()

;Client Info Variables and Client Info Function
$botName = " "
$author = " "
$email = " "
Func ClientInfo($NAMEOFBOT, $CREATOR, $EMAILADDRESS)
    $botName = $NAMEOFBOT
    $author = $CREATOR
    $email = $EMAILADDRESS
EndFunc

;GUI On Start Creation with Script Info
Func InitBot()
    GuiCreate("EasyBot v1.0", 402, 181,(@DesktopWidth-402)/2, (@DesktopHeight-181)/2)
    
    $Button_Start = GuiCtrlCreateButton("Start", 80, 140, 90, 30)
    $Button_Exit = GuiCtrlCreateButton("Exit", 230, 140, 90, 30)
    $Label_1 = GuiCtrlCreateLabel("EasyBot v1.0", 165, 10, 70, 20)
    $Label_2 = GUICtrlCreateLabel("By Mason", 175, 25)
    $Label_3 = GUICtrlCreateLabel("Script Info", 175, 50)
    $Label_4 = GUICtrlCreateLabel("Bot Name:", 140, 70)
    $Label_5 = GUICtrlCreateLabel("Author:", 155, 85)
    $Label_6 = GUICtrlCreateLabel("Author's Email:", 120, 100)
    $Label_7 = GUICtrlCreateLabel($botName, 170, 70)
    
    GuiSetState()
    
    While 1
        $msg = GuiGetMsg()
        Select
            
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $Button_Exit
                Exit
            Case $msg = $Button_Start
                ExitLoop
        EndSelect
    WEnd
EndFunc

Explain whats wrong?

Func ClientInfo($NAMEOFBOT, $CREATOR, $EMAILADDRESS)
    $botName = $NAMEOFBOT
    $author = $CREATOR
    $email = $EMAILADDRESS
EndFunc

you aren't returning anything from the function (the variables are local to the function and dont escape the function unless they are Global or you use Return )

[u]Do more with pre-existing apps![/u]ANYGUIv2.8
Link to comment
Share on other sites

This works

#include <GuiConstants.au3>
;Testing Functions
;ClientInfo("EasyBot Test", "mason", "b4sketcase@gmail.com")
InitBot()

;Client Info Variables and Client Info Function
Dim $botName = " "
Dim $author = " "
Dim $email = " "

Func ClientInfo($NAMEOFBOT, $CREATOR, $EMAILADDRESS)
    $botName = $NAMEOFBOT
    $author = $CREATOR
    $email = $EMAILADDRESS
EndFunc

;GUI On Start Creation with Script Info
Func InitBot()
    
    Dim $botName = ""
    GuiCreate("EasyBot v1.0", 402, 181,(@DesktopWidth-402)/2, (@DesktopHeight-181)/2)
    
    $Button_Start = GuiCtrlCreateButton("Start", 80, 140, 90, 30)
    $Button_Exit = GuiCtrlCreateButton("Exit", 230, 140, 90, 30)
    $Label_1 = GuiCtrlCreateLabel("EasyBot v1.0", 165, 10, 70, 20)
    $Label_2 = GUICtrlCreateLabel("By Mason", 175, 25)
    $Label_3 = GUICtrlCreateLabel("Script Info", 175, 50)
    $Label_4 = GUICtrlCreateLabel("Bot Name:", 140, 70)
    $Label_5 = GUICtrlCreateLabel("Author:", 155, 85)
    $Label_6 = GUICtrlCreateLabel("Author's Email:", 120, 100)
    $Label_7 = GUICtrlCreateLabel($botName, 170, 70)
    
    GuiSetState()
    
    While 1
        $msg = GuiGetMsg()
        Select
            
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $Button_Exit
                Exit
            Case $msg = $Button_Start
                ExitLoop
        EndSelect
    WEnd
EndFunc

8)

NEWHeader1.png

Link to comment
Share on other sites

$ClientInfo = ClientInfo("EasyBot Test", "mason", "b4sketcase@gmail.com")
InitBot()

Func ClientInfo($botname, $author, $email)
    Dim $Info[3]
    $Info[0] = $botname
    $Info[1] = $author
    $Info[2] = $email
    Return $Info
EndFunc

;GUI On Start Creation with Script Info
Func InitBot()
    GuiCreate("EasyBot v1.0", 402, 181,(@DesktopWidth-402)/2, (@DesktopHeight-181)/2)
    
    $Button_Start = GuiCtrlCreateButton("Start", 80, 140, 90, 30)
    $Button_Exit = GuiCtrlCreateButton("Exit", 230, 140, 90, 30)
    $Label_1 = GuiCtrlCreateLabel("EasyBot v1.0", 165, 10, 70, 20)
    $Label_2 = GUICtrlCreateLabel("By Mason", 175, 25)
    $Label_3 = GUICtrlCreateLabel("Script Info", 175, 50)
    $Label_4 = GUICtrlCreateLabel("Bot Name:", 140, 70)
    $Label_5 = GUICtrlCreateLabel("Author:", 155, 85)
    $Label_6 = GUICtrlCreateLabel("Author's Email:", 120, 100)
    $Label_7 = GUICtrlCreateLabel($ClientInfo[0], 170, 70)
    
    GuiSetState()
    
    While 1
        $msg = GuiGetMsg()
        Select
            
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $Button_Exit
                Exit
            Case $msg = $Button_Start
                ExitLoop
        EndSelect
    WEnd
EndFunc

There we are...fixed it up. Being stupid as usual...after being away from AutoIt for so long, it seems that C++ is so much more simple. ;)

Link to comment
Share on other sites

$ClientInfo = ClientInfo("EasyBot Test", "mason", "b4sketcase@gmail.com")
InitBot()

Func ClientInfo($botname, $author, $email)
    Dim $Info[3]
    $Info[0] = $botname
    $Info[1] = $author
    $Info[2] = $email
    Return $Info
EndFunc

;GUI On Start Creation with Script Info
Func InitBot()
    GuiCreate("EasyBot v1.0", 402, 181,(@DesktopWidth-402)/2, (@DesktopHeight-181)/2)
    
    $Button_Start = GuiCtrlCreateButton("Start", 80, 140, 90, 30)
    $Button_Exit = GuiCtrlCreateButton("Exit", 230, 140, 90, 30)
    $Label_1 = GuiCtrlCreateLabel("EasyBot v1.0", 165, 10, 70, 20)
    $Label_2 = GUICtrlCreateLabel("By Mason", 175, 25)
    $Label_3 = GUICtrlCreateLabel("Script Info", 175, 50)
    $Label_4 = GUICtrlCreateLabel("Bot Name:", 140, 70)
    $Label_5 = GUICtrlCreateLabel("Author:", 155, 85)
    $Label_6 = GUICtrlCreateLabel("Author's Email:", 120, 100)
    $Label_7 = GUICtrlCreateLabel($ClientInfo[0], 170, 70)
    
    GuiSetState()
    
    While 1
        $msg = GuiGetMsg()
        Select
            
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $Button_Exit
                Exit
            Case $msg = $Button_Start
                ExitLoop
        EndSelect
    WEnd
EndFunc

There we are...fixed it up. Being stupid as usual...after being away from AutoIt for so long, it seems that C++ is so much more simple. ;)

Are the arrays in both these lines supposed to be the same name?

Line 5 ------------------------------------------- $Info[0] = $botname
Line 23 -----  $Label_7 = GUICtrlCreateLabel($ClientInfo[0], 170, 70)

If they're not, where does $ClientInfo[0] get initialized?

Edited by Gene

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Link to comment
Share on other sites

maby @ the top ?

$ClientInfo = ClientInfo("EasyBot Test", "mason", "b4sketcase@gmail.com")
Yes, at the top, I must have been looking too hard. :">

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

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...