Show specific running time in Powerpoint - powerpoint

I've tried looking this up almost everywhere and still no luck..
I've been able to create a live running clock in PowerPoint but is there a way where I can make it a specific time? Ex. I want the time to start at 2:20:00 PM although that may not be the current time and have it run?
Currently I'm using
Public clock as Boolean
Public currenttime, currentday as string
Sub Pause()
Dim PauseTime, start
PauseTime = 1
start = Timer
Do While Timer < start + PauseTime
DoEvents
Loop
End Sub
Sub StartClock()
clock = Time
Do Until clock = false
On Error Resume Next
currentime = Format ((Now()), "hh:mm:ss AM/PM")
currentime = Mid(currenttime, 1, Len(currenttime) - 3)
ActivePresentation.Slides(SlideShowWindows(1).View.CurrentShowPosition).Shapes("TimeTest").TextFrame.TextRange.Text = currenttime
Pause
Loop
End Sub
Sub OnSlideShowPageChange(ByVal objWindows As SlideShowWindow)
clock = false
ActivePresentation.Slides(SlideShowWindows(1).View.CurrentShowPosition).Shapes("TimeTest").TextFrame.TextRange.Text = "--:--:--"
End Sub
Sub OnSlideShowTerminate()
clock = false
End Sub
I found this on a YouTube video I had watched and it was successful showing the currenttime but now how would I alter it to show a specific time?

This should do it:
Currentime = format("2:20 PM","hh:mm:ss AM/PM")
Use that in place of the existing two Currentime= lines

Related

Disable VB6 Timer during updates

How do I execute my timer1.enabled=true after TreeView FOR statement has reached the last item. My timer starts counting while the treeview is working still.
This is the code I have so far.
Private Sub Command17_Click()
Dim objRootNode As Node
Dim objChildNode As Node
Dim iRootCounter As Integer
Dim iChildCounter As Integer
Dim countt As Integer
Dim ii As Integer
For iRootCounter = 1 To TreeView2.Nodes.Count
ii = TreeView2.Nodes(iRootCounter).Index
Set objRootNode = TreeView2.Nodes(iRootCounter)
If objRootNode.Image = 4 Then
Set objChildNode = objRootNode.Child ' Gets first child
For iChildCounter = 1 To objRootNode.Children
If objChildNode.Image = 3 Then
objRootNode.Image = 9
End If
Set objChildNode = objChildNode.Next ' Get next node
Next
End If
If TreeView2.Nodes(iRootCounter).Index = TreeView2.Nodes.Count - 0 Then
If startt = True Then
Timer1.Enabled = True
Exit For
End If
End If
Next
End Sub
When I run this code, the treeview items remain in processing mode, meaning it's still doing its job changing image index for each item after I run another code, then this button gets triggered.
Just add Timer1.Enabled = False at the beginning of the TreeView update. Then, set it back to True before exiting.
Better yet, stop the timer in the Timer1_Timer event handler:
Private Sub Timer1_Timer()
' Stop timer until all code is execute
Timer1.Enabled = False
Command17_Click
' Restart timer
Timer1.Enabled = True
End Sub

vb6 listbox list timer

i want to iterate listbox list item with Timer1 .
for example, if listbox list item have 'A','B','C'
then i want to make run 'A' then run timer1
and after finish 'B' then run timer1 and so on
maybe this is easy for someone but it not easy for me because Timer1 is continue looping
and it make me some confused.
sorry my bad english and anyone could enlight me i really much appreate!
Private Sub Command1_Click()
For xx = 0 To List3.listcount - 1
Timer1.Enabled = True
Next xx
End Sub
Public Sub Timer1_Timer()
some code....
.
.
End Sub
The Timer1_Timer() event fires every interval of the timer - so your code needs to go in there.
Something like this (untested code):
Private Sub Command1_Click()
Timer1.Enabled = True ' Start the timer
End Sub
Public Sub Timer1_Timer()
Static currentIndex = 0
' Do what you want with List1.List(currentIndex)
currentIndex = currentIndex + 1
If (currentIndex = List1.ListCount) Then
Timer1.Enabled = False ' Stop the timer
End if
End Sub
The Interval property of Timer1 controls how often Timer1_Timer() is called.

VB Microwave oven wrong display

i'm creating a microwave oven app for class. I have the majority of the app working great, the only problem is i'm getting a weird display output, I believe it has to do with my sub string format, but i'm not entirely sure. Basically whats happening is that if the user were to enter say 1:25 cook time, the output reads 1:125 and if start is hit, the microwave only counts down from 1:00. Any help would be greatly appreciated!!
Private Sub DisplayTime()
Dim hour As Integer
Dim second As Integer
Dim minute As Integer
Dim display As String ' String displays current input
' if too much input entered
If timeIs.Length > 5 Then
timeIs = timeIs.Substring(0, 5)
End If
display = timeIs.PadLeft(5, "0"c)
' extract seconds, minutes, and hours
second = Convert.ToInt32(display.Substring(2))
minute = Convert.ToInt32(display.Substring(1, 2))
hour = Convert.ToInt32(display.Substring(0, 1))
' display number of hours, minutes, ":" seconds
displayLabel.Text = String.Format("{0:D1}:{1:D2}:{2:D2}",
hour, minute, second)
End Sub ' DisplayTime
' event handler displays new time each second
Private Sub clockTimer_Tick(sender As System.Object,
e As System.EventArgs) Handles clockTimer.Tick
' perform countdown, subtract one second
If timeObject.Second > 0 Then
timeObject.Second -= 1
displayLabel.Text = String.Format("{0:D1}:{1:D2}:{2:D2}",
timeObject.Hour, timeObject.Minute, timeObject.Second)
ElseIf timeObject.Minute > 0 Then
timeObject.Minute -= 1
timeObject.Second = 59
displayLabel.Text = String.Format("{0:D1}:{1:D2}:{2:D2}",
timeObject.Hour, timeObject.Minute, timeObject.Second)
ElseIf timeObject.Hour > 0 Then
timeObject.Hour -= 1
timeObject.Minute = 59
timeObject.Second = 59
displayLabel.Text = String.Format("{0:D1}:{1:D2}:{2:D2}",
timeObject.Hour, timeObject.Minute, timeObject.Second)
Else ' countdown finished
clockTimer.Enabled = False ' stop timer
Beep()
displayLabel.Text = "Done!" ' inform user time is finished
windowPanel.BackColor = Control.DefaultBackColor
End If
End Sub ' clockTimer_Tick
End Class ' MicrowaveOvenForm
You Substring() for extracting the seconds portion is wrong.
Change:
second = Convert.ToInt32(display.Substring(2))
To:
second = Convert.ToInt32(display.Substring(3, 2))
*Are you required to use "timeObject" though? There are much better ways of keeping a countdown...

vb6 check if multiple timers

In my application I got few timers, timer1 too timer5. timer1 activates timer2 and so on setting the previous timer to false.
so I want to make another timer that follow these, like "timer6"
if timer1.enabled = true then 'then it should check if the timer2 now is enabled
if timer2.enabled = true then 'and so on to it reaches timer5..
Need any example to achieve this because I am at a stop point and basically just need this part to work.
my idea was just to do this in the timer6
if timer1.enabled = true then
if timer2.enabled = true then
if etc etc
else
timer6.enabled = true
timer6.enabled = false
end if
end if
end if
end sub
any ideas how to accomplish this?
So.. I am looking for a way to check all the timers are enabled in one condition and disable the last one.
I am not sure you can check al the timers at once but what you can do is to keep array of all the timers corresponding Boolean field.
array = collection[timerState{timer1,true},timerState{timer2,false}]
Then on each timer enabled/disabled event you keep this state array updated.
and lastly wherever you want you will have the state for all the timers.
have a look at the following test project
click the form to start the first timer, click the button to check which timer is active
'1 form with
' 1 timer : name=Timer1 Index=0
' 1 command button : name=Command1
Option Explicit
Private Sub Form_Load()
Dim intIndex As Integer
Timer1(0).Enabled = False
Timer1(0).Interval = 1000
For intIndex = 1 To 5
Load Timer1(intIndex)
Timer1(intIndex).Interval = intIndex * 1000
Next intIndex
End Sub
Private Sub Form_Click()
Timer1(0).Enabled = True
End Sub
Private Sub Timer1_Timer(Index As Integer)
Print CStr(Now)
Timer1(Index).Enabled = False
If Index < Timer1.Count - 1 Then
Timer1(Index + 1).Enabled = True
Else
Print "done"
End If
End Sub
Private Sub Command1_Click()
Dim intIndex As Integer
For intIndex = 0 To Timer1.Count - 1
If Timer1(intIndex).Enabled Then
Caption = "active timer : " & CStr(intIndex)
Exit For
End If
Next intIndex
End Sub

how to keep changing the background image of mdi form?

I am doing a project in vb6..i want to know how to keeping changing the background image of the MDI for as soon as it is loaded.
i tried to make an array of images and then set the timer
here is my code
Private Sub Timer1_Timer()
For i = 0 To 2
Picture1.Picture = LoadPicture(arr(i))
i = i + 1
If i = 3 Then
i = 0
End If
Next i
End Sub
Private Sub MDIForm_Load()
arr(0) = "images\Shop.jpg"
arr(1) = "images\Display1.jpg"
arr(2) = "images\Display2.jpg"
end sub
please help
thank you
Couple of issues with your code as written. First, you don't need to use a picturebox, the MDI form should have a Picture property you can set directly.
Second, as written you're cycling through all the images in your array each time the timer event fires. What you really want is one change per timer event and store/increment the array index at the end of each timer event, like so:
Private Sub Timer1_Timer()
MDIForm.Picture = LoadPicture(arr(arrIndex))
If arrIndex + 1 <= UBound(arr) Then
arrIndex = arrIndex + 1
Else
arrIndex = 0
End If
End Sub
Dim arrIndex as Integer
Private Sub MDIForm_Load()
arr(0) = "images\Shop.jpg"
arr(1) = "images\Display1.jpg"
arr(2) = "images\Display2.jpg"
arrIndex = 0
end sub
The Dim of arrIndex should be at the top of your MDIForm. This will change the background picture every time the timer event fires.

Resources