Jump to content
Sign in to follow this  
liten

Exit Button.

Recommended Posts

liten

Well, i have finished my script and i have all the higher challenged things down but the one thing i cant do is make an exit button, how, it earks me i can make a complete script but no Exit button,

Please Help.


My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

Share this post


Link to post
Share on other sites
TESTTH

Well, i have finished my script and i have all the higher challenged things down but the one thing i cant do is make an exit button, how, it earks me i can make a complete script but no Exit button,

Please Help.

?

#include <GUIConstants.au3>
;
$hGUI = GUICreate("Exit Button")
$Exit = GUICtrlCreateButton ("Exit",  10, 30, 100)
GUISetState ()
;
do
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Exit
            Exit
    EndSelect
until $msg = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites
liten

?

#include <GUIConstants.au3>
;
$hGUI = GUICreate("Exit Button")
$Exit = GUICtrlCreateButton ("Exit",  10, 30, 100)
GUISetState ()
;
do
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Exit
            Exit
    EndSelect
until $msg = $GUI_EVENT_CLOSE
That code dosent work for some reason. nothing happens when i click the button

My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

Share this post


Link to post
Share on other sites
Yashied
liten

This works if you have not changed anything here.

Hm, the only thing i seem to have edited was $sGUI to just $GUI, $Exit and $Button1(my exitbutton name) besides that i have changed nothing?

coul dit be i need to use

func x()

or just us the do and be on, sorry i am confused


My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

Share this post


Link to post
Share on other sites
Yashied
Inverted

If you changed $Exit, I hope you also changed the line :

Case $msg = $Exit

Share this post


Link to post
Share on other sites
liten

do
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button1
            Exit
    EndSelect
until $msg = $GUI_EVENT_CLOSE

and also - which is at top of page almost with other GUICreate,

GUI = GUICreate("Exit Button")

and

$Button1 = GUICtrlCreateButton("EXIT", 159, 56, 321, 129, $WS_GROUP, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUISetState ()
GUICtrlSetFont(-1, 29, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xB9D1EA)
GUICtrlSetBkColor(-1, 0x000000)

which is with all my other GUI things,

Edited by liten

My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

Share this post


Link to post
Share on other sites
Inverted

Looks pretty correct to me. Are you sure the do ... until loop is being executed ?

Share this post


Link to post
Share on other sites
liten

Looks pretty correct to me. Are you sure the do ... until loop is being executed ?

How would i find this out?


My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

Share this post


Link to post
Share on other sites
rajeshontheweb
liten

Sadly Still dosent work, is their any other way to make an exit button, like with _ispressed or something, if so please leave a code or explain to me so i can do it


My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

Share this post


Link to post
Share on other sites
liten

I also tried

Func MS()
    SetPrivilege("SeDebugPrivilege", 1)
    $ID = _MemoryOpen(ProcessExists("Process.exe"))
    _MemoryWrite($CTT, $ID, GuiCtrlRead($Slider2))
    While 1    
     MoveSpeed() 
    Wend
 _MemoryClose($ID) 
 EndFunc

My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

Share this post


Link to post
Share on other sites
Inverted

Wtf was that ...

Post your whole script. Seems you keep doing weird stuff, no longer you can't make the simplest of things work.

Share this post


Link to post
Share on other sites
Valuater

I also tried

Func MS()
     SetPrivilege("SeDebugPrivilege", 1)
     $ID = _MemoryOpen(ProcessExists("Process.exe"))
     _MemoryWrite($CTT, $ID, GuiCtrlRead($Slider2))
     While 1       
      MoveSpeed() 
     Wend
  _MemoryClose($ID) 
  EndFunc
I just told you yesterday.... you CAN NOT do this within the function (correctly)

While 1

MoveSpeed()

Wend

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
liten

Wtf was that ...

Post your whole script. Seems you keep doing weird stuff, no longer you can't make the simplest of things work.

#RequireAdmin
#AutoIt3Wrapper_icon=ATX.ico
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Nomadmemory.au3>
#include <Array.au3>
#include <memory.au3>
#include <Inet.au3>
#include <GUIConstants.au3>
#Region 
WinWaitActive("Process") 
Opt('GUIOnEventMode', 1)
;#####################PAUSE AND ESCAPE#################################################
Global $Paused

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

Global $hGUI
Global $Radio1
Global $Radio2
Global $Radio3
Global $Radio4
Global $Slider1
Global $Slider2 
Global $Button1
;###########################GUI########################################################
$GUI = GUICreate("ExitButton", 300, 200)
$hGUI = GUICreate('Test', 200, 200)
GUISetOnEvent($GUI_EVENT_CLOSE, '_Close')
$Form1_1 = GUICreate("XXXXXXX", 609, 463, 210, 211)
$List1 = GUICtrlCreateList("", 7, 16, 113, 151, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlSetData(-1, "Free:No rights")
GUICtrlSetCursor (-1, 7)
$Li = GUICtrlCreateLabel("XXXXXXX", 135, 24, 380, 30, -1, BitOR($WS_EX_CLIENTEDGE,$GUI_WS_EX_PARENTDRAG))
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0x000000)
$Slider1 = GUICtrlCreateSlider(135, 216, 369, 17)
GUICtrlSetOnEvent($Slider1, 'RadioSpeed3')
GUICtrlSetLimit(-1, 250, 0)
$Label1 = GUICtrlCreateLabel("AS", 127, 192, 69, 17)
GUICtrlSetColor(-1, 0x99B4D1)
GUICtrlSetBkColor(-1, 0x000000)
$Checkbox1 = GUICtrlCreateCheckbox("checkbox1", 87, 216, 17, 17, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlSetBkColor(-1, 0xA0A0A4)
$Edit = GUICtrlCreateEdit("", 135, 240, 369, 57, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlSetData(-1, "PUT NOTES AND VARIOUS THING YOU FIND AND WANT TO REMEMBER HERE:")
$Button1 = GUICtrlCreateButton("EXIT", 159, 56, 321, 129, $WS_GROUP, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUISetState ()
GUICtrlSetFont(-1, 29, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xB9D1EA)
GUICtrlSetBkColor(-1, 0x000000)
$Label2 = GUICtrlCreateLabel("MS", 127, 320, 65, 17)
GUICtrlSetColor(-1, 0x99B4D1)
GUICtrlSetBkColor(-1, 0x000000)
$Button2 = GUICtrlCreateButton("NB", 135, 344, 81, 17, $WS_GROUP)
$Button3 = GUICtrlCreateButton("DS", 231, 344, 81, 17, $WS_GROUP)
$Button4 = GUICtrlCreateButton("CTT", 423, 344, 81, 17, $WS_GROUP)
GUICtrlSetFont(-1, 7, 400, 0, "Tahoma")
$Button5 = GUICtrlCreateButton("Triple Speed", 327, 344, 81, 17, $WS_GROUP)
$Slider2 = GUICtrlCreateSlider(135, 384, 369, 17)
GUICtrlSetOnEvent($Slider2, 'RadioSpeed3')
GUICtrlSetLimit(-1, 25000, 0)
$Label3 = GUICtrlCreateLabel("on/off", 39, 216, 33, 17)
GUICtrlSetColor(-1, 0x99B4D1)
GUICtrlSetBkColor(-1, 0x000000)
$List2 = GUICtrlCreateList("", 7, 248, 105, 175)
GUICtrlSetData(-1, "Free:No rights")
GUICtrlSetCursor (-1, 7)
$List3 = GUICtrlCreateList("", 519, 16, 81, 409)
GUICtrlSetData(-1, "Free:No rights")
GUICtrlSetCursor (-1, 7)
$List4 = GUICtrlCreateList("", 151, 408, 329, 45)
GUICtrlSetData(-1, "Free:No rights to distribute, or use this porgram,")
$Radio1 = GUICtrlCreateRadio("Radio1", 168, 360, 17, 17)
GUICtrlSetOnEvent($Radio1, 'RadioSpeed1')
GUICtrlSetBkColor(-1, 0x000000)
$Radio2 = GUICtrlCreateRadio("Radio2", 264, 360, 17, 17)
GUICtrlSetOnEvent($Radio2, 'RadioSpeed2')
GUICtrlSetBkColor(-1, 0x000000)
$Radio3 = GUICtrlCreateRadio("Radio3", 360, 360, 17, 17)
GUICtrlSetOnEvent($Radio3, 'RadioSpeed3')
GUICtrlSetBkColor(-1, 0x000000)
$Radio4 = GUICtrlCreateRadio("Radio4", 456, 360, 17, 17)
GUICtrlSetOnEvent($Radio4, 'RadioSpeed4')
GUICtrlSetBkColor(-1, 0x000000)
$Pic1 = GUICtrlCreatePic("important\BKG.jpg", 0, 0, 609, 465, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;############################Addresses###################################
$AS = 0x00B8451B
$CTT = 0x00B5EF18
;##########################GUI FUNCTIONS########################### 

Func Protect()
     While 1

If BitAnd(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
            GUICtrlSetState($Slider2, $GUI_DISABLE)
            GUICtrlSetState($Slider1, $GUI_DISABLE)
            GUICtrlSetState($Radio1, $GUI_ENABLE)
            GUICtrlSetState($Radio2, $GUI_ENABLE)
            GUICtrlSetState($Radio3, $GUI_ENABLE)
            GUICtrlSetState($Radio4, $GUI_ENABLE)
        Else
            GUICtrlSetState($Slider2, $GUI_ENABLE)
            GUICtrlSetState($Slider1, $GUI_ENABLE)
            GUICtrlSetState($Radio1, $GUI_DISABLE)
            GUICtrlSetState($Radio2, $GUI_DISABLE)
            GUICtrlSetState($Radio3, $GUI_DISABLE)
            GUICtrlSetState($Radio4, $GUI_DISABLE)
        EndIf
 WEnd
 EndFunc
 
Func RadioSpeed1()
    SetPrivilege("SeDebugPrivilege", 1)
    $ID = _MemoryOpen(ProcessExists("Process.exe"))
    If BitAnd(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED  Then
        _MemoryWrite($CTT, $ID, 0)
    EndIf
    _MemoryClose($ID)
EndFunc

Func RadioSpeed2()
    SetPrivilege("SeDebugPrivilege", 1)
    $ID = _MemoryOpen(ProcessExists("Process.exe"))
    If BitAnd(GUICtrlRead($Radio2), $GUI_CHECKED) = $GUI_CHECKED  Then
        _MemoryWrite($CTT, $ID, 200)
    EndIf
    _MemoryClose($ID)
EndFunc

       
Func RadioSpeed3()
    SetPrivilege("SeDebugPrivilege", 1)
    $ID = _MemoryOpen(ProcessExists("Process.exe"))
    If BitAnd(GUICtrlRead($Radio3), $GUI_CHECKED) = $GUI_CHECKED  Then
        _MemoryWrite($CTT, $ID, 300)
    EndIf
    _MemoryClose($ID)
EndFunc

Func RadioSpeed4()
    SetPrivilege("SeDebugPrivilege", 1)
    $ID = _MemoryOpen(ProcessExists("Process.exe"))
    If BitAnd(GUICtrlRead($Radio4), $GUI_CHECKED) = $GUI_CHECKED  Then
        _MemoryWrite($CTT, $ID, 25000)
    EndIf
    _MemoryClose($ID)
EndFunc

Func _Close()
    GUIDelete()
    Exit
EndFunc
;###############################Sliders#######################################################

Func AS()  
    SetPrivilege("SeDebugPrivilege", 1)
    $ID = _MemoryOpen(ProcessExists("Program.exe"))
    _MemoryWrite($AS, $ID, GuiCtrlRead($Slider1))
      _MemoryClose($ID) 
  EndFunc
  
  Func MS()  
    SetPrivilege("SeDebugPrivilege", 1)
    $ID = _MemoryOpen(ProcessExists("program.exe"))
    _MemoryWrite($CTT, $ID, GuiCtrlRead($Slider2))
      _MemoryClose($ID) 
  EndFunc
  
;###################################WHILE ONE REPEAT###########################################
    While 1    
     Protect()
     RadioSpeed1()
     RadioSpeed2()
     RadioSpeed3()
     RadioSpeed4()
     MS()
     AS()
 Wend
;###############################EXIT BUTTON############################

Do
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button1
            Exit
    EndSelect
until $msg = $GUI_EVENT_CLOSE

;############################END OF EXIT BUTTON##########  ################# 
While 1

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

    EndSwitch
WEnd
Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('" PAUSED"', 512, 15)
    WEnd
    ToolTip("")
EndFunc ;==>TogglePause

Func Terminate()
    ToolTip('"Exiting"', 512, 15)
    Sleep(1000)
    ToolTip("")
    Exit 0
EndFunc ;==>Terminate
Edited by liten

My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

Share this post


Link to post
Share on other sites
liten

I just told you yesterday.... you CAN NOT do this within the function (correctly)

While 1

MoveSpeed()

Wend

8)

Even without the while, it dosent work, that was ust another option i was trying


My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

Share this post


Link to post
Share on other sites
Valuater

ok

1

You can not combine "OnEventMode" with GUIGetMsg()

2

There are no on event functions set to the button

3

When creating a GUI only use GUISetState() once

... There are probably more probs, but thats a start

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
liten

So whats a SIMPLE button script one that has all that you said, OMG i FAIL at buttons, ...


My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

Share this post


Link to post
Share on other sites
picea892

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

Example()

Func Example()
    Local $Button_1, $Button_2, $msg
    GUICreate("My GUI Button"); will create a dialog box that when displayed is centered

    Opt("GUICoordMode", 2)
    $Button_1 = GUICtrlCreateButton("Exit", 10, 30, 100)
    $Button_2 = GUICtrlCreateButton("Button Test", 10,50, -1,$BS_BITMAP)
GUICtrlSetImage(-1, "shell32.dll", 22)
    GUISetState()    ; will display an  dialog box with 2 button

   ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                ExitLoop  
            Case $msg = $Button_2
                MsgBox(0, 'Testing', 'Button 2 was pressed')   ; Will demonstrate Button 2 being pressed
        EndSelect
    WEnd
EndFunc  ;==>Example

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.