Sign in to follow this  
Followers 0
Craberos

Msgbox and WinActivate Help

4 posts in this topic

hi all

thanks in advance ........

i am a noob at this therefore i would like some one to help me please

I have 4 text files with the names mentioned below the code is working great but .... now i want a msgbox with 4 buttons EARTH, FIRE, AIR, WATER so when i click that particular button for example EARTH i want this function to work WinActivate ("EARTH") which will bring the particular window front

can anyone help me please

thanks

Craberos

Opt("WinTitleMatchMode", 2)

While 1

WinActivate ("EARTH")

Sleep (5000)

WinActivate ("FIRE")

Sleep (5000)

WinActivate ("AIR")

Sleep (5000)

WinActivate ("WATER")

Sleep (5000)

WEnd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Look at the help for these functions

GUICreate()

GUICtrlCreateButton()

Since you are a "noob" it would be best to read the help file. The example script in the GUICtrlCreateButton() section in the help already has a two button menu, just work off that.

I don't think anyone will help you with this since there should be hundreds of examples on the forums already as well.

Edited by hawky358

Share this post


Link to post
Share on other sites

Hi, welcome to the forum.

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

GUICreate("Earth")
GUISetState(@SW_SHOW)
GUICreate("Fire")
GUISetState(@SW_SHOW)
GUICreate("Air")
GUISetState(@SW_SHOW)
GUICreate("Water")
GUISetState(@SW_SHOW)
$aWindowPos = WinGetPos("Water")

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("", 138, 75, $aWindowPos[0]-145, -1)
$Button1 = GUICtrlCreateButton("Earth", 8, 8, 59, 25)
$Button2 = GUICtrlCreateButton("Fire", 72, 8, 59, 25)
$Button3 = GUICtrlCreateButton("Air", 8, 40, 59, 25)
$Button4 = GUICtrlCreateButton("Water", 72, 40, 59, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _ActiveWindow("Earth")
        Case $Button2
            _ActiveWindow("Fire")
        Case $Button3
            _ActiveWindow("Air")
        Case $Button4
            _ActiveWindow("Water")
    EndSwitch
WEnd

Func _ActiveWindow($sWindowName)
    WinActivate($sWindowName)
EndFunc

GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi, welcome to the forum.

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

GUICreate("Earth")
GUISetState(@SW_SHOW)
GUICreate("Fire")
GUISetState(@SW_SHOW)
GUICreate("Air")
GUISetState(@SW_SHOW)
GUICreate("Water")
GUISetState(@SW_SHOW)
$aWindowPos = WinGetPos("Water")

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("", 138, 75, $aWindowPos[0]-145, -1)
$Button1 = GUICtrlCreateButton("Earth", 8, 8, 59, 25)
$Button2 = GUICtrlCreateButton("Fire", 72, 8, 59, 25)
$Button3 = GUICtrlCreateButton("Air", 8, 40, 59, 25)
$Button4 = GUICtrlCreateButton("Water", 72, 40, 59, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _ActiveWindow("Earth")
        Case $Button2
            _ActiveWindow("Fire")
        Case $Button3
            _ActiveWindow("Air")
        Case $Button4
            _ActiveWindow("Water")
    EndSwitch
WEnd

Func _ActiveWindow($sWindowName)
    WinActivate($sWindowName)
EndFunc

thanks a lot bro for the welcome and also for the code

thanks a lot yoriz

Edited by Craberos

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