Look at this code, please

DeFuN

Usenet Archive
Joined
Aug 5, 2003
Messages
7
Reaction score
0
(defun ACADtime
(setq ti
(menucmd "M=$(edtime,$(getvar,DATE),HH:MM:SS)"))
(setq dt (menucmd "M=$(edtime,$(getvar,DATE),DD/MO/YY)")) (setvar "modemacro" (strcat ti dt )) )
(ACADtime)

The code to show current time at status bar. But only the time when the code loaded displayed.
How to display real-time ?
 
(setvar "MODEMACRO" "$(edtime,$(getvar,DATE),DD/MO/YY)")

review your online documentation
 
For real time, you need to repeatedly execute. You could try using the On Timer (VB), and rebuild the ACADtime function in VB.
Bob
 
Sory for not clear question. I mean : Show a clock on acad status bar (like the clock in windows tray). In oder to I can view CURRENT time when acad is in "Clean Screen mode".

Here is my last code:
(defun clock
(setvar "modemacro"
(strcat
"$(substr,$(getvar,CDATE),10,2)" ":" "$(substr,$(getvar,CDATE),12,2)" " " "$(substr,$(getvar,CDATE),7,2)" "/" "$(substr,$(getvar,CDATE),5,2)" "/" "$(substr,$(getvar,CDATE),1,4 )" " " ) ) )
(clock)

;==============

It only update the current time when I do anything in acad screen ( ex : select object ...) How the time update automaticallly ?
 
I think I understand - you want a 'ticking' clock shown in the Status bar. But, executing the function (once) just shows present time. You will need to call this function (over and over), in order to simulate a real clock. So, you need to have a (program) running inside AutoCAD, that keeps on re-running itself. In Visual Basic, you can set a Timer to time out, display the data, then start to time again for the next cycle. I hope this makes sense. Lisp function just runs (once), unless you manuall call it again or load it again.
Bob
 
Thanks Bob, you know exactly what I want.
But I only know LISP language.
Could you so kind give me the VB routine to do that.
Hope your gift.
Happy holliday :)
 
You can't use the status bar to create a clock, or at least one that is going to tick like a clock. The status line is not updated on a regular basis, only after input is supplied or other user actions performed.

Hence, your clock isn't going to "tick".

What's wrong with showing the time in the task tray?
 
Public Sub Do_Time
Dim PauseTime, Start
On Error Resume Next
PauseTime = 1 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Call Update_Time
Loop
End Sub

Public Sub Update_Time
Dim MyTime
Dim sysVarName As String
Dim sysVarData As Variant

MyTime = Str(Time)
sysVarName = "MODEMACRO"
sysVarData = MyTime
ThisDrawing.SetVariable sysVarName, sysVarData

Call Do_Time ' recursive

End Sub
 
I agree with Toni, probably better to use the Task Tray Timer.
Bob
 

Latest threads

Back
Top