Verssuss

multi MsgBox dont wanted

7 posts in this topic

#1 ·  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 ???

Share this post


Link to post
Share on other sites



#2 ·  Posted

Maybe:

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

 

Share this post


Link to post
Share on other sites

#3 ·  Posted

dont see any changes... after MsgBox apear first time and u press again KEY "]" another MsgBox appear after u cancel previous

 

Share this post


Link to post
Share on other sites

#4 ·  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

 

2 people like this

Share this post


Link to post
Share on other sites

#5 ·  Posted

hahahah god damn i already used it in another function xD

no need to test it i know it works ^_^ thx :]

Share this post


Link to post
Share on other sites

#6 ·  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.

Share this post


Link to post
Share on other sites

#7 ·  Posted

sure i know this is just example script.

anyway thx for tip

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

  • Similar Content

    • Nareshm
      By Nareshm
      I have autoit script like this :
      winActivate ("BillReceipt") ControlClick ( "BillReceipt", "", "[NAME:winviewer]", "right") Send ( "{ENTER}") WinWait ("Print") ControlClick ("Print", "", "[CLASS:Button; INSTANCE:13]") Winwait ("Save As") WinActivate ("Save As") Send ("{TAB 5} {Backspace} ^v {Enter}") I need Saved successfully msgbox with file name as i saved like Filename.extension (Example = test.pdf is saved successfull)

      Please Help
    • AnonymousX
      By AnonymousX
      Hello,
      I'm trying to make it so that when a message box pops up that the GUI will be unresponsive until that message box has been closed. From reading through the help the closest thing I can find is the WinWaitClose function, however this doesn't work fully as desired. If user tries to click on GUI the actions are more just waiting for the message box to close, so that once it closes everything happens at once. I want it so that the GUI is completely unusable until message box is closed. 
       
      Below is test code to demonstrate the problem and help explain what I want. Any advice on this?
       
      #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) local $but = GUICtrlCreateButton("Hello", 150,150,85,25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) MsgBox( 262144,"Message","Try hitting the hello button several times,without closing this window. Now close this window and see how script wasn't restricted it just was waiting and storing the instructions") WinWaitClose("Message") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK Exit case $but MsgBox(0,"","Hello") EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example  
    • hcI
      By hcI
      Hello !
      I'm making a little script with only a tray option, no GUI.
      And i would like to know if someone created a function to set a personalized icon in top-left corner of the MsgBox and/or InputBox...
      -hcI
    • SkysLastChance
      By SkysLastChance
      I am a little confused and not sure what I am doing wrong.
      I am trying to get a OK and Cancel button that is always on top. 
      $MB_OKCANCEL 1 OK and Cancel $MB_TOPMOST 262144 MsgBox() has top-most attribute set  
      But when I try to run this code. 
      $Msg = MsgBox(1 & 262144, "Registration", "Would you like to continue?") I get this.

    • Tigerweld
      By Tigerweld
      I have a simple msgbox function that I need to use in multiple places, but have different outcomes.  For example, in one location if the left button was pressed I need it to write a one of the reg values.  How do I accomplish this?
       
      #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Local $reg0 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "0") Local $reg1 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "1") Local $reg2 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "2") Local $reg3 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "3") Local $reg4 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "4") MainGUI() Func MainGUI() Local $Left, $Right, $msg GUICreate("Light") Opt("GUICoordMode", 2) $Left = GUICtrlCreateButton("Left", 10, 30, 50) $Right = GUICtrlCreateButton("Right", 0, -1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Left ; write reg value Case $msg = $Right ; write reg value EndSelect WEnd EndFunc