1 | # main topics: |
---|
2 | UP arb.hlp |
---|
3 | UP glossary.hlp |
---|
4 | |
---|
5 | # sub topics: |
---|
6 | #SUB subtopic.hlp |
---|
7 | |
---|
8 | # format described in ../help.readme |
---|
9 | |
---|
10 | |
---|
11 | TITLE Macros |
---|
12 | |
---|
13 | OCCURRENCE ARB_NT |
---|
14 | |
---|
15 | DESCRIPTION Macros are used to combine a set of menu-actions. They work like |
---|
16 | a tape recorder, which records all buttons presses, every input |
---|
17 | to data fields, ... |
---|
18 | |
---|
19 | To record a new macro, go to the directory where the new macro |
---|
20 | should be placed, enter a macro name and press <RECORD>. The |
---|
21 | button label will switch to <STOP>. |
---|
22 | |
---|
23 | Now perform all actions you like to record, then press <STOP>. |
---|
24 | |
---|
25 | If you like to expand an existing macro, check the 'Expand?' toggle |
---|
26 | before pressing <RECORD>. You can also check the 'Run before?' toggle |
---|
27 | to execute the existing macro before expanding it. |
---|
28 | |
---|
29 | Press 'Interrupt' while recording, |
---|
30 | to plan a later interruption during playback. |
---|
31 | See LINK{macro_interruption.hlp} for details. |
---|
32 | |
---|
33 | To execute an existing macro, select the macro and press <EXECUTE>. |
---|
34 | |
---|
35 | Press <Execute with each marked species> to execute the selected macro |
---|
36 | multiple times: once for each marked species. |
---|
37 | |
---|
38 | * this loop is performed in database order (see LINK{sp_sort_fld.hlp}). |
---|
39 | * before each call of the macro, one species will be marked AND |
---|
40 | selected - all other species will be unmarked. |
---|
41 | * afterwards the original species marks will be restored. |
---|
42 | |
---|
43 | Press <EDIT> to edit the selected macro. |
---|
44 | |
---|
45 | Press <DELETE> to delete the selected macro. |
---|
46 | |
---|
47 | SECTION What gets recorded? |
---|
48 | |
---|
49 | The macro recorder only records elements like buttons, menues and |
---|
50 | values (like input fields, radio buttons, selection lists, toggles, ...). |
---|
51 | Actions in the main area (e.g. tree view) will not be recorded! |
---|
52 | |
---|
53 | Elements of a window are unknown to the macro playback if the window was not |
---|
54 | opened before. So - if you just record some changes and clicks in an already |
---|
55 | open window, you need to open that window everytime before you run that macro. |
---|
56 | |
---|
57 | Best practice is to CLOSE ALL SUBWINDOWS before you start recording a macro, then |
---|
58 | open them (again) and then perform your clicks. In that case your macro will run |
---|
59 | regardless whether the window has been opened before or not. |
---|
60 | Note: You can also record "closing a window". |
---|
61 | |
---|
62 | If you want to make sure that some field or toggle is set to a specific value |
---|
63 | by your recorded macro, you need to CHANGE that value. If it already has the |
---|
64 | desired value, change it to something different and then change it back to your |
---|
65 | desired value - otherwise nothing will be recorded! |
---|
66 | |
---|
67 | You may also use this as an feature: If you do NOT change a value during macro |
---|
68 | record, you can change it manually before calling the macro and that way perform |
---|
69 | similar, but different actions with one macro. |
---|
70 | |
---|
71 | This may as well be helpful when using submacros (see below). |
---|
72 | |
---|
73 | SECTION Calling submacros |
---|
74 | |
---|
75 | Macros can call other macros. To do this simply select the macro you like to call |
---|
76 | as submacro and press execute. That will be recorded like any other action. |
---|
77 | |
---|
78 | Calling submacros is a good way to compose complex macros. |
---|
79 | |
---|
80 | It offers you the possibility to change (or fix) small parts of a complex |
---|
81 | macro without the need to record it from scratch. |
---|
82 | |
---|
83 | SECTION Scripting arb |
---|
84 | |
---|
85 | You can run macros automatically at startup by using: |
---|
86 | |
---|
87 | arb --execute macroname your_database.arb |
---|
88 | |
---|
89 | These macros can even shut down ARB, letting you fully automate tasks. If a macro |
---|
90 | invokes shutdown, ARB will not prompt before closing. Ensure your macro saves the |
---|
91 | database to prevent data loss. |
---|
92 | |
---|
93 | Sometimes ARB exits with an error (for example if a client like ARB_EDIT4 or ARB_PARSIMONY |
---|
94 | is still running). To avoid this, close all client processes when they're no longer needed. |
---|
95 | |
---|
96 | If a client fails to close properly, the arb script will pause and wait for a key press |
---|
97 | before continuing. By default, this timeout is three days. In automated environments, |
---|
98 | you may want to customize this wait period by setting the environment variable |
---|
99 | ARB_SCRIPTED_SECS_WAIT_ON_ERROR to the desired number of seconds (see also |
---|
100 | LINK{arb_envar.hlp}). |
---|
101 | |
---|
102 | EXAMPLES You can find some examples in $ARBHOME/lib/macros (this directory is reachable |
---|
103 | in the macro selection box by pressing the ARBMACRO line). |
---|
104 | |
---|
105 | SECTION Enhanced techniques |
---|
106 | |
---|
107 | Macros are perl scripts. So if you know perl or have someone @ your lab who does |
---|
108 | or just feel keen enough, macros can be easily extended to act more sophisticated. |
---|
109 | |
---|
110 | Some examples: |
---|
111 | |
---|
112 | * to create a macro that works with the CURRENTLY SELECTED alignment |
---|
113 | - record a macro using an explicit alignment (e.g. 'ali_16s') wherever needed |
---|
114 | - edit the recorded macro file: |
---|
115 | * above the 1st '# recording started'-line insert the following lines: |
---|
116 | |
---|
117 | my $ali_selected = BIO::remote_read_awar($gb_main,'ARB_NT','presets/use'); |
---|
118 | if ((not defined $ali_selected) or ($ali_selected =~ /\?/)) { |
---|
119 | die "Please select a valid alignment"; |
---|
120 | } |
---|
121 | |
---|
122 | * below replace all |
---|
123 | |
---|
124 | occurrences of with |
---|
125 | 'ali_16s' $ali_selected |
---|
126 | |
---|
127 | Note the single quotes! |
---|
128 | |
---|
129 | * to create a macro that works with two corresponding dna and protein alignments |
---|
130 | - record a macro using two explicit alignments (e.g. 'ali_dna' and 'ali_pro') wherever needed |
---|
131 | - edit the recorded macro file: |
---|
132 | * above the 1st '# recording started'-line insert the following lines: |
---|
133 | |
---|
134 | use lib "$ENV{'ARBHOME'}/PERL_SCRIPTS/lib"; |
---|
135 | use ali_dnapro; |
---|
136 | my ($ali_dna,$ali_pro) = get_dnapro_alignments($gb_main); |
---|
137 | |
---|
138 | * below replace all |
---|
139 | |
---|
140 | occurrences of with |
---|
141 | 'ali_dna' $ali_dna |
---|
142 | 'ali_pro' $ali_pro |
---|
143 | |
---|
144 | Note the single quotes! |
---|
145 | - Notes: |
---|
146 | * works only if the alignment names contain 'dna' and 'pro' and both |
---|
147 | only differ by these terms. |
---|
148 | * you may select either the dna or the protein alignment before |
---|
149 | running the macro. |
---|
150 | |
---|
151 | The method used in the first example above also works for other |
---|
152 | selected things, like |
---|
153 | |
---|
154 | * the selected tree using |
---|
155 | |
---|
156 | my $tree_selected = BIO::remote_read_awar($gb_main,'ARB_NT','focus/tree_name'); |
---|
157 | |
---|
158 | * the LINK{selected.hlp} using |
---|
159 | |
---|
160 | my $species_selected = BIO::remote_read_awar($gb_main,'ARB_NT','tmp/focus/species_name'); |
---|
161 | die "no species selected" if not defined $species_selected; # show error in ARB message window and abort |
---|
162 | |
---|
163 | * the current cursor position in the editor |
---|
164 | |
---|
165 | my $cursor_position = BIO::remote_read_awar($gb_main,'ARB_NT','tmp/focus/cursor_position'); |
---|
166 | |
---|
167 | |
---|
168 | WARNINGS None |
---|
169 | |
---|
170 | BUGS None |
---|