Sign in to follow this  
Followers 0
TokeySmurf

Please Help - Can't find the answer

9 posts in this topic

Hey, I've looked through the forums the faqs the databasis and I just can't seem to find my answer I've been playing with this for about 3 hours now and everything seems to work except the "Stop" Button. Once it has run it wont close and none of the buttons work but if hit stop before you hit start it executes like it should but once its running its gone.. Here is the script

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

Opt("GUICoordMode",2)

AutoItSetOption("WinTitleMatchMode", 4)

$mainwindow = GUICreate("Blank", 195, 50)

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

Opt("GUICoordMode",2)

$start = GUICtrlCreateButton("Start", 10, 25, 90)

GUICtrlSetOnEvent($start, "Start")

$Stop = GUICtrlCreateButton("Stop", 0, -1)

GUICtrlSetOnEvent($Stop, "Stop")

GUISetState(@SW_SHOW)

Global $handle = WinGetHandle("classname=GxWindowClassD3d")

WinSetState ($handle, "", @SW_MAXIMIZE )

if @error Then

msgbox(0, "Blank Not Found", "Please Start Blank")

Exit

EndIf

While 1

GUISetState(@SW_SHOW)

Wend

Func Start()

Global $Stop = 0

Global $handle = WinGetHandle("classname=GxWindowClassD3d")

WinSetState ($handle, "", @SW_MINIMIZE )

;WinSetState ($handle, "", @SW_HIDE )

If @error Then

MsgBox(0, "Blank Not Found", "Please Start Blank")

Else

MsgBox(0, "Blankedy", "Blank Started")

ControlSend($handle, "", "", "{UP DOWN}")

Sleep(100)

ControlSend($handle, "", "", "{UP UP}")

ControlSend($handle, "", "", "{DOWN DOWN}")

Sleep(100)

ControlSend($handle, "", "", "{DOWN UP}")

Sleep(200000)

If $Show > 0 exitloop

EndIf

EndFunc

Func Stop()

If $Stop = 0 Then

WinSetstate ("Blank", "", @SW_SHOW ) ;;; Should I be using $handle here and below?

WinSetState ("Blank", "", @SW_MAXIMIZE )

WinActivate ($handle, "")

MsgBox(0, "Blank", "Blank Halted")

Else

msgbox(0, "ERROR", "Program Not Running")

endif

EndFunc

Func CLOSEClicked()

MsgBox(0, "Closing Blank!", "Peace!")

Exit

EndFunc

Please help.. I've tried many diffrent things and this is the best I've got

Share this post


Link to post
Share on other sites



1st when posting code in forum, please use [ code ] your code [ /code ] (without the spaces)

2nd might be a good idea to get SciTE (see my signature)

give the following a try:

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
Opt("GUICoordMode", 2)

Global $Stop = 0, $handle, $Show = 0

AutoItSetOption("WinTitleMatchMode", 4)
$mainwindow = GUICreate("Blank", 195, 50)
GUISetOnEvent($GUI_EVENT_CLOSE, "_CLOSEClicked")
Opt("GUICoordMode", 2)
$start = GUICtrlCreateButton("Start", 10, 25, 90)
GUICtrlSetOnEvent($start, "_Start")
$Stop = GUICtrlCreateButton("Stop", 0, -1)
GUICtrlSetOnEvent($Stop, "_Stop")
GUISetState(@SW_SHOW)
Global $handle = WinGetHandle("classname=GxWindowClassD3d")
WinSetState($handle, "", @SW_MAXIMIZE)
If @error Then
    MsgBox(0, "Blank Not Found", "Please Start Blank")
    Exit
EndIf

While 1
    Sleep(10)
    If $Show > 0 Then ExitLoop
WEnd

Func _Start()
    $handle = WinGetHandle("classname=GxWindowClassD3d")
    WinSetState($handle, "", @SW_MINIMIZE)
    ;WinSetState ($handle, "", @SW_HIDE )
    If @error Then
        MsgBox(0, "Blank Not Found", "Please Start Blank")
    Else
        MsgBox(0, "Blankedy", "Blank Started")
        ControlSend($handle, "", "", "{UP DOWN}")
        Sleep(100)
        ControlSend($handle, "", "", "{UP UP}")
        ControlSend($handle, "", "", "{DOWN DOWN}")
        Sleep(100)
        ControlSend($handle, "", "", "{DOWN UP}")
        Sleep(200000)
    EndIf
EndFunc   ;==>_Start

Func _Stop()
    If $Stop = 0 Then
        WinSetState("Blank", "", @SW_SHOW) ;;; Should I be using $handle here and below?
        WinSetState("Blank", "", @SW_MAXIMIZE)
        WinActivate($handle, "")
        MsgBox(0, "Blank", "Blank Halted")
    Else
        MsgBox(0, "ERROR", "Program Not Running")
    EndIf
EndFunc   ;==>_Stop

Func _CLOSEClicked()
    MsgBox(0, "Closing Blank!", "Peace!")
    Exit
EndFunc   ;==>_CLOSEClicked

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Reply, Thanks alot, I will try this now and also sorry for not using the (code) command. Also I'll look into that program, thanks again. going to try it here in a min

Share this post


Link to post
Share on other sites

Same problem bro, It starts. Stop Key just wont work afterwords sand can't close it =(

Share this post


Link to post
Share on other sites

Same problem bro, It starts. Stop Key just wont work afterwords sand can't close it =(

Sorry you need to set $Stop = 1, all I did was clean it up and remove any errors


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Same problem bro, It starts. Stop Key just wont work afterwords sand can't close it =(

Ahh. Ok.. I'll try that out.. I'll let you know later on tonite or tommorrow how it worked out.. Gotta head out for a few.. Thanks!

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Frost... he had a control "buttoN' named stop and a $var named stop

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
Opt("GUICoordMode", 2)
Opt("WinTitleMatchMode", 4)
Opt("GUICoordMode", 2)

Global $Show = 0
Global $handle = WinGetHandle("classname=GxWindowClassD3d")

$mainwindow = GUICreate("Blank", 195, 50)
$start = GUICtrlCreateButton("Start", 10, 25, 90)
GUICtrlSetOnEvent($start, "Start")
$Stop = GUICtrlCreateButton("Stop", 0, -1)
GUICtrlSetOnEvent($Stop, "Stop")
GUISetState(@SW_SHOW)

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
WinSetOnTop($mainwindow, "", 1)
WinSetState($handle, "", @SW_MAXIMIZE)
If @error Then
    MsgBox(0, "Blank Not Found", "Please Start Blank")
    Exit
EndIf

While 1
    Sleep(20)
    
    If $Show = 1 Then
        ControlSend($handle, "", "", "{UP DOWN}")
        Sleep(100)
        ControlSend($handle, "", "", "{UP UP}")
        ControlSend($handle, "", "", "{DOWN DOWN}")
        Sleep(100)
        ControlSend($handle, "", "", "{DOWN UP}")
        Sleep(200000)
        $Show = 0
    EndIf
WEnd

Func Start()
    
    WinSetState($handle, "", @SW_MINIMIZE)
    ;WinSetState ($handle, "", @SW_HIDE )
    If @error Then
        MsgBox(0, "Blank Not Found", "Please Start Blank", 3)
    Else
        MsgBox(0, "Blankedy", "Blank Started", 3)
        $Show = 1
    EndIf
EndFunc   ;==>Start

Func Stop()
    If Not WinExists($handle) Then ; $Stop = 0 Then
        WinSetState($handle, "", @SW_SHOW) ;;; Should I be using $handle here and below?....YES
        WinSetState($handle, "", @SW_MAXIMIZE)
        WinActivate($handle, "")
        MsgBox(0, "Blank", "Blank Halted", 3)
        $Show = 0
    Else
        MsgBox(0, "ERROR", "Program Not Running", 3)
        $Show = 0
    EndIf
EndFunc   ;==>Stop

Func CLOSEClicked()
    MsgBox(0, "Closing Blank!", "Peace!", 3)
    Exit
EndFunc   ;==>CLOSEClicked

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

This is why I usually don't mess with these little bots, usually to many things named the same.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

This is why I usually don't mess with these little bots, usually to many things named the same.

Thanks for the help guys, sorry for being a noob =/..

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