A Variation on Screen Data Display

General Macro Scheduler discussion

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3529
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

A Variation on Screen Data Display

Post by JRL » Fri Feb 25, 2011 11:07 pm

Some recent lessons learned.

How to make a dialog Stay on Top - Line 24
A One line VbScript for date and time - Line 39
What does a minimal Version 12 dialog look like - Lines 9-11
How to Make a borderless dialog - Line 25
How to make a portion of a dialog transparent - Lines 18, 21, 22
How to make a dialog react to a mouse over event - Line 27

This script will display the current date and time as well as your current mouse coordinates and the pixel color under the current mouse position. If your mouse touches the displayed text, the text will disappear for a few seconds. The timeout is somewhat controlled by setting the value of the "TimeOff" variable in the second line.

Code: Select all

//User preferences
Let>TimeOff=250
Let>TextColor=121
Let>TextSize=30
Let>Text_X_Pos=20
Let>Text_Y_Pos=45
//////////////////

Dialog>Dialog1
object Dialog1:i object Label1: TLabel end end
EndDialog>Dialog1

Let>WIN_USEHANDLE=1
  ResizeWindow>Dialog1.handle,1,1
  MoveWindow>Dialog1.handle,-32000,45
Let>WIN_USEHANDLE=0

SetDialogProperty>Dialog1,,Color,1111111
SetDialogObjectFont>Dialog1,Label1,Arial,TextSize,1,TextColor
SetDialogProperty>Dialog1,Label1,Caption,Time
SetDialogProperty>Dialog1,,TransparentColor,True
SetDialogProperty>Dialog1,,TransparentColorValue,1111111
SetDialogProperty>Dialog1,,AlphaBlend,True
SetDialogProperty>Dialog1,,FormStyle,fsStayOnTop
SetDialogProperty>Dialog1,,BorderStyle,bsNone
SetDialogProperty>Dialog1,,Caption,~~My~~Time~~
AddDialogHandler>Dialog1,Label1,OnMouseEnter,Clear

LibFunc>User32,GetSystemMetrics,VScrWidth,78
LibFunc>User32,GetSystemMetrics,VScrHeight,79
Let>restoreFlag=0
Show>Dialog1
Let>WIN_USEHANDLE=1
  ResizeWindow>Dialog1.handle,VScrWidth,VScrHeight
  MoveWindow>Dialog1.handle,Text_X_Pos,Text_Y_Pos
Let>WIN_USEHANDLE=0

Label>Loop
  VBEval>Right("0" & Month(now),2) & "-" & Right("0" & Day(now),2) & "-" & Year(now)  & "    " & Right("0" & Hour(now),2) & ":" & Right("0" & Minute(now),2) & ":" & Right("0" & Second(now),2),timestamp
  GetCursorPos>CurX,CurY
  GetPixelColor>CurX,CurY,PixelColor
  SetDialogProperty>Dialog1,Label1,Caption,%TimeStamp%      %CurX% %CurY%  %PixelColor%
  Wait>0.01
  If>restoreflag>0
    Add>restoreflag,1
    If>restoreflag>50
      SetDialogProperty>Dialog1,,AlphaBlendValue,{%restoreFlag%-50}
      SetDialogProperty>Dialog1,,Visible,True
      If>restoreflag>304
        Let>restoreFlag=0
      EndIf
    EndIf
  EndIf
Goto>Loop

SRT>Clear
  SetDialogProperty>Dialog1,,Visible,False
  Let>restoreFlag=1
  Let>PauseFlag=0
  Label>LongPause
    Wait>0.01
    Add>PauseFlag,1
    If>PauseFlag>TimeOff
      Goto>Enough
    Else
  Goto>LongPause
  Label>Enough
END>Clear



User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Fri Feb 25, 2011 11:42 pm

That's a sweet little script... thanks JRL.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts