Author Topic: Updating time on the status bar (modemacro command)  (Read 6381 times)

0 Members and 1 Guest are viewing this topic.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Updating time on the status bar (modemacro command)
« on: October 26, 2004, 01:34:33 PM »
I wanted to put an updating time with the date in the status bar using the modemacro command.  I can get it to put the current date by using (getvar "cdate"), although I don't know how to format it.  How could I get it to update the time (if possible)?

daron

  • Guest
Updating time on the status bar (modemacro command)
« Reply #1 on: October 26, 2004, 01:36:30 PM »
look into strcat.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Updating time on the status bar (modemacro command)
« Reply #2 on: October 26, 2004, 01:49:13 PM »
Look up DIESEL.
TheSwamp.org  (serving the CAD community since 2003)

whdjr

  • Guest
Updating time on the status bar (modemacro command)
« Reply #3 on: October 26, 2004, 01:54:43 PM »
How about recursion with a timer?

daron

  • Guest
Updating time on the status bar (modemacro command)
« Reply #4 on: October 26, 2004, 01:55:35 PM »
I wonder if that would begin to slow his computer down.

David Bethel

  • Swamp Rat
  • Posts: 656
Updating time on the status bar (modemacro command)
« Reply #5 on: October 26, 2004, 01:58:20 PM »
Here's some code from 1992-94.  I've used it faithfully for a long time.  I did however comment out the time date stuff as I thought a bit superfluous 'cause I have a clock on my desk.



Code: [Select]

;LDTOPS.LSP
;10/20/92  - Patrick Murphy, Applied Computing Services.
;12/08/94  - Corrected the date endings, finally.
;            Filename added to status line.
;Added C:RDA command as a bonus program, at bottom of file.

;Program to set MODEMACRO to show:
;the current Layer, DrawingName, Date, Time, Tablet, Ortho, Pspace and Snap.
;
;E.G.:  TEXT     C:\ACAD\DWGNAME Tue Oct 20th 7:35p   T Ortho P Snap
;
;I modified the MODE1.LSP file found in on page 120 and code on page 126
;of the AutoCAD R12 Customization Manual to arrive at this.
;
;Have this code loaded by the ACAD.LSP file and run with S::STARTUP.
;Once run, you can have it set to NIL later in S::STARTUP and free up
;a little memory.
;i.e. in your ACAD.LSP file:
;  (load "ldtops")     ;When ACAD.LSP loads, so would LDTOPS.LSP
;  ;if there isn't an S:STARTUP function already, you could use this:
;  (defun S::STARTUP ()
;   (ldtops)          ;this would run LDTOPS
;   (setq ldtops nil) ;this would free up a little memory -
;  )                  ;because MODEMACRO would already be set.
;

;----------------------------------------------------------------(ldtops)
(defun ldtops (/ daysfx dtst)
 (setvar "CMDECHO" 0)
 (setq daysfx (substr (rtos (getvar "CDATE") 2 4) 7 2)
  dtst daysfx
  daysfx      
 (cond
  ((= "11" daysfx) "th");determine the day suffix
  ((= "12" daysfx) "th")
  ((= "13" daysfx) "th")
  ((= "21" daysfx) "st")
  ((= "22" daysfx) "nd")
  ((= "23" daysfx) "rd")
  ((= "31" daysfx) "st")
  ((= "01" daysfx) "st")
  ((= "02" daysfx) "nd")
  ((= "03" daysfx) "rd")
  (T "th")))
  (setvar "modemacro"
   (strcat
   "$(substr,$(getvar,clayer),1,8)"
   "$(substr,        ,1,$(-,8,$(strlen,$(getvar,clayer)))) "
   "$(getvar,dwgname)"
 ;   "$(edtime,$(getvar,date), "
 ;  " "                         ;Had to call EDTIME twice because
 ;  "DDD MON D)"                ;I wanted the suffix for the day
 ;  daysfx                      ;(i.e. 'st') and if EDTIME was only
 ;  "$(edtime,$(getvar,date), " ;called once the suffix became one
 ;  "H:MMam/pm)"                ;of the EDTIME parameters, rather
   "  "                        ;than text on the status line.
 ;  "$(if,$(getvar,tabmode), T, )"
   "$(if,$(and,$(=,$(getvar,tilemode),0),$(=,$(getvar,cvport),1)), P, M)"
   "$(if,$(getvar,orthomode), Ortho, )"
   "$(if,$(getvar,snapmode), Snap)"
   " "
   "$(getvar,cmdnames)"
    " "))
 (setvar "CMDECHO" 0)
 (princ)
);defun LDTOPS




-David
R12 Dos - A2K

whdjr

  • Guest
Updating time on the status bar (modemacro command)
« Reply #6 on: October 26, 2004, 01:58:42 PM »
It would probably be like a memory leak.
 :twisted:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Updating time on the status bar (modemacro command)
« Reply #7 on: October 26, 2004, 03:12:42 PM »
Observation
Code: [Select]
 ((= "11" daysfx) "th");determine the day suffix
  ((= "12" daysfx) "th")
  ((= "13" daysfx) "th")

Are not needed
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Updating time on the status bar (modemacro command)
« Reply #8 on: October 26, 2004, 03:32:46 PM »
You can readily do this in VBA if you would like I can post the entire code to do such a thing. I can also compile it into an executable that you run after you start AutoCAD and it will run in the background updating the time as needed... but it would be a lot more coding to make happen.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Updating time on the status bar (modemacro command)
« Reply #9 on: October 26, 2004, 03:48:18 PM »
Thank you all for replies and suggestions...I think I'll just have it put our company name and the date...no time...I'll look up how to format the date and see if I can get it to work.  Thanks again! :twisted:

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Updating time on the status bar (modemacro command)
« Reply #10 on: October 26, 2004, 04:10:26 PM »
I have code to change the AutoCAD window name (not just the status bar) to whatever you want. You can put your company name there of you want.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Updating time on the status bar (modemacro command)
« Reply #11 on: October 26, 2004, 06:02:54 PM »
Quote from: Keith
I have code to change the AutoCAD window name (not just the status bar) to whatever you want. You can put your company name there of you want.


Ooh...me like!...gimme! gimme! gimme! :twisted:

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Updating time on the status bar (modemacro command)
« Reply #12 on: October 26, 2004, 08:23:53 PM »
Ok ... this is a VBA app so ....
In a new module paste the following code
Code: [Select]

Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal HWND As Long, ByVal lpString As String) As Long

Sub SetText()
 Dim RetVal As Long
 RetVal = SetWindowText(Application.HWND, Interaction.InputBox("Please enter new name for AutoCAD application"))
End Sub


When you run the code it will request a new name which you can type in, then it will change the name to what you entered.

If you want to make it set to a preset value, simply remove this portion
Code: [Select]

Interaction.InputBox("Please enter new name for AutoCAD application")

and replace it with a string enclosed in quotes.. like so...
Code: [Select]

Sub SetText()
 Dim RetVal As Long
 RetVal = SetWindowText(Application.HWND, "Dommy2HottyCAD"))
End Sub
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Updating time on the status bar (modemacro command)
« Reply #13 on: November 08, 2004, 06:03:43 PM »
Thanks Keith...works like a charm!

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Updating time on the status bar (modemacro command)
« Reply #14 on: November 09, 2004, 08:36:35 AM »
Glad you like ... I also have one to change the Icon ...
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

ImaJayhawk

  • Guest
Updating time on the status bar (modemacro command)
« Reply #15 on: December 23, 2004, 10:36:21 AM »
Quote from: Keith
Ok ... this is a VBA app so ....
In a new module paste the following code
Code: [Select]

Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal HWND As Long, ByVal lpString As String) As Long

Sub SetText()
 Dim RetVal As Long
 RetVal = SetWindowText(Application.HWND, Interaction.InputBox("Please enter new name for AutoCAD application"))
End Sub


When you run the code it will request a new name which you can type in, then it will change the name to what you entered.

If you want to make it set to a preset value, simply remove this portion
Code: [Select]

Interaction.InputBox("Please enter new name for AutoCAD application")

and replace it with a string enclosed in quotes.. like so...
Code: [Select]

Sub SetText()
 Dim RetVal As Long
 RetVal = SetWindowText(Application.HWND, "Dommy2HottyCAD"))
End Sub


What do I need to change to get this to work on ACAD 2002?  Thanks.



--ImaJayhawk