Background: I have a file with a bunch of Debug MessageBoxes. Each is uniquely numbered so that, when it's displayed, if it isn't returning the right data, I can cancel and find the preceding code very easily. Problem is, as I add code, I need more DbgMsgs, so the numbering gets all out of whack. (And the potential arises for me to use the same number more than once.) I wanted a way to use a macro to find and renumber all of these, in order, but that appeared impossible with UE's macro language. Yes, it supports Loops, but those are of limited use without a variable that can be incremented and inserted.
Solution:
Pseudocode (actual code below)
1. Go to top of page
2. Create new file and insert sequential numbers, one per line
3. Go to top of page
4. Select to end of line and cut
5. delete line (so next number is at top of file)
6. Go to previous document and find DbgMsg text (preceding the number to be replaced)
7. Deselect using right arrow key, then select number to be replaced, then paste
8. Go to next document (i.e. new document with sequential numbers)
Loop 4-8 until search text isn't found and script aborts.
Solution:
Pseudocode (actual code below)
1. Go to top of page
2. Create new file and insert sequential numbers, one per line
3. Go to top of page
4. Select to end of line and cut
5. delete line (so next number is at top of file)
6. Go to previous document and find DbgMsg text (preceding the number to be replaced)
7. Deselect using right arrow key, then select number to be replaced, then paste
8. Go to next document (i.e. new document with sequential numbers)
Loop 4-8 until search text isn't found and script aborts.
Code: Select all
Top
NewFile
"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"
Top
Loop 60
StartSelect
Key END
EndSelect
Cut
Key DEL
PreviousDocument
Find "d := dbgmsg"
Key RIGHT ARROW
StartSelect
Key Ctrl+RIGHT ARROW
EndSelect
Paste
NextDocument
EndLoop
ExitMacro