Jump to content

Move Msgbox?


Recommended Posts

Hi.

MsgBoxes always are centrated on the screen. Is there a way to move it like inputboxes?

I want the MsgBox to pause the script for the user to click OK when the user is finished with the underlying program. But the MsgBox covers parts of the underlying program.

/Twinnis

Link to comment
Share on other sites

According to the help file message boxes are always centred. You can always make your own one using SplashTextOn and you can place it anywhere on the screen. Or you can make your own GUI.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

According to the help file message boxes are always centred. You can always make your own one using SplashTextOn and you can place it anywhere on the screen. Or you can make your own GUI.

Yes I know, but i thought that there might be a workaround or nifty tip, because I am a bit lazy... :o

But its time for me to learn to make GUIs.

Thanks for answer BigDod.

/Twinnis

Link to comment
Share on other sites

Yes I know, but i thought that there might be a workaround or nifty tip, because I am a bit lazy... :o

But its time for me to learn to make GUIs.

Thanks for answer BigDod.

/Twinnis

There is a very useful tool for making GUI's called Koda. It is available with Scite or can be downloaded separately.

Edit - You can download it at http://www.autoitscript.com/fileman/users/lookfar/index.html

Edited by BigDod


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Updated....works for both uncompiled and compiled scripts.

Put _DoTheMove() in the start, and _MoveMsgBox right before the MsgBoxes you want to move.

_DoTheMove()
_MoveMsgBox("MsgBox Title", 0, 100)
MsgBox(64, "MsgBox Title", "MsgBox Text")

Func _DoTheMove()
If $CMDLine[0] = 4 AND $CMDLine[1] = "-move" Then
  Opt("WinWaitDelay", 0)
  WinWait($CMDLine[2])
  WinMove($CMDLine[2], "", $CMDLine[3], $CMDLine[4])
  Exit  
EndIf
EndFunc

Func _MoveMsgBox($sTitle, $iPosX, $iPosY)
If @Compiled Then
  Run('"' & @ScriptFullPath & '" -move "' & $sTitle & '" ' & $iPosX & " " & $iPosY)
Else
  Run('"' & @AutoItExe & '" "' & @ScriptFullPath & '" -move "' & $sTitle & '" ' & $iPosX & " " & $iPosY)
EndIf
EndFunc
Edited by Helge
Link to comment
Share on other sites

...but small modifications would make it work as uncompiled.

; Move Message Box
; Author - herewasplato

_MoveMsgBox(0, "testTitle", "testText", 0, 10)

Func _MoveMsgBox($MBFlag, $MBTitle, $MBText, $x, $y)
    Local $file = FileOpen(EnvGet("temp") & "\MoveMB.au3", 2)
    If $file = -1 Then Return;if error, give up on the move
    
    Local $line1 = 'AutoItSetOption(' & '"WinWaitDelay", 0' & ')'
    Local $line2 = 'WinWait("' & $MBTitle & '", "' & $MBText & '")'
    Local $line3 = 'WinMove("' & $MBTitle & '", "' & $MBText & '"' & ', ' & $x & ', ' & $y & ')'
    FileWrite($file, $line1 & @CRLF & $line2 & @CRLF & $line3)
    FileClose($file)
    
    Run(@AutoItExe & " /AutoIt3ExecuteScript " & EnvGet("temp") & "\MoveMB.au3")
    
    MsgBox($MBFlag, $MBTitle, $MBText)
    
    FileDelete(EnvGet("temp") & "\MoveMB.au3")
EndFunc;==>_MoveMsgBox
Edit: requires beta

Edit2: An updated version of this code can be found here:

http://www.autoitscript.com/forum/index.ph...showtopic=22531

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

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