Macro.Dat reader

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Macro.Dat reader

Post by JRL » Fri May 12, 2006 10:35 pm

In response to a post by jpuziano here, I have this script I was working on a while ago (but haven't completed) that reads your macros.dat file. It will show all of the settings for all of your scripts. The not completed part is: if the field name in the dialog is a number, I don't know what that field represents. Specifically: 11, 16, 19, 21 and 23. Also, I've done nothing to comment the script for readability and understanding. As it is, you still might find it useful. In any case I don't believe it can cause any damage. If you have many scripts (I have 434) it may run slowly. Be patient.

Later,
Dick

Edit-1 05/15/2006
I modified the labels to conform with the information in Marcus' post below.

Edit-2 09/22/2006
Reposted with HTML disabled.

Edit-X 09/22/2006
No matter what I disable, this code will not post properly so I removed the text area. If you copy and paste this, copy only the green text and be sure to remove any trailing spaces.



ReadFile>%SCRIPT_DIR%\macros.dat,MacroFile
Separate>MacroFile,%CRLF%,MLine
Let>mk=0
Let>macro_list=
Repeat>mk
Add>mk,1
Let>value=MLine_%mk%
separate>value,",logname
separate>logname_2,:,logvar
If>logvar_count=2
Stringreplace>logname_2,:,;,logname_new
Stringreplace>value,logname_2,logname_new,value
Let>MLine_%mk%=value
EndIF
Separate>value,:,mac_var
Let>mac_name_%mk%=%mac_var_1%
Let>value=mac_name_%mk%
Concat>macro_list,%value%%CRLF%
Until>mk=%MLine_count%

Dialog>Dialog1
Caption=Macro.Dat Reader
Width=507
Height=639
Top=11
Left=481
ComboBox=msComboBox1,32,24,417,%macro_list%
Edit=Edit1,30,81,121,1
Edit=Edit2,180,81,121,2
Edit=Edit3,330,81,121,3
Edit=Edit4,30,131,121,4
Edit=Edit5,180,131,121,5
Edit=Edit6,330,131,121,6
Edit=Edit7,30,181,121,7
Edit=Edit8,180,181,121,8
Edit=Edit9,330,181,121,9
Edit=Edit10,30,231,121,10
Edit=Edit11,180,231,121,11
Edit=Edit12,330,231,121,12
Edit=Edit13,30,281,121,13
Edit=Edit14,180,281,121,14
Edit=Edit15,330,281,121,15
Edit=Edit16,30,331,121,16
Edit=Edit17,180,331,121,17
Edit=Edit18,330,331,121,18
Edit=Edit19,30,381,121,19
Edit=Edit20,180,381,121,20
Edit=Edit21,330,381,121,21
Edit=Edit22,30,431,121,22
Edit=Edit23,180,431,121,23
Edit=Edit24,330,431,121,24
Edit=Edit25,30,481,121,25
Edit=Edit26,180,481,121,26
Edit=Edit27,330,481,121,27
Edit=Edit28,159,560,65,
Label=Select Macro Name,30,5
Label=Macro Name,30,61
Label=Sched. Day,180,61
Label=Sched. Hour,330,61
Label=Sched. Min,30,111
Label=Sched. Repeat Interval,180,111
Label=Sched. Day of Month,330,111
Label=Log File Name,330,161
Label=Encrypted,30,211
Label=Reserved,180,211
Label=Hot Key,330,211
Label=Repeat Reset Hour,30,261
Label=Repeat Reset Minute,180,261
Label=Sched. Recover Option,330,261
Label=Last run date,30,311
Label=Sched. Hour,180,311
Label=Sched. Min,330,311
Label=Schedule Enabled Indicator,30,361
Label=Run When Window Name,180,361
Label=Run when window flag,330,361
Label=Group,30,411
Label=Running indicator,180,411
Label=Quick Launch,330,411
Label=AutoLogon Choices,30,461
Label=AutoLogon Name,180,461
Label=AutoLogon Password,330,461
Label=Log Macro Progress,30,161
Label=Log Clear File,180,161
Label=Line 0 of 0,155,585
Button=Previous,30,528,75,25,4
Button=Next,400,528,75,25,5
Button=Go to Line#,150,528,75,25,3
Button=Quit,288,528,75,25,2
Default=Next
EndDialog>Dialog1

Show>Dialog1
Let>mac_name_test=1
Let>k=0
GetDialogAction>Dialog1,r
GoSub>PageDown
Label>ActionLoop
GetDialogAction>Dialog1,r
Let>sk=0
If>r=2,finish
If>r=3,Update
If>r=4,PageUp
If>r=5,PageDown
Wait>0.01
If>{(%mac_in_use%value=mac_name_%Dialog1.msComboBox1.ItemIndex%
Let>dialog1.edit1=%Dialog1.msComboBox1%
GoSub>Jump
EndIf
Goto>ActionLoop

SRT>Jump
Repeat>sk
add>sk,1
Let>value=MLine_%sk%
Separate>%value%,%dialog1.edit1%,searchval
If>searchval_count>1
Let>k=%sk%-1
Let>sk=%MLine_count%
//Let>Dialog1.edit28=0
Let>value=
GoSub>PageDown
EndIf
Until>sk=%MLine_count%
END>Jump

SRT>Update
Repeat>sk
add>sk,1
Let>value=MLine_%sk%
Separate>%value%,%dialog1.edit1%,searchval
If>searchval_count>1
Let>k=%sk%-1
Let>sk=%MLine_count%
Let>value=
EndIf
Until>sk=%MLine_count%

If>{(%Dialog1.edit28%>0)}
If>%Dialog1.edit28%>%MLine_count%
MDL>Max line number = %MLine_count%
resetdialogaction>dialog1
Else
Let>k=%Dialog1.edit28%-1
GoSub>PageDown
EndIf
EndIf
END>Update

SRT>PageUp
Let>k=%k%-2
GoSub>PageDown
END>PageUp

SRT>PageDown
Let>mac_name_test=1
add>k,1
Let>line=MLine_%k%
Separate>line,:,var_%k%
Let>kk=0
Repeat>kk
add>kk,1
Let>value=var_%k%_%kk%
StringReplace>value,;\,:\,value
Let>Dialog1.edit%kk%=%value%
If>%kk%=1
Let>mac_in_use=%value%
Let>Dialog1.msComboBox1=%value%
Let>Dialog1.msComboBox1.ItemIndex=%k%-1
EndIf
Until>kk=27
Let>Dialog1.msLabel28=Line %k% of %MLine_count%
resetdialogaction>dialog1
END>PageDown

Label>finish
Last edited by JRL on Fri Sep 22, 2006 10:10 pm, edited 7 times in total.

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Fri May 12, 2006 10:49 pm

Hi JRL,

Just wanted to say thanks for that... your contributions to this forum are much appreciated.
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 - :-)

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Macro.Dat reader

Post by Marcus Tettmar » Sat May 13, 2006 9:07 am

JRL wrote:The not completed part is: if the field name in the dialog is a number, I don't know what that field represents. Specifically: 11, 16, 19, 21 and 23.
11: Reserved
16: Last run date
19: Schedule Enabled Indicator (1 yes, 0 no)
21: Run when window flag (H: Hidden, V: Visible)
23: Running indicator (I: Idle, R: Running)

Note that some fields won't change until Macro Scheduler is restarted - this script reads from the data file, whereas Macro Scheduler loads this into memory on startup and works in memory.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Macro.Dat reader

Post by JRL » Mon Dec 28, 2015 9:21 pm

Here's a version that will read MS version 12 or greater.

Code: Select all

ReadFile>%Script_Dir%\macros12.dat,vMacData
DeleteFile>%Script_Dir%\macroschedulerdat.txt
Let>WLN_NOCRLF=1
WriteLn>%Script_Dir%\macroschedulerdat.txt,wres,vMacData
Let>WLN_NOCRLF=0
LabelToVar>FirstNineHotKeys,vHotKeyData
Separate>vHotKeyData,crlf,vHotKeyItem

DeleteFile>%Script_Dir%\schema.ini
LabelToVar>SchemaFile,vSchData
WriteLn>%Script_Dir%\schema.ini,wres,vSchData

Let>connstr=Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%Script_Dir%;Extended Properties="text;HDR=No";
DBConnect>connstr,dbH
Let>qry=Select F1 from macroschedulerdat.txt order by F1
DBQuery>dbH,qry,var,NumOfRecs,NumOfFields
DBClose>dbH

Let>vMacList=
Let>oo=0
Repeat>oo
  Add>oo,1
  Let>value=var_%oo%_1
  Let>vMacList=%vMacList%%value%%crlf%
Until>oo=NumOfRecs

Dialog>Dialog1
object Dialog1: TForm
  Left = 381
  Top = 270
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'Macro.Dat Reader'
  ClientHeight = 537
  ClientWidth = 491
  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 msLabel1: TLabel
    Left = 30
    Top = 5
    Width = 94
    Height = 13
    Caption = 'Select Macro Name'
  end
  object msLabel2: TLabel
    Left = 30
    Top = 61
    Width = 61
    Height = 13
    Caption = 'Macro Name'
  end
  object msLabel3: TLabel
    Left = 180
    Top = 61
    Width = 56
    Height = 13
    Caption = 'Sched. Day'
  end
  object msLabel4: TLabel
    Left = 330
    Top = 61
    Width = 60
    Height = 13
    Caption = 'Sched. Hour'
  end
  object msLabel5: TLabel
    Left = 30
    Top = 111
    Width = 54
    Height = 13
    Caption = 'Sched. Min'
  end
  object msLabel6: TLabel
    Left = 180
    Top = 111
    Width = 110
    Height = 13
    Caption = 'Sched. Repeat Interval'
  end
  object msLabel7: TLabel
    Left = 330
    Top = 111
    Width = 101
    Height = 13
    Caption = 'Sched. Day of Month'
  end
  object msLabel8: TLabel
    Left = 330
    Top = 161
    Width = 68
    Height = 13
    Caption = 'Log File Name'
  end
  object msLabel9: TLabel
    Left = 30
    Top = 211
    Width = 48
    Height = 13
    Caption = 'Encrypted'
  end
  object msLabel10: TLabel
    Left = 180
    Top = 211
    Width = 46
    Height = 13
    Caption = 'Reserved'
  end
  object msLabel11: TLabel
    Left = 330
    Top = 211
    Width = 38
    Height = 13
    Caption = 'Hot Key'
  end
  object msLabel12: TLabel
    Left = 30
    Top = 261
    Width = 92
    Height = 13
    Caption = 'Repeat Reset Hour'
  end
  object msLabel13: TLabel
    Left = 180
    Top = 261
    Width = 101
    Height = 13
    Caption = 'Repeat Reset Minute'
  end
  object msLabel14: TLabel
    Left = 330
    Top = 261
    Width = 112
    Height = 13
    Caption = 'Sched. Recover Option'
  end
  object msLabel15: TLabel
    Left = 30
    Top = 311
    Width = 62
    Height = 13
    Caption = 'Last run date'
  end
  object msLabel16: TLabel
    Left = 180
    Top = 311
    Width = 60
    Height = 13
    Caption = 'Sched. Hour'
  end
  object msLabel17: TLabel
    Left = 330
    Top = 311
    Width = 54
    Height = 13
    Caption = 'Sched. Min'
  end
  object msLabel18: TLabel
    Left = 30
    Top = 361
    Width = 131
    Height = 13
    Caption = 'Schedule Enabled Indicator'
  end
  object msLabel19: TLabel
    Left = 180
    Top = 361
    Width = 125
    Height = 13
    Caption = 'Run When Window Name'
  end
  object msLabel20: TLabel
    Left = 330
    Top = 361
    Width = 108
    Height = 13
    Caption = 'Run when window flag'
  end
  object msLabel21: TLabel
    Left = 30
    Top = 411
    Width = 29
    Height = 13
    Caption = 'Group'
  end
  object msLabel22: TLabel
    Left = 180
    Top = 411
    Width = 83
    Height = 13
    Caption = 'Running indicator'
  end
  object msLabel23: TLabel
    Left = 330
    Top = 411
    Width = 67
    Height = 13
    Caption = 'Quick Launch'
  end
  object msLabel24: TLabel
    Left = 30
    Top = 461
    Width = 93
    Height = 13
    Caption = 'AutoLogon Choices'
  end
  object msLabel25: TLabel
    Left = 180
    Top = 461
    Width = 83
    Height = 13
    Caption = 'AutoLogon Name'
  end
  object msLabel26: TLabel
    Left = 330
    Top = 461
    Width = 101
    Height = 13
    Caption = 'AutoLogon Password'
  end
  object msLabel27: TLabel
    Left = 30
    Top = 161
    Width = 95
    Height = 13
    Caption = 'Log Macro Progress'
  end
  object msLabel28: TLabel
    Left = 180
    Top = 161
    Width = 64
    Height = 13
    Caption = 'Log Clear File'
  end
  object msComboBox1: tMSComboBox
    Left = 32
    Top = 24
    Width = 417
    Height = 21
    TabOrder = 0
    Items.Strings = (
      '%macro_list%')
    ListText = '%macro_list%'#13#10
  end
  object Edit1: TEdit
    Left = 30
    Top = 81
    Width = 121
    Height = 21
    TabOrder = 1
    Text = '1'
  end
  object Edit2: TEdit
    Left = 180
    Top = 81
    Width = 121
    Height = 21
    TabOrder = 2
    Text = '2'
  end
  object Edit3: TEdit
    Left = 330
    Top = 81
    Width = 121
    Height = 21
    TabOrder = 3
    Text = '3'
  end
  object Edit4: TEdit
    Left = 30
    Top = 131
    Width = 121
    Height = 21
    TabOrder = 4
    Text = '4'
  end
  object Edit5: TEdit
    Left = 180
    Top = 131
    Width = 121
    Height = 21
    TabOrder = 5
    Text = '5'
  end
  object Edit6: TEdit
    Left = 330
    Top = 131
    Width = 121
    Height = 21
    TabOrder = 6
    Text = '6'
  end
  object Edit7: TEdit
    Left = 30
    Top = 181
    Width = 121
    Height = 21
    TabOrder = 7
    Text = '7'
  end
  object Edit8: TEdit
    Left = 180
    Top = 181
    Width = 121
    Height = 21
    TabOrder = 8
    Text = '8'
  end
  object Edit9: TEdit
    Left = 330
    Top = 181
    Width = 121
    Height = 21
    TabOrder = 9
    Text = '9'
  end
  object Edit10: TEdit
    Left = 30
    Top = 231
    Width = 121
    Height = 21
    TabOrder = 10
    Text = '10'
  end
  object Edit11: TEdit
    Left = 180
    Top = 231
    Width = 121
    Height = 21
    TabOrder = 11
    Text = '11'
  end
  object Edit12: TEdit
    Left = 330
    Top = 231
    Width = 121
    Height = 21
    TabOrder = 12
    Text = '12'
  end
  object Edit13: TEdit
    Left = 30
    Top = 281
    Width = 121
    Height = 21
    TabOrder = 13
    Text = '13'
  end
  object Edit14: TEdit
    Left = 180
    Top = 281
    Width = 121
    Height = 21
    TabOrder = 14
    Text = '14'
  end
  object Edit15: TEdit
    Left = 330
    Top = 281
    Width = 121
    Height = 21
    TabOrder = 15
    Text = '15'
  end
  object Edit16: TEdit
    Left = 30
    Top = 331
    Width = 121
    Height = 21
    TabOrder = 16
    Text = '16'
  end
  object Edit17: TEdit
    Left = 180
    Top = 331
    Width = 121
    Height = 21
    TabOrder = 18
    Text = '17'
  end
  object Edit18: TEdit
    Left = 330
    Top = 331
    Width = 121
    Height = 21
    TabOrder = 20
    Text = '18'
  end
  object Edit19: TEdit
    Left = 30
    Top = 381
    Width = 121
    Height = 21
    TabOrder = 22
    Text = '19'
  end
  object Edit20: TEdit
    Left = 180
    Top = 381
    Width = 121
    Height = 21
    TabOrder = 23
    Text = '20'
  end
  object Edit21: TEdit
    Left = 330
    Top = 381
    Width = 121
    Height = 21
    TabOrder = 24
    Text = '21'
  end
  object Edit22: TEdit
    Left = 30
    Top = 431
    Width = 121
    Height = 21
    TabOrder = 25
    Text = '22'
  end
  object Edit23: TEdit
    Left = 180
    Top = 431
    Width = 121
    Height = 21
    TabOrder = 26
    Text = '23'
  end
  object Edit24: TEdit
    Left = 330
    Top = 431
    Width = 121
    Height = 21
    TabOrder = 27
    Text = '24'
  end
  object Edit25: TEdit
    Left = 30
    Top = 481
    Width = 121
    Height = 21
    TabOrder = 17
    Text = '25'
  end
  object Edit26: TEdit
    Left = 180
    Top = 481
    Width = 121
    Height = 21
    TabOrder = 19
    Text = '26'
  end
  object Edit27: TEdit
    Left = 330
    Top = 481
    Width = 121
    Height = 21
    TabOrder = 21
    Text = '27'
  end
end
EndDialog>Dialog1
SetDialogProperty>Dialog1,msComboBox1,listtext,vMacList
AddDialogHandler>Dialog1,msComboBox1,OnClick,Populate
Show>Dialog1,
SRT>Populate
  GetDialogProperty>Dialog1,msComboBox1,Text,vMacroToRead
  Let>connstr=Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%Script_Dir%;Extended Properties="text;HDR=No";
  DBConnect>connstr,dbH
  Let>qry=Select * from macroschedulerdat.txt where F1 = '%vMacroToRead%'
  DBQuery>dbH,qry,item,ItemCount,NumFound
  DBClose>dbH
  Let>uu=0
  Repeat>uu
    Add>uu,1
    Let>Value=Item_1_%uu%
    If>{(%uu%=22)and(%value%<>"")}
      ReadIniFile>%script_dir%\groups12.ini,value,Name,Value
    EndIf
    If>{(%uu%=12)and(%value%<>"")}
      MidStr>value,1,3,vVKTest
      If>vVKTest=VK-
        MidStr>value,4,100,value
        Goto>SkiptoUUEnd
      EndIf
      MidStr>value,1,1,vWinAltTest
      If>vWinAltTest=X
        MidStr>value,2,1,vLastChar
        Let>Value=WIN+ALT+%vLastChar%
        Goto>SkiptoUUEnd
      EndIf
      MidStr>value,1,6,vESCTest
      If>vESCTest=ESCAPE
        Goto>SkiptoUUEnd
      EndIf
      MidStr>value,1,2,vNPTest
      If>vNPTest=NP
        Goto>SkiptoUUEnd
      EndIf
      MidStr>value,1,1,vFTest
      If>vFTest=F
        Goto>SkiptoUUEnd
      EndIf
        Length>value,vHKlen
        MidStr>value,vHKLen,1,vLastChar
        Sub>vHKLen,1
        MidStr>value,1,vHKLen,vHKval
      Let>Value=vHotKeyItem_%vHKval%
      Let>Value=%value%+%vLastChar%
    EndIf
    Label>SkiptoUUEnd
    SetDialogProperty>Dialog1,Edit%uu%,Text,Value
  Until>uu=NumFound
END>Populate

/*
SchemaFile:
[macroschedulerdat.txt]
ColNameHeader=False
Format=Delimited(:)
*/
/*
FirstNineHotKeys:
CTRL+ALT
SHIFT+ALT
CTRL+SHIFT
ALT
CTRL
SHIFT
WIN
WIN+CTLR
WIN+SHIFT
*/

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