Jump to content

Recommended Posts

Posted

hi guys i want avoid to multiple MsgBox by hold Hotkey "]" in my script
 

#include <GuiConstantsEx.au3>
#include <Windowsconstants.au3>
#include <SendMessage.au3>
#include <WinAPI.au3>

;~ HotKeySet("{[}", "_boxminus")
HotKeySet("{]}", "_boxplus")
HotKeySet("{ESC}", "On_Exit")

$hGUI = GUICreate("", 100, 100, -1, -1, $WS_POPUP, BitOr($WS_EX_LAYERED, $WS_EX_COMPOSITED, $WS_EX_TOPMOST))
GUISetBkColor(0x00FF00)
GuiCtrlCreateLabel("", 3, 3, 94, 94)
GUICtrlSetBkColor(-1, 0xABCDEF)
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
GUISetState()
_WinAPI_SetLayeredWindowAttributes($hGui, 0xABCDEF)
$box_range = 100

While 1
    $pos = MouseGetPos()
    WinMove($hGUI, "", $pos[0] - ($box_range / 2), $pos[1] - ($box_range / 2), $box_range, $box_range)
WEnd

;~ Func _boxminus()
;~  If $box_range >= 30 Then $box_range = $box_range - 10
;~  If $box_range < 30 Then $box_range = $box_range - 1
;~ EndFunc

Func _boxplus()
    If $box_range < 200 Then
        $box_range = $box_range + 10
    Else
        MsgBox(0,"ERROR", "Maximum size already exist")
    EndIf
EndFunc

 Func On_Exit()
     Exit
 EndFunc

i wish after i get first MsgBox another gonna replaced with first one or just cancel in and apeear again

how can i make it right ???

Posted

Here's a simple hack:

#include <GuiConstantsEx.au3>
#include <Windowsconstants.au3>
#include <SendMessage.au3>
#include <WinAPI.au3>

;~ HotKeySet("{[}", "_boxminus")
HotKeySet("{]}", "_boxplus")
HotKeySet("{ESC}", "On_Exit")

$hGUI = GUICreate("", 100, 100, -1, -1, $WS_POPUP, BitOr($WS_EX_LAYERED, $WS_EX_COMPOSITED, $WS_EX_TOPMOST))
GUISetBkColor(0x00FF00)
GuiCtrlCreateLabel("", 3, 3, 94, 94)
GUICtrlSetBkColor(-1, 0xABCDEF)
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
GUISetState()
_WinAPI_SetLayeredWindowAttributes($hGui, 0xABCDEF)
$box_range = 100

While 1
    $pos = MouseGetPos()
    WinMove($hGUI, "", $pos[0] - ($box_range / 2), $pos[1] - ($box_range / 2), $box_range, $box_range)
WEnd

;~ Func _boxminus()
;~  If $box_range >= 30 Then $box_range = $box_range - 10
;~  If $box_range < 30 Then $box_range = $box_range - 1
;~ EndFunc

Func _boxplus()
    If $box_range < 200 Then
        $box_range = $box_range + 10
    Else
        HotKeySet("{]}")
        MsgBox(0,"ERROR", "Maximum size already exist")
        HotKeySet("{]}", "_boxplus")
    EndIf
EndFunc

 Func On_Exit()
     Exit
 EndFunc

 

Posted

No prob.  Also, just a recommendation, you may want to consider inserting a minimal sleep/delay in your main While loop.  Without one your CPU usage is high.

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