summaryrefslogtreecommitdiff
path: root/plugins/ExternalAPI/delphi/m_actman.inc
blob: 93757ee4e2d70a27e8dd079dd502083d81389bc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
{$IFNDEF M_ACTMAN}
{$DEFINE M_ACTMAN}

const
  AutoStartName:PWideChar = '#Autostart';

//----- Macro executing services -----
  
const
  {
    wParam - id: dword
    lParam - parameter
  }
  MS_ACT_RUNBYID  :PAnsiChar = 'Actions/RunById';

  {
    wParam - unicode macro name
    lParam - parameter
  }
  MS_ACT_RUNBYNAME:PAnsiChar = 'Actions/RunByName';

const
  ACTP_BYNAME     =  1; // id points on unicode name
  ACTP_WAIT       =  2; // waiting for macro finish
  ACTP_NOTIFY     =  4; // notify (raise event) for start/finish macro
  ACTP_SAMETHREAD =  8; // execute macro in same thread (with finish waiting)
  ACTP_KEEPRESULT = 16; // (internal) keep last result
type
  pAct_Param = ^tAct_Param;
  tAct_Param = record
    Id    :uint_ptr; // Id or name
    wParam:WPARAM;
    lParam:LPARAM;
    flags :dword; // ACTP_*
    lPType:dword; // last result (in lParam) type
  end;

const
  { Starts macro with 2 parameters
    wParam: 0
    lParam: pointer to TAct_Param
  }
  MS_ACT_RUNPARAMS:PAnsiChar = 'Actions/RunWithParams';

//----- Macro list operations -----

const
  // Get list service (full share)
  ACCF_EXPORT = $08000000;   // action to export (UA export)
  ACCF_IMPORT = ACCF_EXPORT; // (UA import)

type
  pChain = ^tChain;
  tChain = record
    descr:PWideChar;
    id   :dword;
    flags:dword; // ACCF_* flags ?? right now - just selection/overload
    order:dword; // ??
  end;

const
  {
    wParam - 0
    lParam - address of destination list variable (address of pointer to tChain)
             if lParam=0, return just count of elements
    Return - count of elements
    Notes: first 4 bytes = size of TChain structure (to add new fields in future)
  }
  MS_ACT_GETLIST:PAnsiChar = 'Actions/GetList';
  {
    wParam - 0
    lParam - list address (pointer to data returned by MS_ACT_GETLIST)
  }
  MS_ACT_FREELIST:PAnsiChar = 'Actions/FreeList';

const
  ACTM_NEW    = $00000001; // new macros was added
  ACTM_DELETE = $00000002; // some macros was deleted
  ACTM_RENAME = $00000008; // possible, some macro names was changed
  ACTM_SORT   = $00000010; // possible, macro order in list was changed
  ACTM_LOADED = $80000000; // All macros loaded and ready to work (at plugin start)

  {
    Event: action group list was changed: some was added or deleted
    wParam - set of ACTM_* flags
    lParam - 0
  }
  ME_ACT_CHANGED:PAnsiChar = 'Actions/Changed';

  ACIO_EXPORT   = $00000001; // export, else - import
  ACIO_APPEND   = $00000002; // append file on export
  ACIO_ASKEXIST = $00000004; // ask, if action exists on import
  ACIO_SELECTED = $00000008; // export selected actions only

  {
    wParam - ACIO_* flags
    lParam - Unicode file name
    Return - true, if totally succesful 
  }
  MS_ACT_INOUT:PAnsiChar = 'Actions/ImpExp';

  {
    Event: Export actions
    wParam - ACIO_* flags
    lParam - unicode filename
  }
  ME_ACT_INOUT:PAnsiChar = 'Actions/InOut';

  {
    Select/unselect specified action
    wParam - mask (bit 0 = ID if set/name; bit 1 = clear if set/set; bit 2 = get if set/set)
    lParam - unicode action name / number
    Return - 0 if unsuccesful
  }
  MS_ACT_SELECT:PAnsiChar = 'Actions/Select';

  {
    Event: Action started/finished
    wParam - Action status: 0 - started, 1 - finished
    lParam - action id
  }
  ME_ACT_ACTION:PAnsiChar = 'Actions/Action';

//----- Scheduling part services -----

const
  {
    Enable or disable tasks
    wParam - 1/0 (enable/disable)
    lParam - unicode task name
    Note - works for all tasks with same started name
  }
  MS_ACT_TASKENABLE:PAnsiChar = 'Actions/TaskEnable';

  {
    Delete task
    wParam - 0
    lParam - unicode task name
    Note - works for all tasks with same started name
  }
  MS_ACT_TASKDELETE:PAnsiChar = 'Actions/TaskDelete';

  {
    Set task repeat count
    wParam - repeat count
    lParam - unicode task name
    Return - old repeat count value
    Note - works for all tasks with same started name. Returns old counter of last found task
  }
  MS_ACT_TASKCOUNT:PAnsiChar = 'Actions/TaskCount';

  {
    Event for task start
    wParam - counter of call (from 0 to repeat count)
    lParam - unicode task name
  }
  ME_ACT_BELL:PAnsiChar = 'Actions/Bell';

{$ENDIF}