Jump to content

reload the same script


Recommended Posts

Nope, I tried other classes but it did not work

Func _Show($hWnd)
    If $hWnd = $gui Then Return
    If _WinAPI_GetClassName($hWnd) = "notepad" Then
        _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW))
        $FGW = $hWnd
        _UnhookEvents()
        AdlibRegister("isWindow", 3000);COMMENT HERE
        Return
    EndIf
EndFunc   ;==>_Show
Edited by PeterOctavio
Link to comment
Share on other sites

Try this, 
it probably can be done in other simpler ways, you'll just have to give it time, and have your share of experiments ..

#include <misc.au3>
#include <Constants.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <WinAPISys.au3>

HotKeySet("{END}", "callWindow")
Global $gui, $FGW, $Pause = False, $Stop = False, $hDLL = DllOpen("user32.dll")

$gui = GUICreate("Example", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW)
$button1 = GUICtrlCreateButton("stop", 10, 65, 50, 20)

Global $hEventProc, $hEventHook
_HookEvents()
OnAutoItExitRegister('OnAutoItExit')
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            If $Pause = False Then
                $Pause = True
                GUICtrlSetData($button1, "run")
;~              _UnhookEvents()
                $Stop = True
                WinSetOnTop($gui, "", 0)
            Else
                $Pause = False
                GUICtrlSetData($button1, "stop")
                $Stop = False
;~              _HookEvents()
            EndIf
    EndSwitch
    If $Pause = False Then
        If HWnd($FGW) And BitAND(WinGetState($FGW), 8) Then ;Checks if the window is active
            If _IsPressed("01", $hDLL) Then
                WinSetOnTop($gui, "", 1)
                While _IsPressed("01", $hDLL)
                    Sleep(250)
                WEnd
                Flash()
            EndIf
        EndIf
;~      If HWnd($FGW) And Not BitAND(WinGetState($FGW), 8) Then ;Checks if the window is NOT active
;~          WinSetOnTop($gui, "", 0)
;~      EndIf
        If Not BitAND(WinGetState($FGW), 1) Then ;Checks if the window exists
;~          _HookEvents()
            $Stop = False
        EndIf
    EndIf
    Sleep(30)
WEnd

Func _EventProc($hEventHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iThreadId, $iEventTime)
    #forceref $hEventHook, $iObjectID, $iChildID, $iThreadId, $iEventTime
    Switch $iEvent
        Case $EVENT_SYSTEM_MINIMIZEEND
            _Show($hWnd)
        Case $EVENT_SYSTEM_FOREGROUND
            _Show($hWnd)
    EndSwitch
EndFunc   ;==>_EventProc


Func _Show($hWnd)
    If $FGW = $hWnd Then WinSetOnTop($gui, "", 1)
    If $Stop Then
        WinSetOnTop($gui, "", 0)
        Return
    EndIf
    If $hWnd = $gui Then Return
    If _WinAPI_GetClassName($hWnd) = "notepad" Then
        _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW))
        $FGW = $hWnd
        $Stop = True
;~      Flash()
;~      _UnhookEvents()
        Return
    EndIf
EndFunc   ;==>_Show

Func callWindow()
    _WinAPI_SetWindowPos($gui, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW))
    WinActivate($gui)
EndFunc   ;==>callWindow

Func _HookEvents()
    $hEventProc = DllCallbackRegister('_EventProc', 'none', 'ptr;dword;hwnd;long;long;dword;dword')
;~  $hEventHook = _WinAPI_SetWinEventHook($EVENT_SYSTEM_FOREGROUND, $EVENT_SYSTEM_FOREGROUND, DllCallbackGetPtr($hEventProc), $WINEVENT_OUTOFCONTEXT)
    $hEventHook = _WinAPI_SetWinEventHook($EVENT_SYSTEM_FOREGROUND, $EVENT_SYSTEM_MINIMIZEEND, DllCallbackGetPtr($hEventProc), $WINEVENT_OUTOFCONTEXT)
EndFunc   ;==>_HookEvents

Func _UnhookEvents()
    _WinAPI_UnhookWinEvent($hEventHook)
    DllCallbackFree($hEventProc)
EndFunc   ;==>_UnhookEvents

Func OnAutoItExit()
    _UnhookEvents()
EndFunc   ;==>OnAutoItExit

Func Flash()
    _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_NOZORDER, $SWP_HIDEWINDOW))
    Sleep(300)
;~  If BitAND(WinGetState($FGW), 8) Then
;~  _WinAPI_SetWindowPos($gui, $HWND_NOTOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW))
    _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW))
;~  Else
;~      _HookEvents()
;~      $Stop = False
;~  EndIf
EndFunc   ;==>Flash

 

Edited by Deye
Link to comment
Share on other sites

did not work,
I've checked everything already and I do not understand
A few hours ago you did this one, and it's working.
So when you put a window on the side of the other it stops working

#include <misc.au3>
#include <Constants.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <WinAPISys.au3>

HotKeySet("{END}", "callscript")
Global $gui, $FGW, $Pause = False, $hDLL = DllOpen("user32.dll")

$gui = GUICreate("blind", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW)
$button1 = GUICtrlCreateButton("stop", 10, 65, 50, 20)

Global $hEventProc, $hEventHook
_HookEvents()
OnAutoItExitRegister('OnAutoItExit')
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            If $Pause = False Then
                $Pause = True
                GUICtrlSetData($button1, "run")
                _UnhookEvents()
                WinSetOnTop($gui, "", 0)
            Else
                $Pause = False
                GUICtrlSetData($button1, "stop")
                _HookEvents()
            EndIf
    EndSwitch
    Sleep(30)
WEnd

Func _EventProc($hEventHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iThreadId, $iEventTime)
    #forceref $hEventHook, $iObjectID, $iChildID, $iThreadId, $iEventTime
    Switch $iEvent
        Case $EVENT_SYSTEM_FOREGROUND
            AdlibUnRegister("Clicker");comment here
            Return _Show($hWnd)
        Case $EVENT_SYSTEM_MINIMIZEEND
            AdlibUnRegister("Clicker");comment here
            Return _Show($hWnd)
    EndSwitch
EndFunc   ;==>_EventProc

Func _Hide()
    If BitAND(WinGetState($gui), 1) Then _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_HIDEWINDOW))

EndFunc   ;==>_Hide

Func _Show($hWnd)
    If $hWnd = $gui Then Return
    If $hWnd =_WinAPI_GetShellWindow() Then Return
    If _WinAPI_GetClassName($hWnd) = "notepad"  Then
        _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW))
        $FGW = $hWnd
        Flash()
        AdlibRegister("Clicker", 100);comment here
        Return
    EndIf
    Return _Hide()
EndFunc   ;==>_Show

Func callscript()
    _WinAPI_SetWindowPos($gui, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW))
    WinActivate($gui)
EndFunc   ;==>callscript

Func _HookEvents()
    $hEventProc = DllCallbackRegister('_EventProc', 'none', 'ptr;dword;hwnd;long;long;dword;dword')
    $hEventHook = _WinAPI_SetWinEventHook($EVENT_SYSTEM_FOREGROUND, $EVENT_SYSTEM_MINIMIZEEND, DllCallbackGetPtr($hEventProc), $WINEVENT_OUTOFCONTEXT)
EndFunc   ;==>_HookEvents

Func _UnhookEvents()
    _WinAPI_UnhookWinEvent($hEventHook)
    DllCallbackFree($hEventProc)
    AdlibUnRegister("Clicker");comment here
EndFunc   ;==>_UnhookEvents

Func OnAutoItExit()
    _UnhookEvents()
EndFunc   ;==>OnAutoItExit

Func Clicker()
    If BitAND(WinGetState($FGW), 8) Then
        If _IsPressed("01", $hDLL) Then
            While _IsPressed("01", $hDLL)
                Sleep(100)
            WEnd
            Flash()
        EndIf
    EndIf
EndFunc   ;==>Clicker

Func Flash()
    _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_NOZORDER, $SWP_HIDEWINDOW))
    Sleep(300)
    If BitAND(WinGetState($FGW), 8) Then
        _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_NOZORDER, $SWP_SHOWWINDOW))
    EndIf
EndFunc   ;==>Flash
Link to comment
Share on other sites

41 minutes ago, Deye said:

The _UnhookEvents() did not work for you check my last edit ..

Okay, in your last issue, when you maximize the windows, the script disrupts the other windows. I think it has to have an extra function, to retreat back from the other open classes

@Deye

"The _UnhookEvents() did not work for you check my last edit ." what this, i check visual basic, and other things like framework But they have the latest version, and my OS: windows 8

Edited by PeterOctavio
Link to comment
Share on other sites

@Deye

Look what I found, in this script here, previous to its last edition, the script is disappearing because it is counting the click of function_show

#include <misc.au3>
#include <Constants.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <WinAPISys.au3>

HotKeySet("{END}", "callscript")
Global $gui, $FGW, $Pause = False, $hDLL = DllOpen("user32.dll")

$gui = GUICreate("blind", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW)
$button1 = GUICtrlCreateButton("stop", 10, 65, 50, 20)

Global $hEventProc, $hEventHook
_HookEvents()
OnAutoItExitRegister('OnAutoItExit')
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            If $Pause = False Then
                $Pause = True
                GUICtrlSetData($button1, "run")
                _UnhookEvents()
                WinSetOnTop($gui, "", 0)
            Else
                $Pause = False
                GUICtrlSetData($button1, "stop")
                _HookEvents()
            EndIf
    EndSwitch
    Sleep(30)
WEnd

Func _EventProc($hEventHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iThreadId, $iEventTime)
    #forceref $hEventHook, $iObjectID, $iChildID, $iThreadId, $iEventTime
    Switch $iEvent
        Case $EVENT_SYSTEM_FOREGROUND
            AdlibUnRegister("Clicker");comment here
            Return _Show($hWnd)
        Case $EVENT_SYSTEM_MINIMIZEEND
            AdlibUnRegister("Clicker");comment here
            Return _Show($hWnd)
    EndSwitch
EndFunc   ;==>_EventProc

Func _Hide()
    If BitAND(WinGetState($gui), 1) Then _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_HIDEWINDOW))

EndFunc   ;==>_Hide

Func _Show($hWnd)
    If $hWnd = $gui Then Return
    If $hWnd =_WinAPI_GetShellWindow() Then Return
    If _WinAPI_GetClassName($hWnd) = "notepad"  Then
        _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW))
        $FGW = $hWnd
        Flash()
        AdlibRegister("Clicker", 100);comment here
        Return
    EndIf
    Return _Hide()
EndFunc   ;==>_Show

Func callscript()
    _WinAPI_SetWindowPos($gui, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW))
    WinActivate($gui)
EndFunc   ;==>callscript

Func _HookEvents()
    $hEventProc = DllCallbackRegister('_EventProc', 'none', 'ptr;dword;hwnd;long;long;dword;dword')
    $hEventHook = _WinAPI_SetWinEventHook($EVENT_SYSTEM_FOREGROUND, $EVENT_SYSTEM_MINIMIZEEND, DllCallbackGetPtr($hEventProc), $WINEVENT_OUTOFCONTEXT)
EndFunc   ;==>_HookEvents

Func _UnhookEvents()
    _WinAPI_UnhookWinEvent($hEventHook)
    DllCallbackFree($hEventProc)
    AdlibUnRegister("Clicker");comment here
EndFunc   ;==>_UnhookEvents

Func OnAutoItExit()
    _UnhookEvents()
EndFunc   ;==>OnAutoItExit

Func Clicker()
    If BitAND(WinGetState($FGW), 8) Then
        If _IsPressed("01", $hDLL) Then
            While _IsPressed("01", $hDLL)
                Sleep(100)
            WEnd
            Flash()
        EndIf
    EndIf
EndFunc   ;==>Clicker

Func Flash()
    _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_NOZORDER, $SWP_HIDEWINDOW))
    Sleep(300)
    If BitAND(WinGetState($FGW), 8) Then
        _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_NOZORDER, $SWP_SHOWWINDOW))
    EndIf
EndFunc   ;==>Flash
Link to comment
Share on other sites

PeterOctavio,

When using the WinEventHook we hook in to system events 
in this script we hook in to getting events regarding foreground window changes
The _UnhookEvents() function used  is only to tell the script to stop acquiring for these events
This is the function that didn't work for you and crashed ..
so I changed it with My last edited post - check again for the update when you finish reading!

About commented lines:
commented lines start with ;~ at the beginning of a line  and have no effect when running the script
To comment or uncomment a line you can use CTRL + Q combination on your keyboard

If you don't understand an AutoIt keyword, you can highlight it, then hit F1 key on the keyboard , you will get the help file shown with examples and explanations ..

Good luck

Edited by Deye
Link to comment
Share on other sites

  • 3 months later...

@Deye

hi, how are u?

¿living great days!?

i hope for sure!!!

 

can help me in this scrip, 

I need that when I press the button tools, that it is disabled, until it is clicked again and return to the enabled state.

#include <misc.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIMenu.au3>

Opt("GUIOnEventMode", 1)

Global $gui, $button1, $button2

Func _Main()
    $gui = GUICreate("blear", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, 'close')

    $button1 = GUICtrlCreateButton("show", 5, 65, 40, 20)
    GUICtrlSetOnEvent(-1, "show_Button")

   $button3 = GUICtrlCreateButton("tools", 5, 45, 40, 20)
    GUICtrlSetOnEvent(-1, "tools_on")

;~     $button2 = GUICtrlCreateButton("Off", 50, 65, 40, 20)
;~     GUICtrlSetOnEvent(-1, "Off_button")
;~     TraySetState()
    GUISetState()
;~     HotKeySet("{END}", "callscript")


;~ WinActive("[CLASS:notepad]")
;~ WinSetOnTop($gui, "", 1)



Off_button()

EndFunc


_Main()


Func tools_on()
HotKeySet("{END}", "cls0")
HotKeySet("{HOME}", "cls")
HotKeySet("{DELETE}", "play")
EndFunc


func cls0()

Sleep(235)
MouseClick("right" ,108,345, 1, 1)
MouseMove (88,765)
EndFunc

func cls()
MouseClick("right" ,76,648, 1, 1)
MouseMove (88,765)
EndFunc

func play()

Sleep(235)
MouseClick("right" ,911,647, 1, 1)
MouseMove (88,765)
EndFunc










While 1
   Sleep(500)
WEnd


Func Off_button()
    WinSetOnTop($gui, "", 0)
    GUICtrlSetData($button2, "On")
    GUICtrlSetOnEvent($button2, "On_button")
    GUICtrlSetState($button1, $GUI_disable)
EndFunc




;~ Func show_Button()
;~     GUISetState(@SW_HIDE, $gui)
;~     Sleep(500)
;~     GUISetState(@SW_SHOW, $gui)
;~ EndFunc


;~ Func On_button()
;~     WinSetOnTop($gui, "", 1)
;~     GUICtrlSetData($button2, "Off")
;~     GUICtrlSetOnEvent($button2, "Off_button")
;~     GUICtrlSetState($button1, $GUI_ENABLE)

;~ EndFunc

;~ Func callscript()
;~     WinActivate($gui)
;~ EndFunc





Func close()
    Exit
EndFunc

 

Link to comment
Share on other sites

Welcome back PedroOctavio,

I don't think there is a way to unset HotKeySets, you can use _IsPressed Instead and Use "On <> Off" button naming as a pause trigger

#include <Misc.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>

Opt("GUIOnEventMode", 1)

Global $gui, $button1, $button2

_Main()

Func _Main()
    $gui = GUICreate("blear", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, 'close')
    $button1 = GUICtrlCreateButton("show", 5, 65, 40, 20)
    $button2 = GUICtrlCreateButton("On", 5, 45, 40, 20)
    GUICtrlSetOnEvent(-1, "Tools_on")
    GUISetState()
    Local $hDLL = DllOpen("user32.dll")

    While 1
        If _IsPressed("23", $hDLL) Then
            ConsoleWrite("_IsPressed - END  Key was pressed." & @CRLF)
            ; Wait until key is released.
            While _IsPressed("23", $hDLL)
                Sleep(250)
            WEnd
            cls0()
        ElseIf _IsPressed("24", $hDLL) Then
            ConsoleWrite("_IsPressed - HOME Key was pressed." & @CRLF)
            ; Wait until key is released.
            While _IsPressed("24", $hDLL)
                Sleep(250)
            WEnd
            cls()
        EndIf
        Sleep(250)
    WEnd
EndFunc   ;==>_Main

Func Tools_on()
    If GUICtrlRead($button2) = "On" Then
        GUICtrlSetData($button2, "Off")
    Else
        GUICtrlSetData($button2, "On")
    EndIf
EndFunc   ;==>Tools_on

Func cls0()
    _callWindow()
EndFunc   ;==>cls0

Func cls()
    If GUICtrlRead($button2) = "Off" Then
        MouseMove(88, 765)
    EndIf
EndFunc   ;==>cls

Func _callWindow()
    WinActivate($gui)
EndFunc   ;==>_callWindow

Func close()
    Exit
EndFunc   ;==>close

 

Edited by Deye
Link to comment
Share on other sites

And what if HotKeySet accepts Null for the the 2nd parameter ..

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)

Global $gui, $button1, $button2

HotKeySet("{END}", "_callWindow")

_Main()

Func _Main()
    $gui = GUICreate("blear", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, 'close')
;~  $button1 = GUICtrlCreateButton("show", 5, 65, 40, 20)
    $button2 = GUICtrlCreateButton("On", 5, 45, 40, 20)
    GUICtrlSetOnEvent(-1, "Tools_on")
    GUISetState()

    While 1
        Sleep(500)
    WEnd
EndFunc   ;==>_Main

Func Tools_on()
    If GUICtrlRead($button2) = "On" Then
        GUICtrlSetData($button2, "Off")
        HotKeySet("{HOME}", "cls")
    Else
        GUICtrlSetData($button2, "On")
        HotKeySet("{HOME}", Null)
    EndIf
EndFunc   ;==>Tools_on

Func cls()
    If GUICtrlRead($button2) = "Off" Then
        MouseMove(88, 765)
    EndIf
EndFunc   ;==>cls

Func _callWindow()
    WinActivate($gui)
EndFunc   ;==>_callWindow

Func close()
    Exit
EndFunc   ;==>close

 

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

MainGUI()

Func MainGUI()
  Local $Button1, $Button2, $msg
  GUICreate("My GUI Window Title")

  Opt("GUICoordMode", 2)
  $Button1 = GUICtrlCreateButton("Button 1", 10, 30, 100)


 GUISetState()
GUICtrlSetState($Button1, $GUI_ENABLE)
HotKeySet("{ESC}", "test")


   While 1
   $msg = GUIGetMsg()
   Select
    Case $msg = $GUI_EVENT_CLOSE
       ExitLoop
    Case $msg = $Button1
       GUICtrlSetState($Button1, $GUI_DISABLE)

    EndSelect
  WEnd
EndFunc

func test()

        MouseMove(88, 765)

EndFunc

@Deye

You do not understand, I want to click on the tools option, make the script work, I say the functions unequipped for the keys, then the tools option to be in disable mode, so as not to run the risk of clicking again ...

 

this is my new perfil...tanks for atenction

 

Edited by PedroOctavio
addtion code
Link to comment
Share on other sites

@Deye

 

good night, how are u?

fine, i bless!!!

u help me in this script, what I put in it, when I run it reappear in the last position that was dragged on the screen, and how do I get the autoit signal from the indentification bar

 

#include <misc.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIMenu.au3>


Opt('MustDeclareVars', 1)

Global $gui, $button3, $msg

Func _Main()
$gui = GUICreate("Tools", 100, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, 'Close')
$button3 = GUICtrlCreateButton("Tools", 10, 70, 40, 20)
GUICtrlSetOnEvent(-1, "Tools_on")
GUISetState()

 While 1
$msg = GUIGetMsg()
Select
Case $msg = $Button3
GUICtrlSetState($Button3, $GUI_DISABLE)
tools_on()
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
EndFunc

Func tools_on()
HotKeySet("{END}", "Cls0")
HotKeySet("{INS}", "Cls01")
HotKeySet("{HOME}", "Cls")
HotKeySet("{DELETE}", "Play")
EndFunc

HotKeySet("{ESC}", "Close") ;without_SD

_Main()

;~ HotKeySet("{ESC}", "Callwindow") ;disable for rum without_SD

func cls0()
MouseMove (158,403, 2)
MouseClick("right", 158,403, 1, 1)
MouseMove (160,772, 1)
EndFunc

func cls01()
Send ("{ENTER}")
MouseClick("right", 158,403, 1, 1)
Send ("{ENTER}")
MouseMove (160,772, 1)
EndFunc

func cls()
MouseClick("right" ,136,671, 1, 1)
MouseMove (160,772, 1)
EndFunc

func play()
Sleep(234)
MouseClick("right" ,874,672, 1, 1)
MouseMove (160,772,1)
EndFunc

Func callwindow()
WinActivate($gui)
EndFunc

Func Close()

 

Link to comment
Share on other sites

Hello Pedro,

The description of what you are trying to do now is not clear to me that I can only advise you to use https://translate.google.com/ with your posts with broader descriptions, if you do it right then readers of your posts will be able to help you to move on.. Also, Please start a new topic with a new title, so your problem can be viewed on a clean slate

Wishing you well
Good luck

Link to comment
Share on other sites

On 25/10/2017 at 10:44 AM, Deye said:

Hello Pedro,

The description of what you are trying to do now is not clear to me that I can only advise you to use https://translate.google.com/ with your posts with broader descriptions, if you do it right then readers of your posts will be able to help you to move on.. Also, Please start a new topic with a new title, so your problem can be viewed on a clean slate

Wishing you well
Good luck

for when I execute the script, the GUI reappears in the last place positioned on the screen

$gui = GUICreate("Tools", 100, 100) [@DesktopWidth - (*), @DesktopHeight - (*),] ???
Edited by PedroOctavio
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...