Jump to content

Button not respond


Wath
 Share

Recommended Posts

Hi All!

Someone could help why is the Save() func not starting?

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
Global $exe_x, $exe_y, $eve_user, $eve_pass, $mouse_x, $mouse_y, $save_eve, $bot,$button1, $buttonclose, $pos[2]
    Opt('MustDeclareVars', 1)
    
        ;Gui start
        $bot = GUICreate("Eve starter", 400, 400)
        $button1 = GUICtrlCreateButton("1", 0, 360, 40, 40, $BS_ICON)
        GUICtrlSetImage(-1, "shell32.dll", 246)
        $buttonclose = GUICtrlCreateButton("close", 360, 360, 40, 40, $BS_ICON)
        GUICtrlSetImage(-1, "shell32.dll", 28)
        GUISetState()
        
        GUICtrlCreateGroup("EVE", 10, 5, 200, 140)
        GUICtrlCreateLabel("EVE koord.:", 15, 35)
        
        GUICtrlCreateLabel("X:", 90, 15)
        $exe_x = GUICtrlCreateInput('',75,30, 40, 20)
        
        GUICtrlCreateLabel("Y:", 150, 15)
        $exe_y = GUICtrlCreateInput('',135,30, 40, 20)
        
        GUICtrlCreateLabel("EVE user.:", 15, 60)
        $eve_user = GUICtrlCreateInput('',75,60, 100, 20)
        
        GUICtrlCreateLabel("EVE pass.:", 15, 90)
        $eve_pass = GUICtrlCreateInput('',75,90, 100, 20)
        
        $save_eve = GUICtrlCreateButton("Ment", 70, 115, 40)
        GUICtrlSetOnEvent($save_eve, "Save")
        GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group
        
        GUICtrlCreateLabel("Egér koord.:", 300, 5)
        GUICtrlCreateLabel("X:", 300, 20)
        GUICtrlCreateLabel("Y:", 350, 20)
        $mouse_x = GUICtrlCreateInput($pos[0], 275, 35, 40, 20)
        $mouse_y = GUICtrlCreateInput($pos[1], 335, 35, 40, 20)
        GUISetState(@SW_SHOW, $bot)
        
        
        While 1
            $pos = MouseGetPos()
            GUICtrlSetData($mouse_x, $pos[0])
            GUICtrlSetData($mouse_y, $pos[1])
            Sleep(10)
            Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $button1
                ;
            Case $buttonclose
                ExitLoop
            Case Else
            EndSwitch
        WEnd
    
Func Save()
    $SettingsFile = @SCRIPTDIR & '\Settings.ini'
    iniWrite ( $SettingsFile, 'EVE.exe', 'x', $exe_x )
    iniWrite ( $SettingsFile, 'EVE.exe', 'y', $exe_y )
    iniWrite ( $SettingsFile, 'EVE', 'user', $eve_user )
    iniWrite ( $SettingsFile, 'EVE', 'pass', $eve_pass )
EndFunc
Link to comment
Share on other sites

I wonder if it's to do with your Save button being "OnEvent" but your script is running in "Message" mode?

Ah that was it! :)

Sry I have just started to learn AutoIt and sometimes i'm lost.

Now it's properly working.

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