In the past months my macros12.dat has been overwritten about 3 times now. I believe it has to do with an an exception I sometimes get when running MS, will try to capture screenshots of that. The replaced file has a length of 2 bytes (0xFE, 0xFE). I am Running MS 12 under winXP
It would help if that important file would be backed (a .BAK) up when a new version is written. Especially this file is difficult to reproduce when overwritten, so I think a backup would make sense in this case.
A BAK file of macros.dat would solve my problem
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
A backup of it would certainly be useful. It's now on the list.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Hi Dick99999,
Great idea... I've been burned once or twice by this as well. Perhaps it could work similar to how script files are backed up...
The only worry still might be, if there are only 3 backup files and the macros12.dat file gets corrupted, what if the user doesn't realize it has happened right away? If the user makes three more changes to macros that cause backups of the macros12.dat file to be written (changed hot keys on 3 macros for instance)... then the good copy of the file would be lost... replaced by further backups of the bad file.
This isn't so far fetched... it could easily happen if you have your macros stored in a lot of different folders (called groups on the MS main window) as only the macros of the group you are in are displayed... so if your hot keys and triggers etc. are mostly in other groups, you might not notice they're gone until its too late.
One simple idea might be to increase the number of backup files it cycles through specifically for macros12.dat or even make that number user selectable. If high enough, you would probably notice the problem soon enough so that one of your backups was still good.
Any other thoughts out there on this?
Great idea... I've been burned once or twice by this as well. Perhaps it could work similar to how script files are backed up...
I assume that it would save a backup each and every time any change at all was written to the macros12.dat file.History topic in the Help File wrote:"Added Backup On Save option to Editor. If selected keeps last three backups when saving."
The only worry still might be, if there are only 3 backup files and the macros12.dat file gets corrupted, what if the user doesn't realize it has happened right away? If the user makes three more changes to macros that cause backups of the macros12.dat file to be written (changed hot keys on 3 macros for instance)... then the good copy of the file would be lost... replaced by further backups of the bad file.
This isn't so far fetched... it could easily happen if you have your macros stored in a lot of different folders (called groups on the MS main window) as only the macros of the group you are in are displayed... so if your hot keys and triggers etc. are mostly in other groups, you might not notice they're gone until its too late.
One simple idea might be to increase the number of backup files it cycles through specifically for macros12.dat or even make that number user selectable. If high enough, you would probably notice the problem soon enough so that one of your backups was still good.
Any other thoughts out there on this?
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -

All my scripts (Not my groups) disappeared from the main UI after encountering an AddDialogHandler error and then crash. I checked the macros12.dat and sure enough it was empty. Luckily I had a backup from last week. So, I only had to add a few new scrips to add.
Last week I uprated to Windows 7 Ultimate SP3 and now this happened. I never had any problems like this on my XP Pro SP3 machine and I had countless AddDialogHandler errors and crashes.
I wrote quick and simple script that will backup the macros12.dat file every time it changes if anyone is interested.
There shouldn't be any need to edit it since it retrieves your script location from the registry.
The backups are located in a folder named MacrosDatBackup in your scripts directory. The backups are kept there until you delete them. Of course you can modify the script to your needs.
Last week I uprated to Windows 7 Ultimate SP3 and now this happened. I never had any problems like this on my XP Pro SP3 machine and I had countless AddDialogHandler errors and crashes.
I wrote quick and simple script that will backup the macros12.dat file every time it changes if anyone is interested.
There shouldn't be any need to edit it since it retrieves your script location from the registry.
The backups are located in a folder named MacrosDatBackup in your scripts directory. The backups are kept there until you delete them. Of course you can modify the script to your needs.
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
Left = 570
Top = 137
HelpContext = 5000
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'Macros12.dat Monitor & Backup'
ClientHeight = 69
ClientWidth = 250
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 0
Top = 32
Width = 225
Height = 49
AutoSize = False
WordWrap = True
end
object MSButton1: tMSButton
Left = 0
Top = 0
Width = 250
Height = 25
Align = alTop
Caption = 'Open Backup Folder'
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 0
DoBrowse = False
BrowseStyle = fbOpen
ExplicitWidth = 233
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,,Onclose,Exit
AddDialogHandler>Dialog1,msButton1,OnClick,OpenBackupFolder
Show>Dialog1
RegistryReadKey>HKEY_CURRENT_USER,Software\MJTNET\MSched12,DataDir,MacrosDatDir
FileTime>%MacrosDatDir%\macros12.dat,MacrosDatSavedTime
FileSize>%MacrosDatDir%\macros12.dat,MacrosDatSize
CreateDir>%MacrosDatDir%\MacrosDatBackup
Hour>HH
Min>MM
Sec>SS
Day>DD
Month>MON
Year>YY
GetDate>Date
GetTime>Time
SetDialogProperty>Dialog1,Label1,Caption,Last Backup %Date% %Time% (macros12.dat %MON%%DD%%YY%-%HH%%MM%%SS%.BKM)
CopyFile>%MacrosDatDir%\macros12.dat,%MacrosDatDir%\MacrosDatBackup\macros12.dat %MON%%DD%%YY%-%HH%%MM%%SS%.BKM
Label>BackupLoop
wait>1
FileTime>%MacrosDatDir%\macros12.dat,MacrosDatCurrentTime
If>MacrosDatCurrentTime>MacrosDatSavedTime
Hour>HH
Min>MM
Sec>SS
Day>DD
Month>MON
Year>YY
GetDate>Date
GetTime>Time
SetDialogProperty>Dialog1,Label1,Caption,Last Backup %Date% %Time% (macros12.dat %MON%%DD%%YY%-%HH%%MM%%SS%.BKM)
CopyFile>%MacrosDatDir%\macros12.dat,%MacrosDatDir%\MacrosDatBackup\macros12.dat %MON%%DD%%YY%-%HH%%MM%%SS%.BKM
Let>MacrosDatSavedTime=MacrosDatCurrentTime
Endif
Goto>BackupLoop
SRT>OpenBackupFolder
ExecuteFile>%MacrosDatDir%\MacrosDatBackup
END>OpenBackupFolder
SRT>Exit
Exit>1
END>Exit
Here a couple other ways to monitor the macros12.dat for changes.
This version will only create a backup if either a macro is added or deleted.
This one will only create a backup if the macros12.dat size changed.
This version will only create a backup if either a macro is added or deleted.
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
Left = 570
Top = 137
HelpContext = 5000
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'Macros12.dat Monitor & Backup'
ClientHeight = 69
ClientWidth = 250
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 0
Top = 32
Width = 225
Height = 49
AutoSize = False
WordWrap = True
end
object MSButton1: tMSButton
Left = 0
Top = 0
Width = 250
Height = 25
Align = alTop
Caption = 'Open Backup Folder'
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 0
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,,Onclose,Exit
AddDialogHandler>Dialog1,msButton1,OnClick,OpenBackupFolder
Show>Dialog1
RegistryReadKey>HKEY_CURRENT_USER,Software\MJTNET\MSched12,DataDir,MacrosDatDir
ReadFile>%MacrosDatDir%\macros12.dat,macros
Separate>macros,CRLF,macros_names
Let>TotalMacrosA=%macros_names_count%
CreateDir>%MacrosDatDir%\MacrosDatBackup
Hour>HH
Min>MM
Sec>SS
Day>DD
Month>MON
Year>YY
GetDate>Date
GetTime>Time
SetDialogProperty>Dialog1,Label1,Caption,Last Backup %Date% %Time% (macros12.dat %MON%%DD%%YY%-%HH%%MM%%SS%.BKM)
CopyFile>%MacrosDatDir%\macros12.dat,%MacrosDatDir%\MacrosDatBackup\macros12.dat %MON%%DD%%YY%-%HH%%MM%%SS%.BKM
Label>BackupLoop
wait>1
ReadFile>%MacrosDatDir%\macros12.dat,macros
Separate>macros,CRLF,macros_names
Let>TotalMacrosB=%macros_names_count%
If>TotalMacrosB<>TotalMacrosA
Hour>HH
Min>MM
Sec>SS
Day>DD
Month>MON
Year>YY
GetDate>Date
GetTime>Time
SetDialogProperty>Dialog1,Label1,Caption,Last Backup %Date% %Time% (macros12.dat %MON%%DD%%YY%-%HH%%MM%%SS%.BKM)
CopyFile>%MacrosDatDir%\macros12.dat,%MacrosDatDir%\MacrosDatBackup\macros12.dat %MON%%DD%%YY%-%HH%%MM%%SS%.BKM
Let>TotalMacrosA=TotalMacrosB
Endif
Goto>BackupLoop
SRT>OpenBackupFolder
ExecuteFile>%MacrosDatDir%\MacrosDatBackup
END>OpenBackupFolder
SRT>Exit
Exit>1
END>Exit
This one will only create a backup if the macros12.dat size changed.
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
Left = 570
Top = 137
HelpContext = 5000
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'Macros12.dat Monitor & Backup'
ClientHeight = 69
ClientWidth = 250
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 0
Top = 32
Width = 225
Height = 49
AutoSize = False
WordWrap = True
end
object MSButton1: tMSButton
Left = 0
Top = 0
Width = 250
Height = 25
Align = alTop
Caption = 'Open Backup Folder'
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 0
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,,Onclose,Exit
AddDialogHandler>Dialog1,msButton1,OnClick,OpenBackupFolder
Show>Dialog1
RegistryReadKey>HKEY_CURRENT_USER,Software\MJTNET\MSched12,DataDir,MacrosDatDir
FileSize>%MacrosDatDir%\macros12.dat,MacroDatFileSizeA
CreateDir>%MacrosDatDir%\MacrosDatBackup
Hour>HH
Min>MM
Sec>SS
Day>DD
Month>MON
Year>YY
GetDate>Date
GetTime>Time
SetDialogProperty>Dialog1,Label1,Caption,Last Backup %Date% %Time% (macros12.dat %MON%%DD%%YY%-%HH%%MM%%SS%.BKM)
CopyFile>%MacrosDatDir%\macros12.dat,%MacrosDatDir%\MacrosDatBackup\macros12.dat %MON%%DD%%YY%-%HH%%MM%%SS%.BKM
Label>BackupLoop
wait>1
FileSize>%MacrosDatDir%\macros12.dat,MacroDatFileSizeB
If>MacroDatFileSizeB<>MacroDatFileSizeA
Hour>HH
Min>MM
Sec>SS
Day>DD
Month>MON
Year>YY
GetDate>Date
GetTime>Time
SetDialogProperty>Dialog1,Label1,Caption,Last Backup %Date% %Time% (macros12.dat %MON%%DD%%YY%-%HH%%MM%%SS%.BKM)
CopyFile>%MacrosDatDir%\macros12.dat,%MacrosDatDir%\MacrosDatBackup\macros12.dat %MON%%DD%%YY%-%HH%%MM%%SS%.BKM
Let>MacroDatFileSizeA=MacroDatFileSizeB
Endif
Goto>BackupLoop
SRT>OpenBackupFolder
ExecuteFile>%MacrosDatDir%\MacrosDatBackup
END>OpenBackupFolder
SRT>Exit
Exit>1
END>Exit