Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 18:58 04 Dec 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Script to connect, then set date and time

Author Message
James_From_Canb

Senior Member

Joined: 19/06/2011
Location: Australia
Posts: 265
Posted: 02:08am 19 Jun 2011
Copy link to clipboard 
Print this post

I downloaded the latest version (V4.69) of TeraTerm from Sourceforge. It's powerful.

The script below sets the title of the terminal window, connects to the MaxiMite and sets the date and time. The macro language can also process screen output from the Maximite which looks interesting.

Try this....

Cut and paste the script below to a file called start-mm.ttl.
Change the number of the com port to the one you use.
Save the file to somewhere easily accessible.

Windows 7 is a pain in the proverbial for this sort of thing. I cannot save the macro file in the same directory as the program. It's good security, but difficult for older programs like this. I suggest saving it on a thumb drive, or any drive except C:. I tried my E: drive and I couldn't save it, but I could on my M: drive. Go figure.

Create a new shortcut, or change the Target properties of the Tera Term icon to "C:\Program Files (x86)\teraterm\ttpmacro.exe" "m:\start-mm.ttl"
Note that it's no longer starting Tera Term, it's starting the Tera Term macro program, which starts Tera Term and executes the commands. You'll have to change the drive letter / location of the macro from m:\ to whereever you saved the script.

Now, when you click on the icon, it opens Tera Term and sets the time and date on the Maximite. Neat.

Here's the script:

;; Tera Term Macro
;; ============================================================ ================
;; file start-mm.ttl
;;
;; desc A startup macro for Tera Term, customised for the Maximite
;; ============================================================ ================
;; HISTORY
;;
;; 2011-06-19 James Deakins
;; Original Version
;;
;; BASED ON CODE FROM
;; http://processors.wiki.ti.com/index.php/Teraterm_Scripts
;; ============================================================ ================


;; ============================================================ ================
;; DEFINITIONS
;; ============================================================ ================

;;
;; COM port - >>> you will have to replace the 3 with your com port number <<<
;;

myComPort = "3"

;;
;; Title of the Tera Term Window
;;
StrWindowTitle = 'MaxiMite Terminal'


;;
;; Current Date
;;
getdate CurDate "%d/%m/%Y"


;;
;; Current Time
;;
gettime CurTime "%H:%M:%S"



;; ============================================================ ================
;; CONNECT TO MAXIMITE, NAME TERMINAL WINDOW and UPDATE MAXIMITE DATE and TIME
;; ============================================================ ================

;;
;; Connect
;; -------
myConnectString = "/C="
strconcat myConnectString myComPort
connect myConnectString

;;
;; Set window title
;; ----------------
settitle StrWindowTitle

;;
;; Set the Date
;;
Sendln 'DATE$="'CurDate'"'

;;
;; Set the Time
;; ------------
Sendln 'TIME$="'CurTime'"'M:\
My mind is aglow with whirling, transient nodes of thought careening through a cosmic vapor of invention.

Hedley Lamarr, Blazing Saddles (1974)
 
Gizmo

Admin Group

Joined: 05/06/2004
Location: Australia
Posts: 5078
Posted: 04:15am 19 Jun 2011
Copy link to clipboard 
Print this post

Thats a handy tip James

I'm using TeraTerm to talk to my Maxmite, so will try it out.

Glenn
The best time to plant a tree was twenty years ago, the second best time is right now.
JAQ
 
Ray B
Senior Member

Joined: 16/02/2007
Location: Australia
Posts: 219
Posted: 12:46pm 19 Jun 2011
Copy link to clipboard 
Print this post

Great hint James but the macro has an error that causes the time to not be set when first plugged into USB and run. When I enter 'print time$' the clock is zeroed but 'print date$ 'is OK

If you go into TeraTerm and go Control / Macro then select your macro and open it it comes back with error:
Variable Not Initilized
Sendln 'TIME$='"CurTime""M:\

To fix problem change line to following:
Sendln 'TIME$='"CurTime""

Looks like the M:\ may be a typo or error from your editor

Cheers
RayB from Perth WA
 
James_From_Canb

Senior Member

Joined: 19/06/2011
Location: Australia
Posts: 265
Posted: 01:14pm 19 Jun 2011
Copy link to clipboard 
Print this post

Yep - Agree. That's a typo or cut-and-paste error.
Thanks for pointing that out Ray.
Apologies to everyone who was caught by that.
My mind is aglow with whirling, transient nodes of thought careening through a cosmic vapor of invention.

Hedley Lamarr, Blazing Saddles (1974)
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024