Jump to content
Sign in to follow this  
kman

Looking for GUI help

Recommended Posts

kman

Hello Everyone,

Here is what I am trying to do. When a particular window is open I get a box with a particular text. When another window is open the box will change color and text. Im basically trying to give the user a better visual cue of what is on the screen. I can get what Im looking for by using SplashTextOn but I am limited of course with no color. So I am trying to us the GUI function to do the same thing. But I am stuck on how to get the GUI to display. The code using Splash is below along with the GUI code I have so far. Any help would be appreciated. Thank You!

CODE
Opt("WinTitleMatchMode", 2)

Opt("TrayIconDebug", 1)

Const $WIDTH = 500

Const $HEIGHT = 20

Dim $MousePos[2]

$XPOS = -1

$YPOS = 0

While 1

If WinActive("WEST") Then

SplashTextOn("west", "West Campus", $WIDTH, $HEIGHT, $XPOS, $YPOS, 17, "", 12, 800)

Else

If WinActive("EAST") Then

SplashTextOn("east", "East Campus", $WIDTH, $HEIGHT, $XPOS, $YPOS, 17, "", 12, 800)

Else

SplashOff()

EndIf

EndIf

Sleep(1000)

WEnd

GUI code:

CODE
$west = GuiCreate("",500,25,-1,0,$WS_POPUP)

GUISetBkColor (0xCC0033)

GUISetFont (14,500)

GUICtrlCreateLabel ("West Campus",190,2)

GuiSetState()

$east = GuiCreate("",500,25,-1,0,$WS_POPUP)

GUISetBkColor (0x33CC33)

GUISetFont (14,500)

GUICtrlCreateLabel ("East Campus",190,2)

GuiSetState()

Share this post


Link to post
Share on other sites
Generator

First you need to make the title of GUI West and East for these to work:

If WinActive("EAST") Then
If WinActive("WEST") Then

Then you'll need a While Loop to keep the GUI open in script two.

Share this post


Link to post
Share on other sites
kman

Thanks, I have tried something like that but they both show up at the same time. Im sure its because the command after the "then". Also, how do you get it so its always on top?

CODE
#include <GuiConstants.au3>

GuiCreate("",500,25,-1,0,$WS_POPUP)

GUISetBkColor (0xCC0033)

GUISetFont (14,500)

GUICtrlCreateLabel ("West Campus",190,2)

GuiSetState()

GuiCreate("",500,25,-1,0,$WS_POPUP)

GUISetBkColor (0x33CC33)

GUISetFont (14,500)

GUICtrlCreateLabel ("East Campus",190,2)

GuiSetState()

While 1

If WinActive("WEST") Then

$msg = GUIGetMsg (0)

Else

If WinActive("EAST") Then

$msg = GUIGetMsg (1)

Else

; I want nothing to be displayed if the windows I want are not active

EndIf

EndIf

Sleep(1000)

WEnd

Share this post


Link to post
Share on other sites
Generator

Does this suit your need?..

#include <GuiConstants.au3>
$oWest=GuiCreate("",500,25,-1,0,$WS_POPUP)
GUISetBkColor (0xCC0033)
GUISetFont (14,500)
GUICtrlCreateLabel ("West Campus",190,2)
GuiSetState(@SW_HIDE)

$oEast=GuiCreate("",500,25,-1,0,$WS_POPUP)
GUISetBkColor (0x33CC33)
GUISetFont (14,500)
GUICtrlCreateLabel ("East Campus",190,2)
GuiSetState(@SW_HIDE)

While 1
If WinActive("WEST") Then
GUISetState(@SW_SHOW,$oWest)
ElseIf WinActive("EAST") Then
GUISetState(@SW_SHOW,$oWest)
EndIf
Sleep(1)
WEnd
Edited by Generator

Share this post


Link to post
Share on other sites
kman

Thank you, that is close to what I am looking for. I had to make a small change to get it to display. I will list that below. It only seems to switch once, it will display "west" then when I change the window to east it will display "east" but will then stay there if I switch back to west. Also how can you get the display to always display on top and when neither east or west window is active display nothing, but once one of them becomes active again show the appropriate display. When these display it also shows a box in the task bar so you can manually switch these. Is there a way to get these out of the taskbar?

I also made images and used splashimageon but those blink according to the sleep time this way seems easier to do but the blink can be annoying to the user, can that be "smoothed" out?

Opt("WinTitleMatchMode", 2)
Opt("TrayIconDebug", 1)

#include <GuiConstants.au3>
$oWest=GuiCreate("",500,25,-1,0,$WS_POPUP)
GUISetBkColor (0xCC0033)
GUISetFont (14,500)
GUICtrlCreateLabel ("West Campus",190,2)
GuiSetState(@SW_HIDE)

$oEast=GuiCreate("",500,25,-1,0,$WS_POPUP)
GUISetBkColor (0x33CC33)
GUISetFont (14,500)
GUICtrlCreateLabel ("East Campus",190,2)
GuiSetState(@SW_HIDE)

While 1
If WinActive("WEST") Then
GUISetState(@SW_SHOW,$oWest)
Else
    If WinActive("EAST") Then
GUISetState(@SW_SHOW,$oEast)
EndIf
EndIf
Sleep(1000)
WEnd

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  

×