Dialog Count Down Timer

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Dialog Count Down Timer

Post by CyberCitizen » Wed Jan 30, 2013 2:50 am

Hi Guys,

I am looking to get some help on creating a timer which will be used as an indicator as to how much air someone would have left on their air set (fire fighting).

Below is a brief idea of what I am looking to accomplish, however I am not sure how to display time remaining. Eg I can do minutes for example.

Image

When the guys enter we say they have 20 minutes of air. To be fair its more like 30 minutes but we work on 20 minutes to play it safe.

When it gets to the 10 minute mark we announce they have 10 minutes of air remaining, same for 5 minutes left, 2 minutes left & their time out. Now they also have an extra 2 minutes & another extra 2 meaning they have upto 24 minutes.

What I am wanting is multiple progress bars to show the time remaining on each count. I think I have that with the attached code, very messy was thrown together pretty quick, however I can't for the life of me work out how to display the time remain on each call in minutes and seconds.

Eg for the 10 minute call there is 2 minutes and 10 seconds before I need to announce 10 minutes remaining. Once the script is working I will look at including sounds and voices as well. But the main part is the visual indicators first.

If anyone can assist that would be appreciated.

Code: Select all

Let>APP_TITLE=SACFS ECO Timer
Let>MSG_HEIGHT=320
Let>MSG_WIDTH=500
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=1

GetTime>now
TimeAdd>now,M,10,10mincal
TimeAdd>now,M,15,15mincal
TimeAdd>now,M,18,18mincal
TimeAdd>now,M,20,20mincal
TimeAdd>now,M,22,22mincal
TimeAdd>now,M,24,24mincal
MDL>10 Minutes Remaining: 	%10mincal%%CRLF%05 Minutes Remaining: 	%15mincal%%CRLF%02 Minutes Remaining: 	%18mincal%%CRLF%Time Out: 		%20mincal%%CRLF%Extra Two Minutes: 		%22mincal%%CRLF%Extra Two Minutes x2: 	%24mincal%

GetTime>now
TimeDiff>now,10mincal,S,numberMins
TimeDiff>now,15mincal,S,15numberMins
//MDL>%numberMins%


Dialog>Dialog1
object Dialog1: TForm
  Left = 247
  Top = 96
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 256
  ClientWidth = 314
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 8
    Top = 8
    Width = 296
    Height = 13
    Caption = 'SACFS Compartment Fire Behaviour Entry Control Officer Timer'
  end
  object Label2: TLabel
    Left = 8
    Top = 32
    Width = 72
    Height = 13
    Caption = '10 Minutes Call'
  end
  object Label3: TLabel
    Left = 160
    Top = 32
    Width = 90
    Height = 13
    Caption = 'Minutes Remaining'
  end
  object Label4: TLabel
    Left = 8
    Top = 96
    Width = 66
    Height = 13
    Caption = '5 Minutes Call'
  end
  object Label5: TLabel
    Left = 160
    Top = 96
    Width = 90
    Height = 13
    Caption = 'Minutes Remaining'
  end
  object Edit1: TEdit
    Left = 8
    Top = 48
    Width = 145
    Height = 21
    Enabled = False
    TabOrder = 0
    Text = 'Edit1'
  end
  object MSButton1: tMSButton
    Left = 8
    Top = 224
    Width = 107
    Height = 25
    Caption = 'Start'
    TabOrder = 1
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 200
    Top = 224
    Width = 107
    Height = 25
    Caption = 'Exit'
    ModalResult = 2
    TabOrder = 2
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object ProgressBar1: TProgressBar
    Left = 8
    Top = 72
    Width = 297
    Height = 17
    Max = 600
    Smooth = True
    MarqueeInterval = 0
    SmoothReverse = True
    Step = 1
    TabOrder = 3
  end
  object Edit2: TEdit
    Left = 160
    Top = 48
    Width = 145
    Height = 21
    Enabled = False
    TabOrder = 4
    Text = 'Edit2'
  end
  object Edit3: TEdit
    Left = 8
    Top = 112
    Width = 145
    Height = 21
    Enabled = False
    TabOrder = 5
    Text = 'Edit3'
  end
  object Edit4: TEdit
    Left = 160
    Top = 112
    Width = 145
    Height = 21
    Enabled = False
    TabOrder = 6
    Text = 'Edit4'
  end
  object ProgressBar2: TProgressBar
    Left = 8
    Top = 136
    Width = 297
    Height = 17
    Max = 900
    MarqueeInterval = 0
    TabOrder = 7
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,MSButton2,OnClick,Exit
AddDialogHandler>Dialog1,MSButton1,OnClick,Start
SetDialogProperty>Dialog1,ProgressBar1,Position,0
SetDialogProperty>Dialog1,ProgressBar2,Position,0
SetDialogProperty>Dialog1,Edit1,Text,%10mincal%
SetDialogProperty>Dialog1,Edit2,Text,10
SetDialogProperty>Dialog1,Edit3,Text,%15mincal%
SetDialogProperty>Dialog1,Edit4,Text,15
Show>Dialog1,Dialog1Result

SRT>Start
  Label>D1Start
  GetTime>now
  TimeDiff>10mincal,now,S,10minSec
  TimeDiff>10mincal,now,M,10minMin
  TimeDiff>15mincal,now,S,15minSec
  TimeDiff>15mincal,now,M,15minMin
  Let>Possie10=600-%10minSec%
  Let>Possie15=900-%15minSec%
  SetDialogProperty>Dialog1,ProgressBar1,Position,%Possie10%
  SetDialogProperty>Dialog1,Edit2,Text,%10minMin%
  SetDialogProperty>Dialog1,ProgressBar2,Position,%Possie15%
  SetDialogProperty>Dialog1,Edit4,Text,%15minMin%
    If>%Possie%>600
      Goto>Exit
    Else
    Endif
  Wait>1
  Goto>D1Start
END>Start

SRT>Exit
  Exit>0
END>Exit

Label>Exit
FIREFIGHTER

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

Post by JRL » Thu Jan 31, 2013 5:55 am

...I can't for the life of me work out how to display the time remain on each call in minutes and seconds.
Really not sure what you're looking for, this was the only part that looked like a question so that is what I addressed. Something like this?

Just discovered this won't work approaching midnight. A solution using timer> might be better. But I'd still like to know if this is what you are looking for?

Code: Select all

Let>APP_TITLE=SACFS ECO Timer
Let>MSG_HEIGHT=320
Let>MSG_WIDTH=500
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=1


GetTime>now
TimeAdd>now,M,10,10mincal
TimeAdd>now,M,15,15mincal
TimeAdd>now,M,18,18mincal
TimeAdd>now,M,20,20mincal
TimeAdd>now,M,22,22mincal
TimeAdd>now,M,24,24mincal
//MDL>10 Minutes Remaining:     %10mincal%%CRLF%05 Minutes Remaining:     %15mincal%%CRLF%02 Minutes Remaining:     %18mincal%%CRLF%Time Out:         %20mincal%%CRLF%Extra Two Minutes:         %22mincal%%CRLF%Extra Two Minutes x2:     %24mincal%


GetTime>now
TimeDiff>now,10mincal,S,10numberSec
TimeDiff>now,15mincal,S,15numberSec
//MDL>%numberMins%


Dialog>Dialog1
object Dialog1: TForm
  Left = 247
  Top = 96
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 256
  ClientWidth = 314
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 8
    Top = 8
    Width = 296
    Height = 13
    Caption = 'SACFS Compartment Fire Behaviour Entry Control Officer Timer'
  end
  object Label2: TLabel
    Left = 8
    Top = 32
    Width = 72
    Height = 13
    Caption = '10 Minutes Call'
  end
  object Label3: TLabel
    Left = 160
    Top = 32
    Width = 90
    Height = 13
    Caption = 'Minutes Remaining'
  end
  object Label4: TLabel
    Left = 8
    Top = 96
    Width = 66
    Height = 13
    Caption = '5 Minutes Call'
  end
  object Label5: TLabel
    Left = 160
    Top = 96
    Width = 90
    Height = 13
    Caption = 'Minutes Remaining'
  end
  object Edit1: TEdit
    Left = 8
    Top = 48
    Width = 145
    Height = 21
    Enabled = False
    TabOrder = 0
    Text = 'Edit1'
  end
  object MSButton1: tMSButton
    Left = 8
    Top = 224
    Width = 107
    Height = 25
    Caption = 'Start'
    TabOrder = 1
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 200
    Top = 224
    Width = 107
    Height = 25
    Caption = 'Exit'
    ModalResult = 2
    TabOrder = 2
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object ProgressBar1: TProgressBar
    Left = 8
    Top = 72
    Width = 297
    Height = 17
    Max = 600
    Smooth = True
    MarqueeInterval = 0
    SmoothReverse = True
    Step = 1
    TabOrder = 3
  end
  object Edit2: TEdit
    Left = 160
    Top = 48
    Width = 145
    Height = 21
    Enabled = False
    TabOrder = 4
    Text = 'Edit2'
  end
  object Edit3: TEdit
    Left = 8
    Top = 112
    Width = 145
    Height = 21
    Enabled = False
    TabOrder = 5
    Text = 'Edit3'
  end
  object Edit4: TEdit
    Left = 160
    Top = 112
    Width = 145
    Height = 21
    Enabled = False
    TabOrder = 6
    Text = 'Edit4'
  end
  object ProgressBar2: TProgressBar
    Left = 8
    Top = 136
    Width = 297
    Height = 17
    Max = 900
    MarqueeInterval = 0
    TabOrder = 7
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,,OnClose,Exit
AddDialogHandler>Dialog1,MSButton2,OnClick,Exit
AddDialogHandler>Dialog1,MSButton1,OnClick,Start
SetDialogProperty>Dialog1,ProgressBar1,Position,0
SetDialogProperty>Dialog1,ProgressBar2,Position,0
SetDialogProperty>Dialog1,Edit1,Text,%10mincal%
SetDialogProperty>Dialog1,Edit2,Text,10
SetDialogProperty>Dialog1,Edit3,Text,%15mincal%
SetDialogProperty>Dialog1,Edit4,Text,15
Show>Dialog1,Dialog1Result

SRT>Start


//**BREAKPOINT**

  Label>D1Start
  GetTime>now
  TimeDiff>10mincal,now,S,10minSec
  GoSub>ReportTime,10minSec,10numberSec,Edit2
  //TimeDiff>10mincal,now,M,10minMin
  TimeDiff>15mincal,now,S,15minSec
  GoSub>ReportTime,15minSec,15numberSec,Edit4
  //TimeDiff>15mincal,now,M,15minMin
  Let>Possie10=600-%10minSec%
  Let>Possie15=900-%15minSec%
  SetDialogProperty>Dialog1,ProgressBar1,Position,%Possie10%
  //SetDialogProperty>Dialog1,Edit2,Text,%10minMin%
  SetDialogProperty>Dialog1,ProgressBar2,Position,%Possie15%
  //SetDialogProperty>Dialog1,Edit4,Text,%15minMin%
    If>%Possie%>600
      GoSub>Exit
    Else
    Endif
  Wait>1
  Goto>D1Start
END>Start

SRT>Exit
  Exit>0
END>Exit

Label>Exit

SRT>ReportTime
  Let>TimeLeft={%ReportTime_var_1%-(round(%ReportTime_var_2%/1000))}
  Let>MinutesLeft={trunc(%TimeLeft%/60)}
  Let>SecondsLeft={%TimeLeft%-(%MinutesLeft%*60)}
  SetDialogProperty>Dialog1,%ReportTime_var_3%,Text,%MinutesLeft%:%SecondsLeft%
END>ReportTime

User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Fri Feb 01, 2013 5:01 am

Thanks JRL,

That is pretty much what I am after, just for the other fields as well.

I looked at your code, but I suck at Maths and couldn't work out how you were displaying the time for the required fields.

Here is my updated code with all the required fields I need to have displayed the time remaining for. Would love it if you could update it so I could see what I was missing.

Also when the timer reaches zero / progress bar 100% how can I stop them from updating but also play a wav file (once only).

Code: Select all

// COMPILE_OPTS|\\dhgsf05\usersj$\mallen05\Desktop\SACFS ECO Timer.exe|M:\Icons\CFS.ico|CONSOLE=0|INCLUDES=1| /LOGFILE=\dev\nul /NOSYSTRAY /HIDE|RUNTIMES=1|BMPS=1
Let>APP_TITLE=SACFS ECO Timer
Let>MSG_HEIGHT=320
Let>MSG_WIDTH=500
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=1

//LabelToVar>CFS.LOGO.BMP_DATA,CFSLogo

Dialog>Dialog1
object Dialog1: TForm
  Left = 300
  Top = 224
  HelpContext = 5000
  BorderIcons = [biSystemMenu, biMinimize]
  BorderStyle = bsSingle
  Caption = 'SACFS ECO Timer'
  ClientHeight = 530
  ClientWidth = 339
  Color = clBtnFace
  TransparentColorValue = 1959605
  Font.Charset = ANSI_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Courier New'
  Font.Style = []
  OldCreateOrder = True
  Position = poScreenCenter
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 96
  TextHeight = 14
  object Label1: TLabel
    Left = 8
    Top = 8
    Width = 320
    Height = 36
    Caption = 'SACFS Compartment Fire Behaviour'#13#10'Entry Control Officer Timer'
    Font.Charset = ANSI_CHARSET
    Font.Color = clWindowText
    Font.Height = -16
    Font.Name = 'Courier New'
    Font.Style = []
    ParentFont = False
  end
  object Label2: TLabel
    Left = 8
    Top = 112
    Width = 98
    Height = 14
    Caption = '10 Minute Call'
  end
  object Label3: TLabel
    Left = 176
    Top = 112
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label4: TLabel
    Left = 8
    Top = 176
    Width = 91
    Height = 14
    Caption = '5 Minute Call'
  end
  object Label5: TLabel
    Left = 176
    Top = 176
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label6: TLabel
    Left = 8
    Top = 56
    Width = 84
    Height = 14
    Caption = 'Current Time'
  end
  object Label7: TLabel
    Left = 8
    Top = 240
    Width = 91
    Height = 14
    Caption = '2 Minute Call'
  end
  object Label8: TLabel
    Left = 176
    Top = 240
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label9: TLabel
    Left = 8
    Top = 304
    Width = 91
    Height = 14
    Caption = 'Time Out Call'
  end
  object Label10: TLabel
    Left = 176
    Top = 304
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label11: TLabel
    Left = 8
    Top = 368
    Width = 105
    Height = 14
    Caption = 'Plus 2 Min Call'
  end
  object Label12: TLabel
    Left = 176
    Top = 368
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label13: TLabel
    Left = 8
    Top = 432
    Width = 140
    Height = 14
    Caption = 'Plus 2 Min (x2) Call'
  end
  object Label14: TLabel
    Left = 176
    Top = 432
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object MSImage1: tMSImage
    Left = 248
    Top = 56
    Width = 80
    Height = 49
    Transparent = True
  end
  object Label15: TLabel
    Left = 8
    Top = 494
    Width = 91
    Height = 28
    Caption = 'Written By'#13#10'Michael Allen'
  end
  object Edit1: TEdit
    Left = 8
    Top = 128
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 2
  end
  object MSButton1: tMSButton
    Left = 112
    Top = 496
    Width = 107
    Height = 25
    Caption = 'Start'
    TabOrder = 0
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 224
    Top = 496
    Width = 107
    Height = 25
    Caption = 'Exit'
    ModalResult = 2
    TabOrder = 1
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object ProgressBar1: TProgressBar
    Left = 8
    Top = 152
    Width = 321
    Height = 17
    Max = 600
    Smooth = True
    MarqueeInterval = 0
    SmoothReverse = True
    Step = 1
    TabOrder = 3
  end
  object Edit2: TEdit
    Left = 176
    Top = 128
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 4
  end
  object Edit3: TEdit
    Left = 8
    Top = 192
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 5
  end
  object Edit4: TEdit
    Left = 176
    Top = 192
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 6
  end
  object ProgressBar2: TProgressBar
    Left = 8
    Top = 216
    Width = 321
    Height = 17
    Max = 900
    MarqueeInterval = 0
    TabOrder = 7
  end
  object CurrentTimeDialog: TEdit
    Left = 8
    Top = 73
    Width = 129
    Height = 22
    Enabled = False
    TabOrder = 8
  end
  object Edit5: TEdit
    Left = 8
    Top = 256
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 9
  end
  object Edit6: TEdit
    Left = 176
    Top = 256
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 10
  end
  object ProgressBar3: TProgressBar
    Left = 8
    Top = 280
    Width = 321
    Height = 17
    Max = 900
    MarqueeInterval = 0
    TabOrder = 11
  end
  object Edit7: TEdit
    Left = 8
    Top = 320
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 20
  end
  object Edit8: TEdit
    Left = 176
    Top = 320
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 12
  end
  object ProgressBar4: TProgressBar
    Left = 8
    Top = 344
    Width = 321
    Height = 17
    Max = 900
    MarqueeInterval = 0
    TabOrder = 13
  end
  object Edit9: TEdit
    Left = 8
    Top = 384
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 14
  end
  object Edit10: TEdit
    Left = 176
    Top = 384
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 15
  end
  object ProgressBar5: TProgressBar
    Left = 8
    Top = 408
    Width = 321
    Height = 17
    Max = 900
    MarqueeInterval = 0
    TabOrder = 16
  end
  object Edit11: TEdit
    Left = 8
    Top = 448
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 17
  end
  object Edit12: TEdit
    Left = 176
    Top = 448
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 18
  end
  object ProgressBar6: TProgressBar
    Left = 8
    Top = 472
    Width = 321
    Height = 17
    Max = 900
    MarqueeInterval = 0
    TabOrder = 19
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,,OnClose,Exit
AddDialogHandler>Dialog1,MSButton2,OnClick,Exit
AddDialogHandler>Dialog1,MSButton1,OnClick,Start
SetDialogProperty>Dialog1,ProgressBar1,Position,0
SetDialogProperty>Dialog1,ProgressBar2,Position,0
SetDialogProperty>Dialog1,ProgressBar3,Position,0
SetDialogProperty>Dialog1,ProgressBar4,Position,0
SetDialogProperty>Dialog1,ProgressBar5,Position,0
SetDialogProperty>Dialog1,ProgressBar6,Position,0
SetDialogProperty>Dialog1,MSImage1,BitmapData,%CFSLogo%

Show>Dialog1,Dialog1Result

SRT>Start
GetTime>now
TimeAdd>now,M,10,10mincal
TimeAdd>now,M,15,15mincal
TimeAdd>now,M,18,18mincal
TimeAdd>now,M,20,20mincal
TimeAdd>now,M,22,22mincal
TimeAdd>now,M,24,24mincal
TimeDiff>now,10mincal,S,10numberSec
TimeDiff>now,15mincal,S,15numberSec
SetDialogProperty>Dialog1,MSButton1,Enabled,False
SetDialogProperty>Dialog1,ProgressBar1,Position,0
SetDialogProperty>Dialog1,ProgressBar2,Position,0
SetDialogProperty>Dialog1,ProgressBar3,Position,0
SetDialogProperty>Dialog1,ProgressBar4,Position,0
SetDialogProperty>Dialog1,ProgressBar5,Position,0
SetDialogProperty>Dialog1,ProgressBar6,Position,0
SetDialogProperty>Dialog1,Edit1,Text,%10mincal%
SetDialogProperty>Dialog1,Edit2,Text,10
SetDialogProperty>Dialog1,Edit3,Text,%15mincal%
SetDialogProperty>Dialog1,Edit4,Text,15
SetDialogProperty>Dialog1,Edit5,Text,%18mincal%
SetDialogProperty>Dialog1,Edit6,Text,18
SetDialogProperty>Dialog1,Edit7,Text,%20mincal%
SetDialogProperty>Dialog1,Edit8,Text,20
SetDialogProperty>Dialog1,Edit9,Text,%22mincal%
SetDialogProperty>Dialog1,Edit10,Text,22
SetDialogProperty>Dialog1,Edit11,Text,%24mincal%
SetDialogProperty>Dialog1,Edit12,Text,24
Let>Possie10=0
Let>Possie15=0
Let>Possie18=0
Let>Possie20=0
Let>Possie22=0
Let>Possie24=0

//**BREAKPOINT**

  Label>D1Start
  GetTime>now
  TimeDiff>10mincal,now,S,10minSec
  GoSub>ReportTime,10minSec,10numberSec,Edit2
  TimeDiff>15mincal,now,S,15minSec
  GoSub>ReportTime,15minSec,15numberSec,Edit4
  TimeDiff>18mincal,now,S,18minSec
  GoSub>ReportTime,18minSec,18numberSec,Edit6
  TimeDiff>20mincal,now,S,20minSec
  GoSub>ReportTime,20minSec,20numberSec,Edit8
  TimeDiff>22mincal,now,S,22minSec
  GoSub>ReportTime,22minSec,22numberSec,Edit10
  TimeDiff>24mincal,now,S,24minSec
  GoSub>ReportTime,24minSec,24numberSec,Edit12
  If>Possie10>600
    Let>Possie10=600
  Else
    Let>Possie10=600-%10minSec%
  EndIf
  If>Possie15>900
    Let>Possie15=900
  Else
    Let>Possie15=900-%15minSec%
  EndIf
  If>Possie18>1080
    Let>Possie18=1080
  Else
    Let>Possie18=1080-%18minSec%
  EndIf
  If>Possie20>1080
    Let>Possie20=1200
  Else
    Let>Possie20=1200-%20minSec%
  EndIf
  If>Possie22>1320
    Let>Possie22=1320
  Else
    Let>Possie22=1320-%22minSec%
  EndIf
  If>Possie24>1440
    Let>Possie24=1440
  Else
    Let>Possie24=1440-%24minSec%
  EndIf
  SetDialogProperty>Dialog1,CurrentTimeDialog,Text,%now%
  SetDialogProperty>Dialog1,ProgressBar1,Position,%Possie10%
  SetDialogProperty>Dialog1,ProgressBar2,Position,%Possie15%
  SetDialogProperty>Dialog1,ProgressBar3,Position,%Possie18%
  SetDialogProperty>Dialog1,ProgressBar4,Position,%Possie20%
  SetDialogProperty>Dialog1,ProgressBar5,Position,%Possie22%
  SetDialogProperty>Dialog1,ProgressBar6,Position,%Possie24%
  Wait>1
  Goto>D1Start
END>Start

SRT>Exit
  Exit>0
END>Exit

Label>Exit

SRT>ReportTime
  Let>TimeLeft={%ReportTime_var_1%-(round(%ReportTime_var_2%/1000))}
  Let>MinutesLeft={trunc(%TimeLeft%/60)}
  Let>SecondsLeft={%TimeLeft%-(%MinutesLeft%*60)}
  SetDialogProperty>Dialog1,%ReportTime_var_3%,Text,%MinutesLeft%:%SecondsLeft%
END>ReportTime
FIREFIGHTER

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

Post by JRL » Sat Feb 02, 2013 6:55 am

Try this:

Code: Select all

// COMPILE_OPTS|\\dhgsf05\usersj$\mallen05\Desktop\SACFS ECO Timer.exe|M:\Icons\CFS.ico|CONSOLE=0|INCLUDES=1| /LOGFILE=\dev\nul /NOSYSTRAY /HIDE|RUNTIMES=1|BMPS=1
Let>APP_TITLE=SACFS ECO Timer
Let>MSG_HEIGHT=320
Let>MSG_WIDTH=500
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=1

//LabelToVar>CFS.LOGO.BMP_DATA,CFSLogo

Let>10minSec=60*10
Let>15minSec=60*15
Let>18minSec=60*18
Let>20minSec=60*20
Let>22minSec=60*22
Let>24minSec=60*24

Let>WavFile1=
Let>WavFile2=
Let>WavFile3=
Let>WavFile4=
Let>WavFile5=
Let>WavFile6=

Dialog>Dialog1
object Dialog1: TForm
  Left = 1045
  Top = 137
  HelpContext = 5000
  BorderIcons = [biSystemMenu, biMinimize]
  BorderStyle = bsSingle
  Caption = 'SACFS ECO Timer'
  ClientHeight = 530
  ClientWidth = 339
  Color = clBtnFace
  TransparentColorValue = 1959605
  Font.Charset = ANSI_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Courier New'
  Font.Style = []
  OldCreateOrder = True
  Position = poScreenCenter
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 96
  TextHeight = 14
  object Label1: TLabel
    Left = 8
    Top = 8
    Width = 320
    Height = 36
    Caption = 'SACFS Compartment Fire Behaviour'#13#10'Entry Control Officer Timer'
    Font.Charset = ANSI_CHARSET
    Font.Color = clWindowText
    Font.Height = -16
    Font.Name = 'Courier New'
    Font.Style = []
    ParentFont = False
  end
  object Label2: TLabel
    Left = 8
    Top = 112
    Width = 98
    Height = 14
    Caption = '10 Minute Call'
  end
  object Label3: TLabel
    Left = 176
    Top = 112
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label4: TLabel
    Left = 8
    Top = 176
    Width = 91
    Height = 14
    Caption = '5 Minute Call'
  end
  object Label5: TLabel
    Left = 176
    Top = 176
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label6: TLabel
    Left = 8
    Top = 56
    Width = 84
    Height = 14
    Caption = 'Current Time'
  end
  object Label7: TLabel
    Left = 8
    Top = 240
    Width = 91
    Height = 14
    Caption = '2 Minute Call'
  end
  object Label8: TLabel
    Left = 176
    Top = 240
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label9: TLabel
    Left = 8
    Top = 304
    Width = 91
    Height = 14
    Caption = 'Time Out Call'
  end
  object Label10: TLabel
    Left = 176
    Top = 304
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label11: TLabel
    Left = 8
    Top = 368
    Width = 105
    Height = 14
    Caption = 'Plus 2 Min Call'
  end
  object Label12: TLabel
    Left = 176
    Top = 368
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label13: TLabel
    Left = 8
    Top = 432
    Width = 140
    Height = 14
    Caption = 'Plus 2 Min (x2) Call'
  end
  object Label14: TLabel
    Left = 176
    Top = 432
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object MSImage1: tMSImage
    Left = 248
    Top = 56
    Width = 80
    Height = 49
    Transparent = True
  end
  object Label15: TLabel
    Left = 8
    Top = 494
    Width = 91
    Height = 28
    Caption = 'Written By'#13#10'Michael Allen'
  end
  object Edit1: TEdit
    Left = 8
    Top = 128
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 2
  end
  object MSButton1: tMSButton
    Left = 112
    Top = 496
    Width = 107
    Height = 25
    Caption = 'Start'
    TabOrder = 0
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 224
    Top = 496
    Width = 107
    Height = 25
    Caption = 'Exit'
    ModalResult = 2
    TabOrder = 1
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object ProgressBar1: TProgressBar
    Left = 8
    Top = 152
    Width = 321
    Height = 17
    Max = 600
    Smooth = True
    MarqueeInterval = 0
    SmoothReverse = True
    Step = 1
    TabOrder = 3
  end
  object Edit2: TEdit
    Left = 176
    Top = 128
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 4
  end
  object Edit3: TEdit
    Left = 8
    Top = 192
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 5
  end
  object Edit4: TEdit
    Left = 176
    Top = 192
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 6
  end
  object ProgressBar2: TProgressBar
    Left = 8
    Top = 216
    Width = 321
    Height = 17
    Max = 900
    MarqueeInterval = 0
    TabOrder = 7
  end
  object CurrentTimeDialog: TEdit
    Left = 8
    Top = 73
    Width = 129
    Height = 22
    Enabled = False
    TabOrder = 8
  end
  object Edit5: TEdit
    Left = 8
    Top = 256
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 9
  end
  object Edit6: TEdit
    Left = 176
    Top = 256
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 10
  end
  object ProgressBar3: TProgressBar
    Left = 8
    Top = 280
    Width = 321
    Height = 17
    Max = 1080
    MarqueeInterval = 0
    TabOrder = 11
  end
  object Edit7: TEdit
    Left = 8
    Top = 320
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 20
  end
  object Edit8: TEdit
    Left = 176
    Top = 320
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 12
  end
  object ProgressBar4: TProgressBar
    Left = 8
    Top = 344
    Width = 321
    Height = 17
    Max = 1200
    MarqueeInterval = 0
    TabOrder = 13
  end
  object Edit9: TEdit
    Left = 8
    Top = 384
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 14
  end
  object Edit10: TEdit
    Left = 176
    Top = 384
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 15
  end
  object ProgressBar5: TProgressBar
    Left = 8
    Top = 408
    Width = 321
    Height = 17
    Max = 1320
    MarqueeInterval = 0
    TabOrder = 16
  end
  object Edit11: TEdit
    Left = 8
    Top = 448
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 17
  end
  object Edit12: TEdit
    Left = 176
    Top = 448
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 18
  end
  object ProgressBar6: TProgressBar
    Left = 8
    Top = 472
    Width = 321
    Height = 17
    Max = 1440
    MarqueeInterval = 0
    TabOrder = 19
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,,OnClose,Exit
AddDialogHandler>Dialog1,MSButton2,OnClick,Exit
AddDialogHandler>Dialog1,MSButton1,OnClick,Start
SetDialogProperty>Dialog1,ProgressBar1,Position,0
SetDialogProperty>Dialog1,ProgressBar2,Position,0
SetDialogProperty>Dialog1,ProgressBar3,Position,0
SetDialogProperty>Dialog1,ProgressBar4,Position,0
SetDialogProperty>Dialog1,ProgressBar5,Position,0
SetDialogProperty>Dialog1,ProgressBar6,Position,0
SetDialogProperty>Dialog1,MSImage1,BitmapData,%CFSLogo%

Show>Dialog1,Dialog1Result

SRT>Start
Timer>StartTime
Let>StartTime={(trunc(%StartTime%/1000))}

SetDialogProperty>Dialog1,MSButton1,Enabled,False
SetDialogProperty>Dialog1,ProgressBar1,Position,0
SetDialogProperty>Dialog1,ProgressBar2,Position,0
SetDialogProperty>Dialog1,ProgressBar3,Position,0
SetDialogProperty>Dialog1,ProgressBar4,Position,0
SetDialogProperty>Dialog1,ProgressBar5,Position,0
SetDialogProperty>Dialog1,ProgressBar6,Position,0
SetDialogProperty>Dialog1,Edit1,Text,10:0
SetDialogProperty>Dialog1,Edit2,Text,10
SetDialogProperty>Dialog1,Edit3,Text,15:0
SetDialogProperty>Dialog1,Edit4,Text,15
SetDialogProperty>Dialog1,Edit5,Text,18:0
SetDialogProperty>Dialog1,Edit6,Text,18
SetDialogProperty>Dialog1,Edit7,Text,20:0
SetDialogProperty>Dialog1,Edit8,Text,20
SetDialogProperty>Dialog1,Edit9,Text,22:0
SetDialogProperty>Dialog1,Edit10,Text,22
SetDialogProperty>Dialog1,Edit11,Text,24:0
SetDialogProperty>Dialog1,Edit12,Text,24

Label>D1Start
  Timer>ThisTime
  Let>ThisTime={(trunc(%ThisTime%/1000))}
  Wait>0.01
  GoSub>ReportTime,10minSec,{"Possie10"},Edit2,ProgressBar1,WavFile1
  GoSub>ReportTime,15minSec,{"Possie15"},Edit4,ProgressBar2,WavFile2
  GoSub>ReportTime,18minSec,{"Possie18"},Edit6,ProgressBar3,WavFile3
  GoSub>ReportTime,20minSec,{"Possie20"},Edit8,ProgressBar4,WavFile4
  GoSub>ReportTime,22minSec,{"Possie22"},Edit10,ProgressBar5,WavFile5
  GoSub>ReportTime,24minSec,{"Possie24"},Edit12,ProgressBar6,WavFile6

  SRT>ReportTime
    Let>ElapsedTime=%ThisTime%-%StartTime%
    Let>TimeLeft=%ReportTime_var_1%-%ElapsedTime%
    Let>MinutesLeft={trunc(%TimeLeft%/60)}
    Let>SecondsLeft={%TimeLeft%-(%MinutesLeft%*60)}
    Let>%ReportTime_var_2%=ElapsedTime
    If>%ReportTime_var_2%>%ReportTime_var_1%
      Let>%ReportTime_var_2%=%ReportTime_var_1%
      SetDialogProperty>Dialog1,%ReportTime_var_3%,Text,0:0
      //PlayWav>%ReportTime_var_5%
    Else
      SetDialogProperty>Dialog1,%ReportTime_var_3%,Text,%MinutesLeft%:%SecondsLeft%
      SetDialogProperty>Dialog1,%ReportTime_var_4%,Position,%ReportTime_var_2%
    EndIf
  END>ReportTime
  GetTime>now
  SetDialogProperty>Dialog1,CurrentTimeDialog,Text,%now%
  Goto>D1Start
END>Start

SRT>Exit
  Exit>0
END>Exit





User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Sat Feb 02, 2013 12:05 pm

Image

So Close, Except Now The Time Outs On The Left Only Have 3x Numbers.

They Are Meant To Show What Time Each Of Those Calls Are To Be Announced.
FIREFIGHTER

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

Post by JRL » Sun Feb 03, 2013 8:58 pm

Code: Select all

// COMPILE_OPTS|\\dhgsf05\usersj$\mallen05\Desktop\SACFS ECO Timer.exe|M:\Icons\CFS.ico|CONSOLE=0|INCLUDES=1| /LOGFILE=\dev\nul /NOSYSTRAY /HIDE|RUNTIMES=1|BMPS=1
Let>APP_TITLE=SACFS ECO Timer
Let>MSG_HEIGHT=320
Let>MSG_WIDTH=500
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=1

//LabelToVar>CFS.LOGO.BMP_DATA,CFSLogo

Let>10minSec=60*10
Let>15minSec=60*15
Let>18minSec=60*18
Let>20minSec=60*20
Let>22minSec=60*22
Let>24minSec=60*24

Let>WavFile1=
Let>WavFile2=
Let>WavFile3=
Let>WavFile4=
Let>WavFile5=
Let>WavFile6=

Dialog>Dialog1
object Dialog1: TForm
  Left = 1045
  Top = 137
  HelpContext = 5000
  BorderIcons = [biSystemMenu, biMinimize]
  BorderStyle = bsSingle
  Caption = 'SACFS ECO Timer'
  ClientHeight = 530
  ClientWidth = 339
  Color = clBtnFace
  TransparentColorValue = 1959605
  Font.Charset = ANSI_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Courier New'
  Font.Style = []
  OldCreateOrder = True
  Position = poScreenCenter
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 96
  TextHeight = 14
  object Label1: TLabel
    Left = 8
    Top = 8
    Width = 320
    Height = 36
    Caption = 'SACFS Compartment Fire Behaviour'#13#10'Entry Control Officer Timer'
    Font.Charset = ANSI_CHARSET
    Font.Color = clWindowText
    Font.Height = -16
    Font.Name = 'Courier New'
    Font.Style = []
    ParentFont = False
  end
  object Label2: TLabel
    Left = 8
    Top = 112
    Width = 98
    Height = 14
    Caption = '10 Minute Call'
  end
  object Label3: TLabel
    Left = 176
    Top = 112
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label4: TLabel
    Left = 8
    Top = 176
    Width = 91
    Height = 14
    Caption = '5 Minute Call'
  end
  object Label5: TLabel
    Left = 176
    Top = 176
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label6: TLabel
    Left = 8
    Top = 56
    Width = 84
    Height = 14
    Caption = 'Current Time'
  end
  object Label7: TLabel
    Left = 8
    Top = 240
    Width = 91
    Height = 14
    Caption = '2 Minute Call'
  end
  object Label8: TLabel
    Left = 176
    Top = 240
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label9: TLabel
    Left = 8
    Top = 304
    Width = 91
    Height = 14
    Caption = 'Time Out Call'
  end
  object Label10: TLabel
    Left = 176
    Top = 304
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label11: TLabel
    Left = 8
    Top = 368
    Width = 105
    Height = 14
    Caption = 'Plus 2 Min Call'
  end
  object Label12: TLabel
    Left = 176
    Top = 368
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label13: TLabel
    Left = 8
    Top = 432
    Width = 140
    Height = 14
    Caption = 'Plus 2 Min (x2) Call'
  end
  object Label14: TLabel
    Left = 176
    Top = 432
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object MSImage1: tMSImage
    Left = 248
    Top = 56
    Width = 80
    Height = 49
    Transparent = True
  end
  object Label15: TLabel
    Left = 8
    Top = 494
    Width = 91
    Height = 28
    Caption = 'Written By'#13#10'Michael Allen'
  end
  object Edit1: TEdit
    Left = 8
    Top = 128
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 2
  end
  object MSButton1: tMSButton
    Left = 112
    Top = 496
    Width = 107
    Height = 25
    Caption = 'Start'
    TabOrder = 0
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 224
    Top = 496
    Width = 107
    Height = 25
    Caption = 'Exit'
    ModalResult = 2
    TabOrder = 1
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object ProgressBar1: TProgressBar
    Left = 8
    Top = 152
    Width = 321
    Height = 17
    Max = 600
    Smooth = True
    MarqueeInterval = 0
    SmoothReverse = True
    Step = 1
    TabOrder = 3
  end
  object Edit2: TEdit
    Left = 176
    Top = 128
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 4
  end
  object Edit3: TEdit
    Left = 8
    Top = 192
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 5
  end
  object Edit4: TEdit
    Left = 176
    Top = 192
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 6
  end
  object ProgressBar2: TProgressBar
    Left = 8
    Top = 216
    Width = 321
    Height = 17
    Max = 900
    MarqueeInterval = 0
    TabOrder = 7
  end
  object CurrentTimeDialog: TEdit
    Left = 8
    Top = 73
    Width = 129
    Height = 22
    Enabled = False
    TabOrder = 8
  end
  object Edit5: TEdit
    Left = 8
    Top = 256
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 9
  end
  object Edit6: TEdit
    Left = 176
    Top = 256
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 10
  end
  object ProgressBar3: TProgressBar
    Left = 8
    Top = 280
    Width = 321
    Height = 17
    Max = 1080
    MarqueeInterval = 0
    TabOrder = 11
  end
  object Edit7: TEdit
    Left = 8
    Top = 320
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 20
  end
  object Edit8: TEdit
    Left = 176
    Top = 320
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 12
  end
  object ProgressBar4: TProgressBar
    Left = 8
    Top = 344
    Width = 321
    Height = 17
    Max = 1200
    MarqueeInterval = 0
    TabOrder = 13
  end
  object Edit9: TEdit
    Left = 8
    Top = 384
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 14
  end
  object Edit10: TEdit
    Left = 176
    Top = 384
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 15
  end
  object ProgressBar5: TProgressBar
    Left = 8
    Top = 408
    Width = 321
    Height = 17
    Max = 1320
    MarqueeInterval = 0
    TabOrder = 16
  end
  object Edit11: TEdit
    Left = 8
    Top = 448
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 17
  end
  object Edit12: TEdit
    Left = 176
    Top = 448
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 18
  end
  object ProgressBar6: TProgressBar
    Left = 8
    Top = 472
    Width = 321
    Height = 17
    Max = 1440
    MarqueeInterval = 0
    TabOrder = 19
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,,OnClose,Quit
AddDialogHandler>Dialog1,MSButton2,OnClick,Quit
AddDialogHandler>Dialog1,MSButton1,OnClick,Start
SetDialogProperty>Dialog1,ProgressBar1,Position,0
SetDialogProperty>Dialog1,ProgressBar2,Position,0
SetDialogProperty>Dialog1,ProgressBar3,Position,0
SetDialogProperty>Dialog1,ProgressBar4,Position,0
SetDialogProperty>Dialog1,ProgressBar5,Position,0
SetDialogProperty>Dialog1,ProgressBar6,Position,0
SetDialogProperty>Dialog1,MSImage1,BitmapData,%CFSLogo%

Show>Dialog1,Dialog1Result

SRT>Start
Timer>StartTime
Let>StartTime={(trunc(%StartTime%/1000))}
GetTime>now
SetDialogProperty>Dialog1,CurrentTimeDialog,Text,%now%
TimeAdd>now,M,10,10mincal
TimeAdd>now,M,15,15mincal
TimeAdd>now,M,18,18mincal
TimeAdd>now,M,20,20mincal
TimeAdd>now,M,22,22mincal
TimeAdd>now,M,24,24mincal

SetDialogProperty>Dialog1,MSButton1,Enabled,False
SetDialogProperty>Dialog1,ProgressBar1,Position,0
SetDialogProperty>Dialog1,ProgressBar2,Position,0
SetDialogProperty>Dialog1,ProgressBar3,Position,0
SetDialogProperty>Dialog1,ProgressBar4,Position,0
SetDialogProperty>Dialog1,ProgressBar5,Position,0
SetDialogProperty>Dialog1,ProgressBar6,Position,0
SetDialogProperty>Dialog1,Edit1,Text,10mincal
SetDialogProperty>Dialog1,Edit2,Text,10
SetDialogProperty>Dialog1,Edit3,Text,15mincal
SetDialogProperty>Dialog1,Edit4,Text,15
SetDialogProperty>Dialog1,Edit5,Text,18mincal
SetDialogProperty>Dialog1,Edit6,Text,18
SetDialogProperty>Dialog1,Edit7,Text,20mincal
SetDialogProperty>Dialog1,Edit8,Text,20
SetDialogProperty>Dialog1,Edit9,Text,22mincal
SetDialogProperty>Dialog1,Edit10,Text,22
SetDialogProperty>Dialog1,Edit11,Text,24mincal
SetDialogProperty>Dialog1,Edit12,Text,24

Label>D1Start
  Timer>ThisTime
  Let>ThisTime={(trunc(%ThisTime%/1000))}
  Wait>0.01
  GoSub>ReportTime,10minSec,{"Possie10"},Edit2,ProgressBar1,WavFile1
  GoSub>ReportTime,15minSec,{"Possie15"},Edit4,ProgressBar2,WavFile2
  GoSub>ReportTime,18minSec,{"Possie18"},Edit6,ProgressBar3,WavFile3
  GoSub>ReportTime,20minSec,{"Possie20"},Edit8,ProgressBar4,WavFile4
  GoSub>ReportTime,22minSec,{"Possie22"},Edit10,ProgressBar5,WavFile5
  GoSub>ReportTime,24minSec,{"Possie24"},Edit12,ProgressBar6,WavFile6

  SRT>ReportTime
    Let>ElapsedTime=%ThisTime%-%StartTime%
    Let>TimeLeft=%ReportTime_var_1%-%ElapsedTime%
    Let>MinutesLeft={trunc(%TimeLeft%/60)}
    Let>SecondsLeft={%TimeLeft%-(%MinutesLeft%*60)}
    Let>%ReportTime_var_2%=ElapsedTime
    If>%ReportTime_var_2%>%ReportTime_var_1%
      Let>%ReportTime_var_2%=%ReportTime_var_1%
      SetDialogProperty>Dialog1,%ReportTime_var_3%,Text,0:0
      //PlayWav>%ReportTime_var_5%
    Else
      SetDialogProperty>Dialog1,%ReportTime_var_3%,Text,%MinutesLeft%:%SecondsLeft%
      SetDialogProperty>Dialog1,%ReportTime_var_4%,Position,%ReportTime_var_2%
    EndIf
  END>ReportTime
  GetTime>now
  SetDialogProperty>Dialog1,CurrentTimeDialog,Text,%now%
  Goto>D1Start
END>Start

SRT>Quit
  Exit>0
END>Quit





User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Sun Feb 03, 2013 11:33 pm

Thanks JRL,

That has come along really nicely, can't wait to dissect your script and learn from it.

I did have one cosmetic question though. When counting down the time and it gets to the last 10 seconds it displays it as 7:5 Is there anyway to have it display as 7:05, 7:04, 7:03 etc?

If its to hard that is fine.

Is there any way to stop the animation in the progress bar? I have changed some settings but could get it to stop flashing etc (Windows 7). If I could just have a plain smooth bar without the animation that is awesome. I thought it was to do with the marquee speed which I set to 0.
FIREFIGHTER

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

Post by JRL » Mon Feb 04, 2013 5:58 am

Is there anyway to have it display as 7:05, 7:04, 7:03 etc
A couple of vbeval lines using the "right" function. Would make 7:3 become 07:03. If you don't want two place minutes just take out that vbeval line.
Is there any way to stop the animation in the progress bar?
Probably... but I don't know it.

Code: Select all

// COMPILE_OPTS|\\dhgsf05\usersj$\mallen05\Desktop\SACFS ECO Timer.exe|M:\Icons\CFS.ico|CONSOLE=0|INCLUDES=1| /LOGFILE=\dev\nul /NOSYSTRAY /HIDE|RUNTIMES=1|BMPS=1
VBSTART
VBEND

Let>APP_TITLE=SACFS ECO Timer
Let>MSG_HEIGHT=320
Let>MSG_WIDTH=500
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=1

//LabelToVar>CFS.LOGO.BMP_DATA,CFSLogo

Let>10minSec=60*10
Let>15minSec=60*15
Let>18minSec=60*18
Let>20minSec=60*20
Let>22minSec=60*22
Let>24minSec=60*24

Let>WavFile1=
Let>WavFile2=
Let>WavFile3=
Let>WavFile4=
Let>WavFile5=
Let>WavFile6=

Dialog>Dialog1
object Dialog1: TForm
  Left = 392
  Top = 178
  HelpContext = 5000
  BorderIcons = [biSystemMenu, biMinimize]
  BorderStyle = bsSingle
  Caption = 'SACFS ECO Timer'
  ClientHeight = 530
  ClientWidth = 339
  Color = clBtnFace
  TransparentColorValue = 1959605
  Font.Charset = ANSI_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Courier New'
  Font.Style = []
  OldCreateOrder = True
  Position = poScreenCenter
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 96
  TextHeight = 14
  object Label1: TLabel
    Left = 8
    Top = 8
    Width = 320
    Height = 36
    Caption = 'SACFS Compartment Fire Behaviour'#13#10'Entry Control Officer Timer'
    Font.Charset = ANSI_CHARSET
    Font.Color = clWindowText
    Font.Height = -16
    Font.Name = 'Courier New'
    Font.Style = []
    ParentFont = False
  end
  object Label2: TLabel
    Left = 8
    Top = 112
    Width = 98
    Height = 14
    Caption = '10 Minute Call'
  end
  object Label3: TLabel
    Left = 176
    Top = 112
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label4: TLabel
    Left = 8
    Top = 176
    Width = 91
    Height = 14
    Caption = '5 Minute Call'
  end
  object Label5: TLabel
    Left = 176
    Top = 176
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label6: TLabel
    Left = 8
    Top = 56
    Width = 84
    Height = 14
    Caption = 'Current Time'
  end
  object Label7: TLabel
    Left = 8
    Top = 240
    Width = 91
    Height = 14
    Caption = '2 Minute Call'
  end
  object Label8: TLabel
    Left = 176
    Top = 240
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label9: TLabel
    Left = 8
    Top = 304
    Width = 91
    Height = 14
    Caption = 'Time Out Call'
  end
  object Label10: TLabel
    Left = 176
    Top = 304
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label11: TLabel
    Left = 8
    Top = 368
    Width = 105
    Height = 14
    Caption = 'Plus 2 Min Call'
  end
  object Label12: TLabel
    Left = 176
    Top = 368
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label13: TLabel
    Left = 8
    Top = 432
    Width = 140
    Height = 14
    Caption = 'Plus 2 Min (x2) Call'
  end
  object Label14: TLabel
    Left = 176
    Top = 432
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object MSImage1: tMSImage
    Left = 248
    Top = 56
    Width = 80
    Height = 49
    Transparent = True
  end
  object Label15: TLabel
    Left = 8
    Top = 494
    Width = 91
    Height = 28
    Caption = 'Written By'#13#10'Michael Allen'
  end
  object Edit1: TEdit
    Left = 8
    Top = 128
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 2
  end
  object MSButton1: tMSButton
    Left = 112
    Top = 496
    Width = 107
    Height = 25
    Caption = 'Start'
    TabOrder = 0
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 224
    Top = 496
    Width = 107
    Height = 25
    Caption = 'Exit'
    ModalResult = 2
    TabOrder = 1
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object ProgressBar1: TProgressBar
    Left = 8
    Top = 152
    Width = 321
    Height = 17
    Max = 600
    Smooth = True
    MarqueeInterval = 0
    SmoothReverse = True
    Step = 1
    TabOrder = 3
  end
  object Edit2: TEdit
    Left = 176
    Top = 128
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 4
  end
  object Edit3: TEdit
    Left = 8
    Top = 192
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 5
  end
  object Edit4: TEdit
    Left = 176
    Top = 192
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 6
  end
  object ProgressBar2: TProgressBar
    Left = 8
    Top = 216
    Width = 321
    Height = 17
    Max = 900
    MarqueeInterval = 0
    TabOrder = 7
  end
  object CurrentTimeDialog: TEdit
    Left = 8
    Top = 73
    Width = 129
    Height = 22
    Enabled = False
    TabOrder = 8
  end
  object Edit5: TEdit
    Left = 8
    Top = 256
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 9
  end
  object Edit6: TEdit
    Left = 176
    Top = 256
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 10
  end
  object ProgressBar3: TProgressBar
    Left = 8
    Top = 280
    Width = 321
    Height = 17
    Max = 1080
    MarqueeInterval = 0
    TabOrder = 11
  end
  object Edit7: TEdit
    Left = 8
    Top = 320
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 20
  end
  object Edit8: TEdit
    Left = 176
    Top = 320
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 12
  end
  object ProgressBar4: TProgressBar
    Left = 8
    Top = 344
    Width = 321
    Height = 17
    Max = 1200
    MarqueeInterval = 0
    TabOrder = 13
  end
  object Edit9: TEdit
    Left = 8
    Top = 384
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 14
  end
  object Edit10: TEdit
    Left = 176
    Top = 384
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 15
  end
  object ProgressBar5: TProgressBar
    Left = 8
    Top = 408
    Width = 321
    Height = 17
    Max = 1320
    MarqueeInterval = 0
    TabOrder = 16
  end
  object Edit11: TEdit
    Left = 8
    Top = 448
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 17
  end
  object Edit12: TEdit
    Left = 176
    Top = 448
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 18
  end
  object ProgressBar6: TProgressBar
    Left = 8
    Top = 472
    Width = 321
    Height = 17
    Max = 1440
    MarqueeInterval = 0
    TabOrder = 19
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,,OnClose,Quit
AddDialogHandler>Dialog1,MSButton2,OnClick,Quit
AddDialogHandler>Dialog1,MSButton1,OnClick,Start
SetDialogProperty>Dialog1,ProgressBar1,Position,0
SetDialogProperty>Dialog1,ProgressBar2,Position,0
SetDialogProperty>Dialog1,ProgressBar3,Position,0
SetDialogProperty>Dialog1,ProgressBar4,Position,0
SetDialogProperty>Dialog1,ProgressBar5,Position,0
SetDialogProperty>Dialog1,ProgressBar6,Position,0
SetDialogProperty>Dialog1,MSImage1,BitmapData,%CFSLogo%

Show>Dialog1,Dialog1Result

SRT>Start
Timer>StartTime
Let>StartTime={(trunc(%StartTime%/1000))}
GetTime>now
SetDialogProperty>Dialog1,CurrentTimeDialog,Text,%now%
TimeAdd>now,M,10,10mincal
TimeAdd>now,M,15,15mincal
TimeAdd>now,M,18,18mincal
TimeAdd>now,M,20,20mincal
TimeAdd>now,M,22,22mincal
TimeAdd>now,M,24,24mincal

SetDialogProperty>Dialog1,MSButton1,Enabled,False
SetDialogProperty>Dialog1,ProgressBar1,Position,0
SetDialogProperty>Dialog1,ProgressBar2,Position,0
SetDialogProperty>Dialog1,ProgressBar3,Position,0
SetDialogProperty>Dialog1,ProgressBar4,Position,0
SetDialogProperty>Dialog1,ProgressBar5,Position,0
SetDialogProperty>Dialog1,ProgressBar6,Position,0
SetDialogProperty>Dialog1,Edit1,Text,10mincal
SetDialogProperty>Dialog1,Edit2,Text,10
SetDialogProperty>Dialog1,Edit3,Text,15mincal
SetDialogProperty>Dialog1,Edit4,Text,15
SetDialogProperty>Dialog1,Edit5,Text,18mincal
SetDialogProperty>Dialog1,Edit6,Text,18
SetDialogProperty>Dialog1,Edit7,Text,20mincal
SetDialogProperty>Dialog1,Edit8,Text,20
SetDialogProperty>Dialog1,Edit9,Text,22mincal
SetDialogProperty>Dialog1,Edit10,Text,22
SetDialogProperty>Dialog1,Edit11,Text,24mincal
SetDialogProperty>Dialog1,Edit12,Text,24

Label>D1Start
  Timer>ThisTime
  Let>ThisTime={(trunc(%ThisTime%/1000))}
  Wait>0.01
  GoSub>ReportTime,10minSec,{"Possie10"},Edit2,ProgressBar1,WavFile1
  GoSub>ReportTime,15minSec,{"Possie15"},Edit4,ProgressBar2,WavFile2
  GoSub>ReportTime,18minSec,{"Possie18"},Edit6,ProgressBar3,WavFile3
  GoSub>ReportTime,20minSec,{"Possie20"},Edit8,ProgressBar4,WavFile4
  GoSub>ReportTime,22minSec,{"Possie22"},Edit10,ProgressBar5,WavFile5
  GoSub>ReportTime,24minSec,{"Possie24"},Edit12,ProgressBar6,WavFile6

  SRT>ReportTime
    Let>ElapsedTime=%ThisTime%-%StartTime%
    Let>TimeLeft=%ReportTime_var_1%-%ElapsedTime%
    Let>MinutesLeft={trunc(%TimeLeft%/60)}
    VBeval>Right("0" & "%MinutesLeft%",2),MinutesLeft
    Let>SecondsLeft={%TimeLeft%-(%MinutesLeft%*60)}
    VBeval>Right("0" & "%SecondsLeft%",2),SecondsLeft
    Let>%ReportTime_var_2%=ElapsedTime
    If>%ReportTime_var_2%>%ReportTime_var_1%
      Let>%ReportTime_var_2%=%ReportTime_var_1%
      SetDialogProperty>Dialog1,%ReportTime_var_3%,Text,0:0
      //PlayWav>%ReportTime_var_5%
    Else
      SetDialogProperty>Dialog1,%ReportTime_var_3%,Text,%MinutesLeft%:%SecondsLeft%
      SetDialogProperty>Dialog1,%ReportTime_var_4%,Position,%ReportTime_var_2%
    EndIf
  END>ReportTime
  GetTime>now
  SetDialogProperty>Dialog1,CurrentTimeDialog,Text,%now%
  Goto>D1Start
END>Start

SRT>Quit
  Exit>0
END>Quit





User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Mon Feb 04, 2013 6:51 am

Thanks JRL.

That VBeval works wonders, just displaying the seconds. Looks exactly how I was after it.

I updated Let>WavFile1= etc to include the wav file I want to play and un-commented //PlayWav>%ReportTime_var_5% however when the first timer has finished, it just keeps playing the save wav file over and over and stops the script. Have I done something wrong?
FIREFIGHTER

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

Post by JRL » Mon Feb 04, 2013 2:38 pm

it just keeps playing the same wav file over and over
Oops.

Added three lines after the playwav> function to set the WavFile variable to null after the wavfile has played. This should work as long as the PlayWav function doesn't throw an error when it tries to play nothing. It does not error on my WinXP machine. If for some reason this fails we can instead create a flag system to prevent the wav files from plying more than once. I just couldn't think of a way to do this using three lines or less.

What those three new lines do is strip the sequence number from the Progress bar name then use that number to Let the wavFile variable of that same sequence be set to nothing. Therefore, in the future, if you make changes you need to remember to keep the same sequencing format for progress bars and wavfile names.

Code: Select all

  SRT>ReportTime
    Let>ElapsedTime=%ThisTime%-%StartTime%
    Let>TimeLeft=%ReportTime_var_1%-%ElapsedTime%
    Let>MinutesLeft={trunc(%TimeLeft%/60)}
    VBeval>Right("0" & "%MinutesLeft%",2),MinutesLeft
    Let>SecondsLeft={%TimeLeft%-(%MinutesLeft%*60)}
    VBeval>Right("0" & "%SecondsLeft%",2),SecondsLeft
    Let>%ReportTime_var_2%=ElapsedTime
    If>%ReportTime_var_2%>%ReportTime_var_1%
      Let>%ReportTime_var_2%=%ReportTime_var_1%
      SetDialogProperty>Dialog1,%ReportTime_var_3%,Text,0:0
      PlayWav>%ReportTime_var_5%
      Length>%ReportTime_var_4%,long
      MidStr>ReportTime_var_4%,long,1,wavfilenum
      Let>WavFile%wavfilenum%=
    Else
      SetDialogProperty>Dialog1,%ReportTime_var_3%,Text,%MinutesLeft%:%SecondsLeft%
      SetDialogProperty>Dialog1,%ReportTime_var_4%,Position,%ReportTime_var_2%
    EndIf
  END>ReportTime

User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Tue Feb 05, 2013 12:19 am

Hi JRL,

I Tried That Code You Posted, But It Keeps Playing The Save WAV File Over And Over Until I Quit The Script.
FIREFIGHTER

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

Post by JRL » Tue Feb 05, 2013 4:45 am

Well that's embarrassing. Somehow lost a percent so the value of the variable "wavfilenum" was not getting set properly
MidStr>%ReportTime_var_4%,long,1,wavfilenum

Code: Select all

  SRT>ReportTime
    Let>ElapsedTime=%ThisTime%-%StartTime%
    Let>TimeLeft=%ReportTime_var_1%-%ElapsedTime%
    Let>MinutesLeft={trunc(%TimeLeft%/60)}
    VBeval>Right("0" & "%MinutesLeft%",2),MinutesLeft
    Let>SecondsLeft={%TimeLeft%-(%MinutesLeft%*60)}
    VBeval>Right("0" & "%SecondsLeft%",2),SecondsLeft
    Let>%ReportTime_var_2%=ElapsedTime
    If>%ReportTime_var_2%>%ReportTime_var_1%
      Let>%ReportTime_var_2%=%ReportTime_var_1%
      SetDialogProperty>Dialog1,%ReportTime_var_3%,Text,00:00
      PlayWav>%ReportTime_var_5%
      Length>%ReportTime_var_4%,long
      MidStr>%ReportTime_var_4%,long,1,wavfilenum
      Let>WavFile%wavfilenum%=
    Else
      SetDialogProperty>Dialog1,%ReportTime_var_3%,Text,%MinutesLeft%:%SecondsLeft%
      SetDialogProperty>Dialog1,%ReportTime_var_4%,Position,%ReportTime_var_2%
    EndIf
  END>ReportTime

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Wed Feb 06, 2013 12:29 am

CyberCitizen wrote:
Is there any way to stop the animation in the progress bar? I have changed some settings but could get it to stop flashing etc (Windows 7). If I could just have a plain smooth bar without the animation that is awesome. I thought it was to do with the marquee speed which I set to 0.
Hi Cyber,
I think you have to set the Step of each progressbar to 1.

Code: Select all


Dialog>Dialog1
object Dialog1: TForm
  Left = 390
  Top = 118
  HelpContext = 5000
  BorderIcons = [biSystemMenu, biMinimize]
  BorderStyle = bsSingle
  Caption = 'SACFS ECO Timer'
  ClientHeight = 530
  ClientWidth = 339
  Color = clBtnFace
  TransparentColorValue = 1959605
  Font.Charset = ANSI_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Courier New'
  Font.Style = []
  OldCreateOrder = True
  Position = poScreenCenter
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 96
  TextHeight = 14
  object Label1: TLabel
    Left = 8
    Top = 8
    Width = 320
    Height = 36
    Caption = 'SACFS Compartment Fire Behaviour'#13#10'Entry Control Officer Timer'
    Font.Charset = ANSI_CHARSET
    Font.Color = clWindowText
    Font.Height = -16
    Font.Name = 'Courier New'
    Font.Style = []
    ParentFont = False
  end
  object Label2: TLabel
    Left = 8
    Top = 112
    Width = 98
    Height = 14
    Caption = '10 Minute Call'
  end
  object Label3: TLabel
    Left = 176
    Top = 112
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label4: TLabel
    Left = 8
    Top = 176
    Width = 91
    Height = 14
    Caption = '5 Minute Call'
  end
  object Label5: TLabel
    Left = 176
    Top = 176
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label6: TLabel
    Left = 8
    Top = 56
    Width = 84
    Height = 14
    Caption = 'Current Time'
  end
  object Label7: TLabel
    Left = 8
    Top = 240
    Width = 91
    Height = 14
    Caption = '2 Minute Call'
  end
  object Label8: TLabel
    Left = 176
    Top = 240
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label9: TLabel
    Left = 8
    Top = 304
    Width = 91
    Height = 14
    Caption = 'Time Out Call'
  end
  object Label10: TLabel
    Left = 176
    Top = 304
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label11: TLabel
    Left = 8
    Top = 368
    Width = 105
    Height = 14
    Caption = 'Plus 2 Min Call'
  end
  object Label12: TLabel
    Left = 176
    Top = 368
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label13: TLabel
    Left = 8
    Top = 432
    Width = 140
    Height = 14
    Caption = 'Plus 2 Min (x2) Call'
  end
  object Label14: TLabel
    Left = 176
    Top = 432
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object MSImage1: tMSImage
    Left = 248
    Top = 56
    Width = 80
    Height = 49
    Transparent = True
  end
  object Label15: TLabel
    Left = 8
    Top = 494
    Width = 91
    Height = 28
    Caption = 'Written By'#13#10'Michael Allen'
  end
  object Edit1: TEdit
    Left = 8
    Top = 128
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 2
  end
  object MSButton1: tMSButton
    Left = 112
    Top = 496
    Width = 107
    Height = 25
    Caption = 'Start'
    TabOrder = 0
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 224
    Top = 496
    Width = 107
    Height = 25
    Caption = 'Exit'
    ModalResult = 2
    TabOrder = 1
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object ProgressBar1: TProgressBar
    Left = 8
    Top = 152
    Width = 321
    Height = 17
    Max = 600
    Smooth = True
    MarqueeInterval = 0
    SmoothReverse = True
    Step = 1
    TabOrder = 3
  end
  object Edit2: TEdit
    Left = 176
    Top = 128
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 4
  end
  object Edit3: TEdit
    Left = 8
    Top = 192
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 5
  end
  object Edit4: TEdit
    Left = 176
    Top = 192
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 6
  end
  object ProgressBar2: TProgressBar
    Left = 8
    Top = 216
    Width = 321
    Height = 17
    Max = 900
    MarqueeInterval = 0
    Step = 1
    TabOrder = 7
  end
  object CurrentTimeDialog: TEdit
    Left = 8
    Top = 73
    Width = 129
    Height = 22
    Enabled = False
    TabOrder = 8
  end
  object Edit5: TEdit
    Left = 8
    Top = 256
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 9
  end
  object Edit6: TEdit
    Left = 176
    Top = 256
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 10
  end
  object ProgressBar3: TProgressBar
    Left = 8
    Top = 280
    Width = 321
    Height = 17
    Max = 1080
    MarqueeInterval = 0
    Step = 1
    TabOrder = 11
  end
  object Edit7: TEdit
    Left = 8
    Top = 320
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 20
  end
  object Edit8: TEdit
    Left = 176
    Top = 320
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 12
  end
  object ProgressBar4: TProgressBar
    Left = 8
    Top = 344
    Width = 321
    Height = 17
    Max = 1200
    MarqueeInterval = 0
    Step = 1
    TabOrder = 13
  end
  object Edit9: TEdit
    Left = 8
    Top = 384
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 14
  end
  object Edit10: TEdit
    Left = 176
    Top = 384
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 15
  end
  object ProgressBar5: TProgressBar
    Left = 8
    Top = 408
    Width = 321
    Height = 17
    Max = 1320
    MarqueeInterval = 0
    Step = 1
    TabOrder = 16
  end
  object Edit11: TEdit
    Left = 8
    Top = 448
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 17
  end
  object Edit12: TEdit
    Left = 176
    Top = 448
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 18
  end
  object ProgressBar6: TProgressBar
    Left = 8
    Top = 472
    Width = 321
    Height = 17
    Max = 1440
    MarqueeInterval = 0
    Step = 1
    TabOrder = 19
  end
end
EndDialog>Dialog1


User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Wed Feb 06, 2013 1:20 am

Rain wrote:
CyberCitizen wrote:Is there any way to stop the animation in the progress bar? I have changed some settings but could get it to stop flashing etc (Windows 7). If I could just have a plain smooth bar without the animation that is awesome. I thought it was to do with the marquee speed which I set to 0.
Hi Cyber,
I think you have to set the Step of each progressbar to 1.
Hi Rain,

I Don't Think That's It, I Still Get Animation.

Step = Specifies the amount that Position increases when the StepIt method is called.

The Issue I Have With The Animation Is That Cause There Are 6 Progress Bars, The Animation Gets Out Of Sync While The Script Is Running And As Such The Screen Is Constantly Flashing. Gets Quite Annoying When Watching It.

As For That Change JRL, I Have Tested It And It Has Worked Successfully.

Thank You. Now I Just Need To Capture Some Audio For The Announcements And Its Just About Done. Doing That Later Today. If I Can Stop The Animation On The Bars That Would Be Awesome, Maybe Its Time To Hit Up Marcus For Advice. Thanks For All Your Help Guys.
FIREFIGHTER

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

Post by JRL » Wed Feb 06, 2013 6:38 am

You can draw your own progress bar. No blinking plus you can change colors to any color you like. Also can change colors to indicate progress if you want. This version is green while timing down and turns red when the timer runs out.

Code: Select all

// COMPILE_OPTS|\\dhgsf05\usersj$\mallen05\Desktop\SACFS ECO Timer.exe|M:\Icons\CFS.ico|CONSOLE=0|INCLUDES=1| /LOGFILE=\dev\nul /NOSYSTRAY /HIDE|RUNTIMES=1|BMPS=1
VBSTART
VBEND

Let>APP_TITLE=SACFS ECO Timer
Let>MSG_HEIGHT=320
Let>MSG_WIDTH=500
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=1

//LabelToVar>CFS.LOGO.BMP_DATA,CFSLogo

Let>10minSec=60*10
Let>15minSec=60*15
Let>18minSec=60*18
Let>20minSec=60*20
Let>22minSec=60*22
Let>24minSec=60*24

Let>WavFile1=
Let>WavFile2=
Let>WavFile3=
Let>WavFile4=
Let>WavFile5=
Let>WavFile6=

Dialog>Dialog1
object Dialog1: TForm
  Left = 392
  Top = 178
  HelpContext = 5000
  BorderIcons = [biSystemMenu, biMinimize]
  BorderStyle = bsSingle
  Caption = 'SACFS ECO Timer'
  ClientHeight = 530
  ClientWidth = 339
  Color = clBtnFace
  TransparentColorValue = 1959605
  Font.Charset = ANSI_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Courier New'
  Font.Style = []
  OldCreateOrder = True
  Position = poScreenCenter
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 96
  TextHeight = 14
  object Label1: TLabel
    Left = 8
    Top = 8
    Width = 320
    Height = 36
    Caption = 'SACFS Compartment Fire Behaviour'#13#10'Entry Control Officer Timer'
    Font.Charset = ANSI_CHARSET
    Font.Color = clWindowText
    Font.Height = -16
    Font.Name = 'Courier New'
    Font.Style = []
    ParentFont = False
  end
  object Label2: TLabel
    Left = 8
    Top = 112
    Width = 98
    Height = 14
    Caption = '10 Minute Call'
  end
  object Label3: TLabel
    Left = 176
    Top = 112
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label4: TLabel
    Left = 8
    Top = 176
    Width = 91
    Height = 14
    Caption = '5 Minute Call'
  end
  object Label5: TLabel
    Left = 176
    Top = 176
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label6: TLabel
    Left = 8
    Top = 56
    Width = 84
    Height = 14
    Caption = 'Current Time'
  end
  object Label7: TLabel
    Left = 8
    Top = 240
    Width = 91
    Height = 14
    Caption = '2 Minute Call'
  end
  object Label8: TLabel
    Left = 176
    Top = 240
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label9: TLabel
    Left = 8
    Top = 304
    Width = 91
    Height = 14
    Caption = 'Time Out Call'
  end
  object Label10: TLabel
    Left = 176
    Top = 304
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label11: TLabel
    Left = 8
    Top = 368
    Width = 105
    Height = 14
    Caption = 'Plus 2 Min Call'
  end
  object Label12: TLabel
    Left = 176
    Top = 368
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object Label13: TLabel
    Left = 8
    Top = 432
    Width = 140
    Height = 14
    Caption = 'Plus 2 Min (x2) Call'
  end
  object Label14: TLabel
    Left = 176
    Top = 432
    Width = 98
    Height = 14
    Caption = 'Time Remaining'
  end
  object MSImage1: tMSImage
    Left = 248
    Top = 56
    Width = 80
    Height = 49
    Transparent = True
  end
  object Label15: TLabel
    Left = 8
    Top = 494
    Width = 91
    Height = 28
    Caption = 'Written By'#13#10'Michael Allen'
  end
  object Edit1: TEdit
    Left = 8
    Top = 128
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 2
  end
  object MSButton1: tMSButton
    Left = 112
    Top = 496
    Width = 107
    Height = 25
    Caption = 'Start'
    TabOrder = 0
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 224
    Top = 496
    Width = 107
    Height = 25
    Caption = 'Exit'
    ModalResult = 2
    TabOrder = 1
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object ProgressBar1: TProgressBar
    Left = 8
    Top = 152
    Width = 321
    Height = 17
    Max = 600
    Smooth = True
    MarqueeInterval = 0
    SmoothReverse = True
    Step = 1
    TabOrder = 3
  end
  object Edit2: TEdit
    Left = 176
    Top = 128
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 4
  end
  object Edit3: TEdit
    Left = 8
    Top = 192
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 5
  end
  object Edit4: TEdit
    Left = 176
    Top = 192
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 6
  end
  object ProgressBar2: TProgressBar
    Left = 8
    Top = 216
    Width = 321
    Height = 17
    Max = 900
    MarqueeInterval = 0
    TabOrder = 7
  end
  object CurrentTimeDialog: TEdit
    Left = 8
    Top = 73
    Width = 129
    Height = 22
    Enabled = False
    TabOrder = 8
  end
  object Edit5: TEdit
    Left = 8
    Top = 256
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 9
  end
  object Edit6: TEdit
    Left = 176
    Top = 256
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 10
  end
  object ProgressBar3: TProgressBar
    Left = 8
    Top = 280
    Width = 321
    Height = 17
    Max = 1080
    MarqueeInterval = 0
    TabOrder = 11
  end
  object Edit7: TEdit
    Left = 8
    Top = 320
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 20
  end
  object Edit8: TEdit
    Left = 176
    Top = 320
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 12
  end
  object ProgressBar4: TProgressBar
    Left = 8
    Top = 344
    Width = 321
    Height = 17
    Max = 1200
    MarqueeInterval = 0
    TabOrder = 13
  end
  object Edit9: TEdit
    Left = 8
    Top = 384
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 14
  end
  object Edit10: TEdit
    Left = 176
    Top = 384
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 15
  end
  object ProgressBar5: TProgressBar
    Left = 8
    Top = 408
    Width = 321
    Height = 17
    Max = 1320
    MarqueeInterval = 0
    TabOrder = 16
  end
  object Edit11: TEdit
    Left = 8
    Top = 448
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 17
  end
  object Edit12: TEdit
    Left = 176
    Top = 448
    Width = 153
    Height = 22
    Enabled = False
    TabOrder = 18
  end
  object ProgressBar6: TProgressBar
    Left = 8
    Top = 472
    Width = 321
    Height = 17
    Max = 1440
    MarqueeInterval = 0
    TabOrder = 19
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,,OnClose,Quit
AddDialogHandler>Dialog1,MSButton2,OnClick,Quit
AddDialogHandler>Dialog1,MSButton1,OnClick,Start
SetDialogProperty>Dialog1,ProgressBar1,Position,0
SetDialogProperty>Dialog1,ProgressBar2,Position,0
SetDialogProperty>Dialog1,ProgressBar3,Position,0
SetDialogProperty>Dialog1,ProgressBar4,Position,0
SetDialogProperty>Dialog1,ProgressBar5,Position,0
SetDialogProperty>Dialog1,ProgressBar6,Position,0
SetDialogProperty>Dialog1,MSImage1,BitmapData,%CFSLogo%

Show>Dialog1,Dialog1Result

SRT>Start
Timer>StartTime
Let>StartTime={(trunc(%StartTime%/1000))}
GetTime>now
SetDialogProperty>Dialog1,CurrentTimeDialog,Text,%now%
TimeAdd>now,M,10,10mincal
TimeAdd>now,M,15,15mincal
TimeAdd>now,M,18,18mincal
TimeAdd>now,M,20,20mincal
TimeAdd>now,M,22,22mincal
TimeAdd>now,M,24,24mincal

SetDialogProperty>Dialog1,MSButton1,Enabled,False
/*
SetDialogProperty>Dialog1,ProgressBar1,Position,0
SetDialogProperty>Dialog1,ProgressBar2,Position,0
SetDialogProperty>Dialog1,ProgressBar3,Position,0
SetDialogProperty>Dialog1,ProgressBar4,Position,0
SetDialogProperty>Dialog1,ProgressBar5,Position,0
SetDialogProperty>Dialog1,ProgressBar6,Position,0
*/
SetDialogProperty>Dialog1,Edit1,Text,10mincal
SetDialogProperty>Dialog1,Edit2,Text,10
SetDialogProperty>Dialog1,Edit3,Text,15mincal
SetDialogProperty>Dialog1,Edit4,Text,15
SetDialogProperty>Dialog1,Edit5,Text,18mincal
SetDialogProperty>Dialog1,Edit6,Text,18
SetDialogProperty>Dialog1,Edit7,Text,20mincal
SetDialogProperty>Dialog1,Edit8,Text,20
SetDialogProperty>Dialog1,Edit9,Text,22mincal
SetDialogProperty>Dialog1,Edit10,Text,22
SetDialogProperty>Dialog1,Edit11,Text,24mincal
SetDialogProperty>Dialog1,Edit12,Text,24

Label>D1Start
  Timer>ThisTime
  Let>ThisTime={(trunc(%ThisTime%/1000))}
  Wait>0.01

  GoSub>ReportTime,10minSec,{"Possie10"},Edit2,ProgressBar1,WavFile1
  GoSub>ReportTime,15minSec,{"Possie15"},Edit4,ProgressBar2,WavFile2
  GoSub>ReportTime,18minSec,{"Possie18"},Edit6,ProgressBar3,WavFile3
  GoSub>ReportTime,20minSec,{"Possie20"},Edit8,ProgressBar4,WavFile4
  GoSub>ReportTime,22minSec,{"Possie22"},Edit10,ProgressBar5,WavFile5
  GoSub>ReportTime,24minSec,{"Possie24"},Edit12,ProgressBar6,WavFile6

  SRT>ReportTime
    Let>ElapsedTime=%ThisTime%-%StartTime%
    Let>TimeLeft=%ReportTime_var_1%-%ElapsedTime%
    Let>MinutesLeft={trunc(%TimeLeft%/60)}
    VBeval>Right("0" & "%MinutesLeft%",2),MinutesLeft
    Let>SecondsLeft={%TimeLeft%-(%MinutesLeft%*60)}
    VBeval>Right("0" & "%SecondsLeft%",2),SecondsLeft
    Let>%ReportTime_var_2%=ElapsedTime
    GetDialogProperty>Dialog1,%ReportTime_var_4%,Width,PbarWide
    GetDialogProperty>Dialog1,%ReportTime_var_4%,Height,PbarHigh
    If>{%ElapsedTime%>=%ReportTime_var_1%}
      Let>%ReportTime_var_2%=%ReportTime_var_1%
      SetDialogProperty>Dialog1,%ReportTime_var_3%,Text,00:00
      PlayWav>%ReportTime_var_5%
      Length>%ReportTime_var_4%,long
      MidStr>%ReportTime_var_4%,long,1,wavfilenum
      Let>WavFile%wavfilenum%=
      GoSub>DrawRectangle,Dialog1.%ReportTime_var_4%.handle,17,65656,65656,0,0,%PbarWide%,%PbarHigh%
    Else
      SetDialogProperty>Dialog1,%ReportTime_var_3%,Text,%MinutesLeft%:%SecondsLeft%
      //SetDialogProperty>Dialog1,%ReportTime_var_4%,Position,%ReportTime_var_2%
      If>ElapsedTime=0
        Let>barmove={round(%PbarWide%*(1/%ReportTime_var_1%))}
      Else
        Let>barmove={round(%PbarWide%*(%ElapsedTime%/%ReportTime_var_1%))}
      EndIf
      GoSub>DrawRectangle,Dialog1.%ReportTime_var_4%.handle,17,111111,255,0,0,%barmove%,%PbarHigh%
    EndIf
  END>ReportTime

  GetTime>now
  SetDialogProperty>Dialog1,CurrentTimeDialog,Text,%now%
  Goto>D1Start
END>Start

SRT>Quit
  Exit>0
END>Quit


//DrawRectangle Usage:
//GoSub>DrawRectangle,WindowHandle,PenSize,PenColor,SolidColor,ULXLocation,ULYLocation,LRXLocation,LRYLocation

SRT>DrawRectangle
  LibFunc>user32,GetDC,HDC,%DrawRectangle_var_1%
  LibFunc>gdi32,CreatePen,Penres,0,%DrawRectangle_var_2%,%DrawRectangle_var_3%
  LibFunc>gdi32,SelectObject,SOPres,hdc,Penres
  LibFunc>gdi32,CreateSolidBrush,SBres,%DrawRectangle_var_4%
  LibFunc>gdi32,SelectObject,SOres,hdc,sbres
  LibFunc>gdi32,Rectangle,recres,hdc,%DrawRectangle_var_5%,%DrawRectangle_var_6%,%DrawRectangle_var_7%,%DrawRectangle_var_8%
  LibFunc>gdi32,DeleteObject,DOres,Penres
  LibFunc>gdi32,DeleteObject,DOres,sbres
  LibFunc>user32,ReleaseDC,RDCres,HDC_1,HDC
END>DrawRectangle




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