Sign in to follow this  
Followers 0
Axufuris

Need Help!

3 posts in this topic

I am working on my first Autoit program and i need some real help. For some reason i can get it to start up... But i can not get any of my buttons to work. I click on the buttons and nothing is happening.

$mainwindow = GUICreate("My Mining Program", 255, 215)
;GUISetOnEvent($GUI_EVENT_CLOSE, 1)
GUISetState(@SW_SHOW)


;Number of Lasers
$MyGUI_LasersLabel = GUICtrlCreateLabel("Num of Lasers", 38, 49)
$MyGUI_LasersInput = GUICtrlCreateinput("2", 118, 46, 42, 20)

;Sec to Reset Lasers
$MyGUI_LaserTimeLabel = GUICtrlCreateLabel("Sec to Reset Lasers", 9, 80)
$MyGUI_LaserTimeInput = GUICtrlCreateInput("60", 118, 77, 42, 20)

;# of Asteroid Belts
$MyGUI_NumBeltsLabel = GUICtrlCreateLabel("# of Asteroid Belts", 19, 109)
$MyGUI_NumBeltsInput = GUICtrlCreateInput("1", 118, 108, 42, 20)

;Start Button
$MyGUI_StartButton = GUICtrlCreatebutton("Start", 12, 12, 75, 23)
;GUISetOnEvent($MyGUI_StartButton, "CheckGUI")


;Pause Button
$MyGUI_PauseButton = GUICtrlCreatebutton("Pause", 90, 12, 75, 23)
;GUISetOnEvent($MyGUI_PauseButton, "CheckGUI")

;Exit Button
$MyGUI_ExitButton = GUICtrlCreatebutton("Exit", 168, 12, 75, 23)
;GUISetOnEvent($MyGUI_ExitButton, "CheckGUI")

;Stop Button
$MyGUI_StopButton = GUICtrlCreatebutton("Stop", 168, 49, 75, 23)
;GUISetOnEvent($MyGUI_StartButton, "CheckGUI")

; Copyright....
GUISetFont (8, 400, 0, "Arial", $mainwindow)
;GUICtrlCreateLabel(" Copyright (c) 2008 All rights reserved.", 5, 183, 190, 12) 

;Status Line
$MyGUI_StatusLine = GUICtrlCreateLabel("", 0, 180, 200, 18)

; Tooltips
GUICtrlSetTip($MyGUI_LasersLabel, "Number of Lasers your ship has." )



MainLoop()

;Func CheckGUI()

;EndFunc



Func MainLoop()


While 1
        
    $GUIStatus = GUIGetMsg()
    
    Select
    Case $GUIStatus = $GUI_EVENT_CLOSE
        CloseClicked()
    Case $GUIStatus = $MyGUI_ExitButton
        CloseClicked()
            
    Case $GUIStatus = $MyGUI_StartButton
      ;WinWait("EVE")
      ;WinActivate("EVE")
      ;WinWaitActive("EVE")
      ;WinMove("EVE", "", 0, 0)
      ;Sleep(1000) 
      ;$size = WinGetClientSize("EVE")
       $clientWidth = $size[0]
       $clientHeight = $size[1]
       $MyBot_Running = 1
       $BotTimer = TimerInit()
       SetStatus(1)
   Case $GUIStatus = $MyGUI_PauseButton
       TogglePause()
       
   Case $GUIStatus = $MyGUI_StopButton     
      $MyBot_Running = 0
       SetStatus(0)
       PrintStatus("Stopped...")
       Sleep(500)
    EndSelect
    
WEnd



  PrintStatus("Initilizing...")
  Sleep(100)
  While 1
    If $MyBot_Running = 0 Then
      SetStatus(0)
    EndIf
    DoStatus()
  WEnd
EndFunc

Share this post


Link to post
Share on other sites



After removing all your OnEvent comments, and Commenting out all the Functions that you did not provide to replace them with msgboxes, along with including the necessary include files, it worked for me....

#include <GuiConstantsEx.au3>

$mainwindow = GUICreate("My Mining Program", 255, 215)
$MyGUI_LasersLabel = GUICtrlCreateLabel("Num of Lasers", 38, 49)
$MyGUI_LasersInput = GUICtrlCreateInput("2", 118, 46, 42, 20)
$MyGUI_LaserTimeLabel = GUICtrlCreateLabel("Sec to Reset Lasers", 9, 80)
$MyGUI_LaserTimeInput = GUICtrlCreateInput("60", 118, 77, 42, 20)
$MyGUI_NumBeltsLabel = GUICtrlCreateLabel("# of Asteroid Belts", 19, 109)
$MyGUI_NumBeltsInput = GUICtrlCreateInput("1", 118, 108, 42, 20)
$MyGUI_StartButton = GUICtrlCreateButton("Start", 12, 12, 75, 23)
$MyGUI_PauseButton = GUICtrlCreateButton("Pause", 90, 12, 75, 23)
$MyGUI_ExitButton = GUICtrlCreateButton("Exit", 168, 12, 75, 23)
$MyGUI_StopButton = GUICtrlCreateButton("Stop", 168, 49, 75, 23)
GUISetFont(8, 400, 0, "Arial", $mainwindow)
$MyGUI_StatusLine = GUICtrlCreateLabel("", 0, 180, 200, 18)
GUICtrlSetTip($MyGUI_LasersLabel, "Number of Lasers your ship has.")
GUISetState(@SW_SHOW)

MainLoop()

Func MainLoop()
    While 1
        $GUIStatus = GUIGetMsg()
        Switch $GUIStatus
            Case $GUI_EVENT_CLOSE, $MyGUI_ExitButton
                MsgBox(0, "", "Close")
                ;CloseClicked()
            Case $MyGUI_StartButton
                MsgBox(0, "", "StartButton")
                ;WinWait("EVE")
                ;WinActivate("EVE")
                ;WinWaitActive("EVE")
                ;WinMove("EVE", "", 0, 0)
                ;Sleep(1000)
                ;$size = WinGetClientSize("EVE")
                $clientWidth = 0;$size[0]
                $clientHeight = 0;$size[1]
                $MyBot_Running = 1
                $BotTimer = TimerInit()
                ;SetStatus(1)
            Case $MyGUI_PauseButton
                ;TogglePause()
                MsgBox(0, "", "PauseButton")
            Case $MyGUI_StopButton
                MsgBox(0, "", "StopButton")
                $MyBot_Running = 0
                ; SetStatus(0)
                ;PrintStatus("Stopped...")
                Sleep(500)
        EndSwitch
    WEnd
    ; PrintStatus("Initilizing...")
    Sleep(100)
    While 1
        If $MyBot_Running = 0 Then
            ;  SetStatus(0)
        EndIf
        ;  DoStatus()
    WEnd
EndFunc   ;==>MainLoop

Share this post


Link to post
Share on other sites

Thas weird because i pluged it in place of my code and wouldn't work. But when i put it in its own file it worked great.

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