Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:57 02 Aug 2025 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 : MMEdit Time Set & Run Macro

Author Message
Chopperp

Guru

Joined: 03/01/2018
Location: Australia
Posts: 1097
Posted: 11:43pm 02 Feb 2019
Copy link to clipboard 
Print this post

@TassyJim

Could you please guide or show me how to create a Macro to set the time & date on a CMM, then run the program.

Your Set Time Macro works OK (Top of the list) & I got a RUN macro to go but I would like to combine the two if possible.

I am not a Macro man!!

Thanks

Brian
ChopperP
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 12:14am 03 Feb 2019
Copy link to clipboard 
Print this post

The help file is missing two codes
  Quote  
\d inserts the current date and
\h inserts the current time

this macro:

date$= "\d"\ntime$="\h"\nrun\n

gives:

> date$= "03/02/2019"
> time$="11:01:58"
> run

The quotes are there because MMBasic needs them around the date and time.

some setups might require \r\n instead of just \n
and don't forget the final \n

If you want a ctrl-c first, add \003 to the start although you might need delays. Delays weren't working very well last time I played with them.
Something else I must get back to.

Jim

VK7JH
MMedit
 
Chopperp

Guru

Joined: 03/01/2018
Location: Australia
Posts: 1097
Posted: 01:34am 03 Feb 2019
Copy link to clipboard 
Print this post

Hi Jim

Thanks for that.

Unfortunately I can only get the first part of the macro to work. Date$ or Time$ if I delete the date$ bit etc

Not sure of the format for delay or how to add it. Went silly when I did try some things. (just printed single characters)

Remember, I am not a MACRO man & this is for a CMM.
(Took me ages to work out what a \ntime$ & \nrun was....)

I also don't know what ctrl-c does or why you would need \003

More help needed please.

Brian
ChopperP
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 03:25am 03 Feb 2019
Copy link to clipboard 
Print this post

ctrl-c stops a running program and returns to the command prompt.
ctrl-c is chr$(3)
Because I didn't have an escape sequence for crtl-c, you can use the one for any chr$

MMEdit uses it a lot to make sure the 'mite is at the command prompt.

Try putting everything on one line:
date$ = "\d" : time$ = "\h" : run\n


The spaces are just there for clarity. There do no harm.

There wasn't enough time between commands.
By putting it all on one line (with the :), MMBasic reads the full line then processes each part in turn at it's own pace.

Jim
Edited by TassyJim 2019-02-04
VK7JH
MMedit
 
Chopperp

Guru

Joined: 03/01/2018
Location: Australia
Posts: 1097
Posted: 04:49am 03 Feb 2019
Copy link to clipboard 
Print this post

Thanks very much Jim, that worked.

Makes more sense now. Was getting a tad frustrated.

Brian
ChopperP
 
Chopperp

Guru

Joined: 03/01/2018
Location: Australia
Posts: 1097
Posted: 08:52am 03 Feb 2019
Copy link to clipboard 
Print this post

Hi Jim again.

I had some fun trying to save Macros. The Description would disappear, & also the test Titles kept changing & old test Macros kept reappearing.

Eventually tracked the problem down to a corrupt Macro.inf file. Had about 13-14 entries instead of 10.

Manually editing, saving it & rerunning MM Edit, seemed to fix the problems.

Brian
ChopperP
 
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025