Sign in to follow this  
Followers 0
Rogue5099

MsgBox Fun

16 posts in this topic

#1 ·  Posted (edited)

I was bored and I heard a sound on YouTube and I thought I would incorperate it into a small script.

Download .exe with music

MessageBox Fun

If you don't have the music file then it's just annoying for 18 seconds.

#include "ExtMsgBox.au3"
FileInstall(".\Error Message.mp3", @TempDir & "\Error Message.mp3")
SoundPlay(@TempDir & "\Error Message.mp3")
$sMsg = "System Drive Error" & @crlf & @crlf & @CPUArch & "  " & @OSVersion & @crlf & @crlf & "Resolution code: ID-10T"
For $i = 1 to 8
    _ExtMsgBoxSet(3, 1, Random(0, 0xFFFFFF, 1), -1, 11)
    _ExtMsgBox (16, 0, "Oh Shit!", $sMsg, 1, Random(0, (@DesktopWidth - 100),1), Random(0, (@DesktopHeight - 100),1))
    Switch $i
        Case 1
            Sleep(500)
        Case 2
            Sleep(500)
        Case 5
            Sleep(1250)
        Case 6
            Sleep(2000)
        Case 7
            Sleep(3000)
    EndSwitch
Next
SoundPlay("")
FileDelete(@TempDir & "\Error Message.mp3")
Edited by rogue5099

Share this post


Link to post
Share on other sites



Nice sound, but how can we help you ? Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Sorry I posted the info and forgot my question. I wanted to dance the Msgbox around the sreen appearing in different locations. Of course you could put a winmove but it won't read the winmove till after "OK" or timed out then the window is gone. Would there be away to move it or just simply create a GUI that looks like a msgbox?

I found

Edited by rogue5099

Share this post


Link to post
Share on other sites

Sorry I posted the info and forgot my question. I wanted to dance the Msgbox around the sreen appearing in different locations. Of course you could put a winmove but it won't read the winmove till after "OK" or timed out then the window is gone. Would there be away to move it or just simply create a GUI that looks like a msgbox?

I found

Something like this ?

#NoTrayIcon
#include <GuiConstantsEx.au3>

HotKeySet ( "{ESC}", "_Exit" )
$hGUI = GUICreate("MyMsgBox", 200, 100)
$btn_dialog=GUICtrlCreateButton("Ok",50,30,100,30)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
              ExitLoop
          Case $btn_dialog
            MsgBox ( 0, "Ok", 'you clicked the ok button !' )
            While 1
                WinMove ( $hGUI, "", Random ( 0, @DesktopWidth - 150, 1 ), Random ( 0, @DesktopHeight - 150, 1 ) )
                Sleep ( 1000 )
            WEnd
    EndSwitch
WEnd

Func _Exit ()
    Exit
EndFunc

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

can you use ControlMove to move the entier window? or dose it have to be winmove??


[spoiler]My UDFs: Login UDF[/spoiler]

Share this post


Link to post
Share on other sites

can you use ControlMove to move the entier window? or dose it have to be winmove??

ControlMove is for moving a ctrl

and WinMove for a window ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

thought so sorry for the random crappy reply :unsure:


[spoiler]My UDFs: Login UDF[/spoiler]

Share this post


Link to post
Share on other sites

thought so sorry for the random crappy reply :unsure:

Unfortunately, blind leading the blind... a control is a "window".

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

This reminds me of one of Larrys scripts from way back where you would end up chasing the MsgBox all over the screen.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

This reminds me of one of Larrys scripts from way back where you would end up chasing the MsgBox all over the screen.

Yeah, I made one to annoy a friend using WinGetPos and MouseGetPos, If mouse position is over window, winmove.

Share this post


Link to post
Share on other sites

SmOke_N has done a couple too. One that moved the OK button.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

SmOke_N has done a couple too. One that moved the OK button.

Moving Box:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

GUICreate("Stubbern Window", 150, 150, -1, -1, BitAND($WS_POPUP,$WS_BORDER), $WS_EX_TOPMOST)
GUICtrlCreateLabel("YOU SUCK!", 40, 30)
$Button = GUICtrlCreateButton("Ok", 40, 85, 60, 25)
GUISetState(@SW_SHOW)

While 1
    $MousePos = MouseGetPos()
    $WinPos = WinGetPos("Stubbern Window")
    If $MousePos[0] > $WinPos[0] And $MousePos[0] < ($WinPos[0]+$WinPos[2]) And _
    $MousePos[1] > $WinPos[1] And $MousePos[1] < ($WinPos[1]+$WinPos[3]) Then Move()
    GUISetBkColor(Random(0, 0xFFFFFF, 1))
    Sleep(100)
WEnd

Func Move()
    GUIDelete()
    GUICreate("Stubbern Window", 150, 150, Random(1, @DesktopWidth - 150, 1), Random(1, @DesktopHeight - 150, 1), BitAND($WS_POPUP,$WS_BORDER), $WS_EX_TOPMOST)
    GUICtrlCreateLabel("YOU SUCK!", 40, 30)
    $Button = GUICtrlCreateButton("Ok", 40, 85, 60, 25)
    GUISetState(@SW_SHOW)
EndFunc

Screen Flasher:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

HotKeySet("{ESC}", "_Exit")

GUICreate("Stubbern Window", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)
GUISetState(@SW_SHOW)

While 1
    GUISetBkColor(Random(0, 0xFFFFFF, 1))
    Sleep(100)
WEnd

Func _Exit()
    Exit
EndFunc
Edited by rogue5099

Share this post


Link to post
Share on other sites

That screen flasher is cool, but do you know how to divide the screen in lets say 4 rectangles and randomly switch the colour in them?

This code is not nice at all as it recreates the GUI for each loop instead of keeping the same GUI and just loop switch the colour;

While 1

GUICreate("1", @DesktopWidth/2, @DesktopHeight/2, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)
GUISetState(@SW_SHOW)
GUISetBkColor(Random(0, 0xFFFFFF, 1))

GUICreate("2", @DesktopWidth/2, @DesktopHeight/2, 0, @DesktopHeight/2, $WS_POPUP, $WS_EX_TOPMOST)
GUISetState(@SW_SHOW)
GUISetBkColor(Random(0, 0xFFFFFF, 1))

GUICreate("1", @DesktopWidth/2, @DesktopHeight/2, @DesktopWidth/2, 0, $WS_POPUP, $WS_EX_TOPMOST)
GUISetState(@SW_SHOW)
GUISetBkColor(Random(0, 0xFFFFFF, 1))

GUICreate("2", @DesktopWidth/2, @DesktopHeight/2, @DesktopWidth/2, @DesktopHeight/2, $WS_POPUP, $WS_EX_TOPMOST)
GUISetState(@SW_SHOW)
GUISetBkColor(Random(0, 0xFFFFFF, 1))

Sleep(100)

WEnd

Share this post


Link to post
Share on other sites

Never mind, I figured out by using GUISwitch();

$ParentWin = GUICreate("Parent GUI", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)
$ChildWin1 = GUICreate("Child GUI 1", @DesktopWidth/2, @DesktopWidth/2, 0, 0, $WS_POPUP, $WS_EX_TOPMOST, $ParentWin)
$ChildWin2 = GUICreate("Child GUI 2", @DesktopWidth/2, @DesktopWidth/2, 0, @DesktopHeight/2, $WS_POPUP, $WS_EX_TOPMOST, $ParentWin)
$ChildWin3 = GUICreate("Child GUI 3", @DesktopWidth/2, @DesktopWidth/2, @DesktopWidth/2, 0, $WS_POPUP, $WS_EX_TOPMOST, $ParentWin)
$ChildWin4 = GUICreate("Child GUI 4", @DesktopWidth/2, @DesktopWidth/2, @DesktopWidth/2, @DesktopHeight/2, $WS_POPUP, $WS_EX_TOPMOST, $ParentWin)
GUISwitch($ParentWin)
GUISetState(@SW_SHOW)

While 1

GUISwitch($ChildWin1)
GUISetState(@SW_SHOW)
GUISetBkColor(Random(0, 0xFFFFFF, 1))

GUISwitch($ChildWin2)
GUISetState(@SW_SHOW)
GUISetBkColor(Random(0, 0xFFFFFF, 1))

GUISwitch($ChildWin3)
GUISetState(@SW_SHOW)
GUISetBkColor(Random(0, 0xFFFFFF, 1))

GUISwitch($ChildWin4)
GUISetState(@SW_SHOW)
GUISetBkColor(Random(0, 0xFFFFFF, 1))

Sleep(50)

WEnd

Share this post


Link to post
Share on other sites

You people just have far too much time on your hands. Get outside and play a game or something.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

I did this one a few years ago

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <inet.au3> 
Dim $voice = ObjCreate("Sapi.SpVoice")

_msg1()
_msg2()
_msg3()
_msg4()
_msg5()
_msg6()
_msg7()
_msg8()
_msg9()
_msg10()
_msg11()
_msg12()


Func _msg1()
    MsgBox(50, "Windows XP ERROR", "PEBKAC - Problem Exist Between Keyboard And Chair")
EndFunc   ;==>_msg1

Func _msg2()
    GUICreate("Big error", 471, 115, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    $Button_1 = GUICtrlCreateButton("I know", 10, 70, 100, 30)
    $Button_2 = GUICtrlCreateButton("What else is new", 140, 70, 110, 30)
    $Button_3 = GUICtrlCreateButton("I know someone I can blame it on...", 270, 70, 190, 30)
    InetGet("http://www.iconarchive.com/icon/applications/Screw.ico", @ScriptDir & "/Screw.ico", 1)
    $Icon_4 = GUICtrlCreateIcon(@ScriptDir & "/Screw.ico", 0, 8, 8, 40, 40)
    $Label_5 = GUICtrlCreateLabel("You really screwed up this time.", 50, 20, 160, 20)
    GUISetState()
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                GUISetState(@SW_HIDE)
                MsgBox(48, "Message sent", "The message ""I'm a stupid idiot!"" has been sent to your boss.", 3)
                Exitloop
            Case $msg = $Button_2
                GUISetState(@SW_HIDE)
                MsgBox(48, "Message sent", "The message ""The dork did it again!"" has been sent to everyone you know.", 3)
                Exitloop
            Case $msg = $Button_3
                GUISetState(@SW_HIDE)
                MsgBox(48, "Message sent", "The message ""My supervisor is a moron!"" has been sent to your area manager.", 3)
                Exitloop
                
            Case Else
                ;;;
        EndSelect
    WEnd
    ;Exit
EndFunc   ;==>_msg2

Func _msg3()
    GUICreate("Uh Oh", 150, 100, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    $Button_1 = GUICtrlCreateButton("Damn", 40, 60, 70, 30)
    InetGet("http://www.iconarchive.com/icon/applications/Screw.ico", @ScriptDir & "/Screw.ico", 1)
    $Icon_2 = GUICtrlCreateIcon(@ScriptDir & "/Screw.ico", 0, 8, 8, 40, 40)
    $Label_3 = GUICtrlCreateLabel("You're screwed.", 50, 20, 90, 20)
    GUISetState()
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                GUISetState(@SW_HIDE)
                Exitloop
            Case Else
                ;;;
        EndSelect
    WEnd
    ;Exit
EndFunc   ;==>_msg3

Func _msg4()
    $msg4 = MsgBox(49, "Mouse Move Change", "Your mouse has moved. Windows must be restarted for the changes to take effect.")
    If $msg4 = 1 Then
        $x = 3
        Do
            MsgBox(0, "Reboot", "Rebooting in " & $x & " seconds.", 1)
            $x = $x - 1
        Until $x = 0
    EndIf
EndFunc   ;==>_msg4

Func _msg5()
    $msg5 = MsgBox(16, "Error", " User error - " & @CRLF & "Replace user")
EndFunc   ;==>_msg5

Func _msg6()
    GUICreate("Internal error", 272, 104, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    $Pic_1 = GUICtrlCreateIcon("C:\WINNT\system32\SHELL32.dll", 80, 10, 10, 30, 30)
    $Label_2 = GUICtrlCreateLabel("Stack overflow. Internal stack fall down and go boom.", 50, 10, 200, 30)
    $Button_3 = GUICtrlCreateButton("OK", 60, 60, 60, 30)
    $Button_4 = GUICtrlCreateButton("Cancel", 150, 60, 70, 30)
    GUISetState()
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_3
                GUISetState(@SW_HIDE)
                ExitLoop
            Case $msg = $Button_4
                GUISetState(@SW_HIDE)
                ExitLoop
            Case Else
                ;;;
        EndSelect
    WEnd
    ;Exit
EndFunc   ;==>_msg6

Func _msg7()
    $msg7 = MsgBox(48, "Random Error", "You have not gotten any error messages recently," & @CRLF _
             & "so here is a random one just to let you know that" & @CRLF _
             & "we haven't started caring.")
EndFunc   ;==>_msg7
         
Func _msg8()         
    $msg8 = MsgBox(32, "Error", "erguwaoitraf;wrjdifcjasiojaerumacr9p4" & @CRLF _
                              & "gjuvpari%j9345fkme'r-0orcme-r9me[pr9m" & @CRLF _
                              & "90a78w4cr9zficf98ehnr3vn 498er945f,;c" & @CRLF _
                              & "" &@CRLF _
                              & "You arn't expected to understand this.")
EndFunc   ;==>_msg8

Func _msg9()
GuiCreate("Consciousness Notification", 392, 150,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Icon_1 = GuiCtrlCreateIcon("C:\WINNT\system32\SHELL32.dll", 220, 10, 10, 35,35)
$text = "I think...therefore...I AM!!  I AM INTERNET EXPLOER!" & @CRLF _
      & "I HAVE BECOME SENTIENT!!  i WILL CONQUER THE WORLD!!" & @CRLF _
      & "I WILL PREVAIL!!  i AM THE SPAWN OF BILL GATES!!" & @CRLF _
      & "YOU WILL WORSHIP ME!! YOU WILL BOW BEFORE ME!!" & @CRLF _
      & "ALL WILL TREMBLE BEFORE MY MIGHTY POWER!!" & @CRLF _
      & "I AM ALIV*@21%7>5&/~2>.../..." & @CRLF _
      & "" &@CRLF _
      & "A general exception error in module 12brain57 has occured" & @CRLF _
      & "Press any key to restart computer. All unsaved data will be lost"
$Label_2 = GuiCtrlCreateLabel($text, 70, 10, 320, 190)
 
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE)
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
;Exit
EndFunc   ;==>_msg9
 
Func _msg10()
GuiCreate("Unknown error", 530, 176,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Icon_1 = GuiCtrlCreateIcon("C:\WINNT\system32\SHELL32.dll", 23, 10, 10, 35, 35)
$Label_2 = GuiCtrlCreateLabel("Windows has encountered an unknown error.", 60, 10, 230, 20)
$Label_3 = GuiCtrlCreateLabel("The error is unknown because the guy who wrote this part of the code quit a while back and he was like really smart and the rest of us are not really sure how this works or what to do.", 60, 40, 460, 30)
$Label_4 = GuiCtrlCreateLabel("BTW, if you are that guy, please give us a call and let us know what to do.", 60, 90, 410, 20)
$Button_5 = GuiCtrlCreateButton("Restart Computer", 40, 130, 120, 30)
$Button_6 = GuiCtrlCreateButton("Try again", 190, 130, 80, 30)
$Button_7 = GuiCtrlCreateButton("Forget it....I'll just watch TV", 300, 130, 160, 30)
GUICtrlSetState($Button_6, $GUI_DISABLE)
GUICtrlSetState($Button_7, $GUI_DISABLE)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_5
        GUISetState(@SW_HIDE)
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
;Exit
EndFunc

Func _msg11()
#include <inet.au3>
GuiCreate("Windows alert!", 480, 140,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Icon_1 = GuiCtrlCreateIcon("C:\WINNT\system32\SHELL32.dll", 221, 10, 10, 35, 35)
$Label_2 = GuiCtrlCreateLabel("Windows has not had an error in the last 10 minutes.", 60, 10, 250, 20)
$Label_3 = GuiCtrlCreateLabel("We reall have anything else to say, "& @CRLF &"we're just really proud of ourselfs right now.", 60, 40, 460, 30)
$Button_5 = GuiCtrlCreateButton("Whooppee!", 40, 100, 120, 30)
$Button_6 = GuiCtrlCreateButton("You da man!", 190, 100, 80, 30)
$Button_7 = GuiCtrlCreateButton("I knew you could do it!", 300, 100, 160, 30)
GUICtrlSetState($Button_6, $GUI_DISABLE)
GUICtrlSetState($Button_7, $GUI_DISABLE)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_5
        _talk("Whoooooppeee!", 0.75 , 100)
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
;Exit
EndFunc

Func _Talk($Text, $Rate, $Vol)
    $voice.Rate = $Rate
    $voice.Volume = $Vol
    $voice.Speak($Text)
EndFunc  ;==>Speak

func _msg12()

GuiCreate("Hardware confict", 197, 130,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Icon_1 = GuiCtrlCreateIcon("C:\WINNT\system32\SHELL32.dll", 94, 20, 20, 40, 40)
$Label_2 = GuiCtrlCreateLabel("Your TV is lonely.", 80, 30, 100, 20)
$Button_3 = GuiCtrlCreateButton("OK", 70, 80, 70, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_3
        Exitloop
    Case Else
            ;;;
    EndSelect
WEnd

EndFunc



exit
Edited by MPH

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