Updating macros.dat from a script

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
bernie
Junior Coder
Posts: 47
Joined: Sun Sep 22, 2002 4:16 pm
Location: Virginia

Updating macros.dat from a script

Post by bernie » Sun Dec 04, 2005 11:14 pm

I've been working on "Import Macros" a bit [biggest problem: it was hardwired to assume that your macros were stored in the msched install directory]. I have it working, and it looks good... EXCEPT: the macros.dat file keeps getting reset to zero-length.

I put in some Modals and I can see, script by script, that the macros.dat file is getting appropriately updated. But when I click on OK on the "Please restart Macro Scheduler" Modal, macros.dat gets immediately reset to zero-length. In fact, even if I 'exit' msched *without* dismissing the modal, macros.dat gets reset to zero. [BTW this with 7.4.009 on XP/Home].

Is there some trick I can use to get macros.dat to stay updated [and so have Import Macros work again?]. I can always make a copy of macros.dat, update that one, and then in the 'restart msched' modal say "Please rename newmacros.dat to be macros.dat in your mschedl macros directory after you exit msched and before you restart it" but that seems a bit brute-force... I suspect I'm missing something obvious [again]...
/Bernie\

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Dec 19, 2005 2:29 pm

Not quite sure what you are doing here. Why not just use File/Import Macros?
MJT Net Support
[email protected]

bernie
Junior Coder
Posts: 47
Joined: Sun Sep 22, 2002 4:16 pm
Location: Virginia

Post by bernie » Fri Dec 23, 2005 9:30 pm

I wanted to do something a bit fancy, so I thought I'd try modifying the "Import Macros" macro. That macro has code in it to modify macros.dat:

//append the script to macros.dat
Let>macrosdatline=%scriptname%::00:00:0:0:0:0:"":0:::nn:nn:0::00:00:1::H:%new_group%:I
WriteLn>%msched_dir%\macros.dat,r,macrosdatline
Let>i=i+1
Goto>readfiles


And I guess this used to work in older versions of msched [in the pre import-macross-function days] and just doesn't any more. Not a big deal...
I'd just used the import-macros-macro in the past and did so again mostly by habit... [shows you how long it has been since I've had to import any macros, I guess]. The builtin function should do me just fine... Sorry for the bother...
/Bernie\

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts