Jump to content

Recommended Posts

Posted

Sorry im new. iwannto ask how can i make stop, puase , exit button for script im so sory again i wantto trybut i cant do it.

Posted (edited)

Please post whatever code you have at this point so we have something to work with.

If you just want some pointers.... look at Exit and HotKeySet() in the help file

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Posted

do you really want buttons like on a gui? or just keyboard shortcuts? like hit esc to exit, 1 to play, 2 to pause . . .

both should be very easy with while statement.

Posted

Sorry im new. iwannto ask how can i make stop, puase , exit button for script im so sory again i wantto trybut i cant do it.

i dont wat to hot key just make button stop pause and exit script

Posted (edited)

If you wanted hotkeys

Opt("GUIOnEventMode", 1)
HotKeySet("{ESC}", "_Custom_Exit")
HotKeySet("{LEFT}", "_Pause")
HotKeySet("{RIGHT}", "_Play")
Global $Play = True
;GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] )
$GUI = GUICreate("Example", 110, 100)

;GUICtrlCreateButton ( "text", left, top [, width [, height [, style [, exStyle]]]] )
Global $Play_Button = GUICtrlCreateButton("Play", 10, 10, 90, 24)
GUICtrlSetOnEvent(-1, "_Play")

Global $Pause_Button = GUICtrlCreateButton("Pause", 10, 35, 90, 24)
GUICtrlSetOnEvent(-1, "_Pause")

Global $Exit_Button = GUICtrlCreateButton("Exit", 10, 60, 90, 24)
GUICtrlSetOnEvent(-1, "_Custom_Exit")

GUISetState(@SW_SHOW, $GUI)

; ============================================================================
; Main Loop
; ============================================================================
While 1
    Sleep(10)
    If $Play = True Then
        ToolTip("Playing")
    Else
        ToolTip("Paused")
    EndIf
WEnd
; ============================================================================
; Functions
; ============================================================================

Func _Play()
    $Play = True
EndFunc   ;==>_Play

Func _Pause()
    $Play = False
EndFunc   ;==>_Pause

Func _Custom_Exit()
    Exit
EndFunc   ;==>_Custom_Exit
Edited by Hatcheda
Posted

Sorry im new. iwannto ask how can i make stop, puase , exit button for script im so sory again i wantto trybut i cant do it.

MsgBox(0,"Macro"," By S0uL")

Sleep(500)

#include <GuiConstants.au3>

GuiCreate("Macro", 601, 124,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

GuiSetState()

WinMove("Macro", "", 430, 320, 207,210)

; PIC

GuiCtrlCreatePic("menu.jpg",0,0, 207,157)

; START BUTTON

$Button_1 = GuiCtrlCreateButton("Start",0, 160,30)

GUICtrlSetState( $Button_1, $GUI_FOCUS)

; STOP BUTTON

$Button_2 = GuiCtrlCreateButton("Stop", 40,160,30)

; EXIT BUTTON

$Exit = GUICtrlCreateButton("Exit", 80, 160, 30)

GUISetState()

While 1

$msg = GUIGetMsg()

Send("a1s1a2s3w3")

WinActivate("MAcro")

Select

Case $msg = $GUI_EVENT_CLOSE

Exit

Case $msg = $Exit

Exit

Case $msg = $Button_1

EndSelect

wend

Posted (edited)

#include <GuiConstants.au3> ; always put your include statements at the very begining of a script


MsgBox(0, "Macro", " By S0uL")
Sleep(500)


GUICreate("Macro", 601, 124, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUISetState()
WinMove("Macro", "", 430, 320, 207, 210)

; PIC
GUICtrlCreatePic("menu.jpg", 0, 0, 207, 157)
; START BUTTON
$Button_1 = GUICtrlCreateButton("Start", 0, 160, 30)
GUICtrlSetState($Button_1, $GUI_FOCUS)

; STOP BUTTON
$Button_2 = GUICtrlCreateButton("Stop", 40, 160, 30)

; EXIT BUTTON
$Exit = GUICtrlCreateButton("Exit", 80, 160, 30)
GUISetState()

$Paused = 0

While 1
    $msg = GUIGetMsg()

    ; WinActivate("MAcro")  ; I dont think this is needed
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Exit
            Exit
        Case $msg = $Button_1
            $Paused = 0
        Case $msg = $Button_2
            $Paused = 1
    EndSelect
    
    If $Paused = 0 Then
        ToolTip("Running") ; You can put your Send("a1s1a2s3w3") here
    Else
        ToolTip("Paused")
    EndIf
    Sleep(10) ; to keep from using 100% CPU
WEnd

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

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
×
×
  • Create New...