User to user discussion and support for UltraEdit, UEStudio, UltraCompare, and other IDM applications.

Help with writing and playing macros
3 posts Page 1 of 1
I'm looking to create a macro to put a link on figures and the figure numbers could be numeric or roman numeral.
Is there a way put the respective numeric id to the link?

What I'm looking for is:

Sample:
Code: Select all
The fig. 12 is the combination of
figure 5 and Figure II which leads to Fig. 19

The macro I created works on fig. 12, figure 5 and Fig. 19, but not on Figure II.

Macro code:
Code: Select all
InsertMode
ColumnModeOff
HexOff
PerlReOn
Find RegExp SelectText "([a-z\.?]+) (\d+)"
Replace All "<a href="fig\2">\1 \2</a>"

However, Figure II should be <a href="fig2">Figure II</a>

Is is possible to do that in a single macro? And do I need to create an additional file where I have to define the values of
the roman numerals?

Example:
Code: Select all
I=1
II=2
.
.
.
etc.

And then use this reference file to put the valid value in "href=fig#".
This code for processing figures with roman numerals should be inserted above the code to process figures with digital numbers.

Code: Select all
Top
PerlReOn
Find RegExp "\<(fig\.|figure) ([CILVX]+)\>(?!</a>)"
Replace All "<a href="fig00\2">\1 \2</a>"
Top
UnixReOff
Find MatchCase RegExp "="fig^([CILVX]+^)"
Replace All "="fig00^1"
Find MatchCase "="fig00XC"
Replace All "="fig09"
Find MatchCase "="fig00LXXX"
Replace All "="fig08"
Find MatchCase "="fig00LXX"
Replace All "="fig07"
Find MatchCase "="fig00LX"
Replace All "="fig06"
Find MatchCase "="fig00L"
Replace All "="fig05"
Find MatchCase "="fig00XL"
Replace All "="fig04"
Find MatchCase "="fig00XXX"
Replace All "="fig03"
Find MatchCase "="fig00XX"
Replace All "="fig02"
Find MatchCase "="fig00X"
Replace All "="fig01"
Find MatchCase RegExp "^(="fig[0-9][0-9]^)""
Replace All "^10""
Find MatchCase RegExp "^(="fig[0-9]+^)IX"
Replace All "^19"
Find MatchCase RegExp "^(="fig[0-9]+^)VIII"
Replace All "^18"
Find MatchCase RegExp "^(="fig[0-9]+^)VII"
Replace All "^17"
Find MatchCase RegExp "^(="fig[0-9]+^)VI"
Replace All "^16"
Find MatchCase RegExp "^(="fig[0-9]+^)V"
Replace All "^15"
Find MatchCase RegExp "^(="fig[0-9]+^)IV"
Replace All "^14"
Find MatchCase RegExp "^(="fig[0-9]+^)III"
Replace All "^13"
Find MatchCase RegExp "^(="fig[0-9]+^)II"
Replace All "^12"
Find MatchCase RegExp "^(="fig[0-9]+^)I"
Replace All "^11"

This macro works for I to XCIX, i.e. 1 to 99 producing fig001 to fig099.
Best regards from Austria
Well I have made another macro which works up to 1000 i.e. M using a reference file.

Macro code:
Code: Select all
InsertMode
ColumnModeOff
HexOff
PerlReOn
Find RegExp SelectText "([a-z\.]+) ([a-z\.]+)"
Replace All "<a href="fig#">\1 \2</a>"
Key LEFT ARROW
Find RegExp Up " "
PerlReOn
Find RegExp "([a-z]+)"
Copy
Open "C:\Users\user\Desktop\Roman Numerals.txt"
UnixReOff
Find RegExp "%^c"
PerlReOn
Find MatchCase RegExp "(?<==)(.*)$"
Copy
CloseFile NoSave
UnixReOff
Find RegExp Up "#"
Paste

And reference file:
Code: Select all
I=1
II=2
III=3
IV=4
V=5
VI=6
VII=7
VIII=8
IX=9
X=10
XI=11
XII=12
XIII=13
XIV=14
XV=15
XVI=16
XVII=17
XVIII=18
XIX=19
XX=20
XXI=21
XXII=22
XXIII=23
XXIV=24
XXV=25
XXVI=26
XXVII=27
XXVIII=28
XXIX=29
XXX=30
XXXI=31
XXXII=32
XXXIII=33
XXXIV=34
XXXV=35
XXXVI=36
XXXVII=37
XXXVIII=38
XXXIX=39
XL=40
XLI=41
XLII=42
XLIII=43
XLIV=44
XLV=45
XLVI=46
XLVII=47
XLVIII=48
XLIX=49
L=50
LI=51
LII=52
LIII=53
LIV=54
LV=55
LVI=56
LVII=57
LVIII=58
LIX=59
LX=60
LXI=61
LXII=62
LXIII=63
LXIV=64
LXV=65
LXVI=66
LXVII=67
LXVIII=68
LXIX=69
LXX=70
LXXI=71
LXXII=72
LXXIII=73
LXXIV=74
LXXV=75
LXXVI=76
LXXVII=77
LXXVIII=78
LXXIX=79
LXXX=80
LXXXI=81
LXXXII=82
LXXXIII=83
LXXXIV=84
LXXXV=85
LXXXVI=86
LXXXVII=87
LXXXVIII=88
LXXXIX=89
XC=90
XCI=91
XCII=92
XCIII=93
XCIV=94
XCV=95
XCVI=96
XCVII=97
XCVIII=98
XCIX=99
C=100
CI=101
CII=102
CIII=103
CIV=104
CV=105
CVI=106
CVII=107
CVIII=108
CIX=109
CX=110
CXI=111
CXII=112
CXIII=113
CXIV=114
CXV=115
CXVI=116
CXVII=117
CXVIII=118
CXIX=119
CXX=120
CXXI=121
CXXII=122
CXXIII=123
CXXIV=124
CXXV=125
CXXVI=126
CXXVII=127
CXXVIII=128
CXXIX=129
CXXX=130
CXXXI=131
CXXXII=132
CXXXIII=133
CXXXIV=134
CXXXV=135
CXXXVI=136
CXXXVII=137
CXXXVIII=138
CXXXIX=139
CXL=140
CXLI=141
CXLII=142
CXLIII=143
CXLIV=144
CXLV=145
CXLVI=146
CXLVII=147
CXLVIII=148
CXLIX=149
CL=150
CLI=151
CLII=152
CLIII=153
CLIV=154
CLV=155
CLVI=156
CLVII=157
CLVIII=158
CLIX=159
CLX=160
CLXI=161
CLXII=162
CLXIII=163
CLXIV=164
CLXV=165
CLXVI=166
CLXVII=167
CLXVIII=168
CLXIX=169
CLXX=170
CLXXI=171
CLXXII=172
CLXXIII=173
CLXXIV=174
CLXXV=175
CLXXVI=176
CLXXVII=177
CLXXVIII=178
CLXXIX=179
CLXXX=180
CLXXXI=181
CLXXXII=182
CLXXXIII=183
CLXXXIV=184
CLXXXV=185
CLXXXVI=186
CLXXXVII=187
CLXXXVIII=188
CLXXXIX=189
CXC=190
CXCI=191
CXCII=192
CXCIII=193
CXCIV=194
CXCV=195
CXCVI=196
CXCVII=197
CXCVIII=198
CXCIX=199
CC=200
CCI=201
CCII=202
CCIII=203
CCIV=204
CCV=205
CCVI=206
CCVII=207
CCVIII=208
CCIX=209
CCX=210
CCXI=211
CCXII=212
CCXIII=213
CCXIV=214
CCXV=215
CCXVI=216
CCXVII=217
CCXVIII=218
CCXIX=219
CCXX=220
CCXXI=221
CCXXII=222
CCXXIII=223
CCXXIV=224
CCXXV=225
CCXXVI=226
CCXXVII=227
CCXXVIII=228
CCXXIX=229
CCXXX=230
CCXXXI=231
CCXXXII=232
CCXXXIII=233
CCXXXIV=234
CCXXXV=235
CCXXXVI=236
CCXXXVII=237
CCXXXVIII=238
CCXXXIX=239
CCXL=240
CCXLI=241
CCXLII=242
CCXLIII=243
CCXLIV=244
CCXLV=245
CCXLVI=246
CCXLVII=247
CCXLVIII=248
CCXLIX=249
CCL=250
CCLI=251
CCLII=252
CCLIII=253
CCLIV=254
CCLV=255
CCLVI=256
CCLVII=257
CCLVIII=258
CCLIX=259
CCLX=260
CCLXI=261
CCLXII=262
CCLXIII=263
CCLXIV=264
CCLXV=265
CCLXVI=266
CCLXVII=267
CCLXVIII=268
CCLXIX=269
CCLXX=270
CCLXXI=271
CCLXXII=272
CCLXXIII=273
CCLXXIV=274
CCLXXV=275
CCLXXVI=276
CCLXXVII=277
CCLXXVIII=278
CCLXXIX=279
CCLXXX=280
CCLXXXI=281
CCLXXXII=282
CCLXXXIII=283
CCLXXXIV=284
CCLXXXV=285
CCLXXXVI=286
CCLXXXVII=287
CCLXXXVIII=288
CCLXXXIX=289
CCXC=290
CCXCI=291
CCXCII=292
CCXCIII=293
CCXCIV=294
CCXCV=295
CCXCVI=296
CCXCVII=297
CCXCVIII=298
CCXCIX=299
CCC=300
CCCI=301
CCCII=302
CCCIII=303
CCCIV=304
CCCV=305
CCCVI=306
CCCVII=307
CCCVIII=308
CCCIX=309
CCCX=310
CCCXI=311
CCCXII=312
CCCXIII=313
CCCXIV=314
CCCXV=315
CCCXVI=316
CCCXVII=317
CCCXVIII=318
CCCXIX=319
CCCXX=320
CCCXXI=321
CCCXXII=322
CCCXXIII=323
CCCXXIV=324
CCCXXV=325
CCCXXVI=326
CCCXXVII=327
CCCXXVIII=328
CCCXXIX=329
CCCXXX=330
CCCXXXI=331
CCCXXXII=332
CCCXXXIII=333
CCCXXXIV=334
CCCXXXV=335
CCCXXXVI=336
CCCXXXVII=337
CCCXXXVIII=338
CCCXXXIX=339
CCCXL=340
CCCXLI=341
CCCXLII=342
CCCXLIII=343
CCCXLIV=344
CCCXLV=345
CCCXLVI=346
CCCXLVII=347
CCCXLVIII=348
CCCXLIX=349
CCCL=350
CCCLI=351
CCCLII=352
CCCLIII=353
CCCLIV=354
CCCLV=355
CCCLVI=356
CCCLVII=357
CCCLVIII=358
CCCLIX=359
CCCLX=360
CCCLXI=361
CCCLXII=362
CCCLXIII=363
CCCLXIV=364
CCCLXV=365
CCCLXVI=366
CCCLXVII=367
CCCLXVIII=368
CCCLXIX=369
CCCLXX=370
CCCLXXI=371
CCCLXXII=372
CCCLXXIII=373
CCCLXXIV=374
CCCLXXV=375
CCCLXXVI=376
CCCLXXVII=377
CCCLXXVIII=378
CCCLXXIX=379
CCCLXXX=380
CCCLXXXI=381
CCCLXXXII=382
CCCLXXXIII=383
CCCLXXXIV=384
CCCLXXXV=385
CCCLXXXVI=386
CCCLXXXVII=387
CCCLXXXVIII=388
CCCLXXXIX=389
CCCXC=390
CCCXCI=391
CCCXCII=392
CCCXCIII=393
CCCXCIV=394
CCCXCV=395
CCCXCVI=396
CCCXCVII=397
CCCXCVIII=398
CCCXCIX=399
CD=400
CDI=401
CDII=402
CDIII=403
CDIV=404
CDV=405
CDVI=406
CDVII=407
CDVIII=408
CDIX=409
CDX=410
CDXI=411
CDXII=412
CDXIII=413
CDXIV=414
CDXV=415
CDXVI=416
CDXVII=417
CDXVIII=418
CDXIX=419
CDXX=420
CDXXI=421
CDXXII=422
CDXXIII=423
CDXXIV=424
CDXXV=425
CDXXVI=426
CDXXVII=427
CDXXVIII=428
CDXXIX=429
CDXXX=430
CDXXXI=431
CDXXXII=432
CDXXXIII=433
CDXXXIV=434
CDXXXV=435
CDXXXVI=436
CDXXXVII=437
CDXXXVIII=438
CDXXXIX=439
CDXL=440
CDXLI=441
CDXLII=442
CDXLIII=443
CDXLIV=444
CDXLV=445
CDXLVI=446
CDXLVII=447
CDXLVIII=448
CDXLIX=449
CDL=450
CDLI=451
CDLII=452
CDLIII=453
CDLIV=454
CDLV=455
CDLVI=456
CDLVII=457
CDLVIII=458
CDLIX=459
CDLX=460
CDLXI=461
CDLXII=462
CDLXIII=463
CDLXIV=464
CDLXV=465
CDLXVI=466
CDLXVII=467
CDLXVIII=468
CDLXIX=469
CDLXX=470
CDLXXI=471
CDLXXII=472
CDLXXIII=473
CDLXXIV=474
CDLXXV=475
CDLXXVI=476
CDLXXVII=477
CDLXXVIII=478
CDLXXIX=479
CDLXXX=480
CDLXXXI=481
CDLXXXII=482
CDLXXXIII=483
CDLXXXIV=484
CDLXXXV=485
CDLXXXVI=486
CDLXXXVII=487
CDLXXXVIII=488
CDLXXXIX=489
CDXC=490
CDXCI=491
CDXCII=492
CDXCIII=493
CDXCIV=494
CDXCV=495
CDXCVI=496
CDXCVII=497
CDXCVIII=498
CDXCIX=499
D=500
DI=501
DII=502
DIII=503
DIV=504
DV=505
DVI=506
DVII=507
DVIII=508
DIX=509
DX=510
DXI=511
DXII=512
DXIII=513
DXIV=514
DXV=515
DXVI=516
DXVII=517
DXVIII=518
DXIX=519
DXX=520
DXXI=521
DXXII=522
DXXIII=523
DXXIV=524
DXXV=525
DXXVI=526
DXXVII=527
DXXVIII=528
DXXIX=529
DXXX=530
DXXXI=531
DXXXII=532
DXXXIII=533
DXXXIV=534
DXXXV=535
DXXXVI=536
DXXXVII=537
DXXXVIII=538
DXXXIX=539
DXL=540
DXLI=541
DXLII=542
DXLIII=543
DXLIV=544
DXLV=545
DXLVI=546
DXLVII=547
DXLVIII=548
DXLIX=549
DL=550
DLI=551
DLII=552
DLIII=553
DLIV=554
DLV=555
DLVI=556
DLVII=557
DLVIII=558
DLIX=559
DLX=560
DLXI=561
DLXII=562
DLXIII=563
DLXIV=564
DLXV=565
DLXVI=566
DLXVII=567
DLXVIII=568
DLXIX=569
DLXX=570
DLXXI=571
DLXXII=572
DLXXIII=573
DLXXIV=574
DLXXV=575
DLXXVI=576
DLXXVII=577
DLXXVIII=578
DLXXIX=579
DLXXX=580
DLXXXI=581
DLXXXII=582
DLXXXIII=583
DLXXXIV=584
DLXXXV=585
DLXXXVI=586
DLXXXVII=587
DLXXXVIII=588
DLXXXIX=589
DXC=590
DXCI=591
DXCII=592
DXCIII=593
DXCIV=594
DXCV=595
DXCVI=596
DXCVII=597
DXCVIII=598
DXCIX=599
DC=600
DCI=601
DCII=602
DCIII=603
DCIV=604
DCV=605
DCVI=606
DCVII=607
DCVIII=608
DCIX=609
DCX=610
DCXI=611
DCXII=612
DCXIII=613
DCXIV=614
DCXV=615
DCXVI=616
DCXVII=617
DCXVIII=618
DCXIX=619
DCXX=620
DCXXI=621
DCXXII=622
DCXXIII=623
DCXXIV=624
DCXXV=625
DCXXVI=626
DCXXVII=627
DCXXVIII=628
DCXXIX=629
DCXXX=630
DCXXXI=631
DCXXXII=632
DCXXXIII=633
DCXXXIV=634
DCXXXV=635
DCXXXVI=636
DCXXXVII=637
DCXXXVIII=638
DCXXXIX=639
DCXL=640
DCXLI=641
DCXLII=642
DCXLIII=643
DCXLIV=644
DCXLV=645
DCXLVI=646
DCXLVII=647
DCXLVIII=648
DCXLIX=649
DCL=650
DCLI=651
DCLII=652
DCLIII=653
DCLIV=654
DCLV=655
DCLVI=656
DCLVII=657
DCLVIII=658
DCLIX=659
DCLX=660
DCLXI=661
DCLXII=662
DCLXIII=663
DCLXIV=664
DCLXV=665
DCLXVI=666
DCLXVII=667
DCLXVIII=668
DCLXIX=669
DCLXX=670
DCLXXI=671
DCLXXII=672
DCLXXIII=673
DCLXXIV=674
DCLXXV=675
DCLXXVI=676
DCLXXVII=677
DCLXXVIII=678
DCLXXIX=679
DCLXXX=680
DCLXXXI=681
DCLXXXII=682
DCLXXXIII=683
DCLXXXIV=684
DCLXXXV=685
DCLXXXVI=686
DCLXXXVII=687
DCLXXXVIII=688
DCLXXXIX=689
DCXC=690
DCXCI=691
DCXCII=692
DCXCIII=693
DCXCIV=694
DCXCV=695
DCXCVI=696
DCXCVII=697
DCXCVIII=698
DCXCIX=699
DCC=700
DCCI=701
DCCII=702
DCCIII=703
DCCIV=704
DCCV=705
DCCVI=706
DCCVII=707
DCCVIII=708
DCCIX=709
DCCX=710
DCCXI=711
DCCXII=712
DCCXIII=713
DCCXIV=714
DCCXV=715
DCCXVI=716
DCCXVII=717
DCCXVIII=718
DCCXIX=719
DCCXX=720
DCCXXI=721
DCCXXII=722
DCCXXIII=723
DCCXXIV=724
DCCXXV=725
DCCXXVI=726
DCCXXVII=727
DCCXXVIII=728
DCCXXIX=729
DCCXXX=730
DCCXXXI=731
DCCXXXII=732
DCCXXXIII=733
DCCXXXIV=734
DCCXXXV=735
DCCXXXVI=736
DCCXXXVII=737
DCCXXXVIII=738
DCCXXXIX=739
DCCXL=740
DCCXLI=741
DCCXLII=742
DCCXLIII=743
DCCXLIV=744
DCCXLV=745
DCCXLVI=746
DCCXLVII=747
DCCXLVIII=748
DCCXLIX=749
DCCL=750
DCCLI=751
DCCLII=752
DCCLIII=753
DCCLIV=754
DCCLV=755
DCCLVI=756
DCCLVII=757
DCCLVIII=758
DCCLIX=759
DCCLX=760
DCCLXI=761
DCCLXII=762
DCCLXIII=763
DCCLXIV=764
DCCLXV=765
DCCLXVI=766
DCCLXVII=767
DCCLXVIII=768
DCCLXIX=769
DCCLXX=770
DCCLXXI=771
DCCLXXII=772
DCCLXXIII=773
DCCLXXIV=774
DCCLXXV=775
DCCLXXVI=776
DCCLXXVII=777
DCCLXXVIII=778
DCCLXXIX=779
DCCLXXX=780
DCCLXXXI=781
DCCLXXXII=782
DCCLXXXIII=783
DCCLXXXIV=784
DCCLXXXV=785
DCCLXXXVI=786
DCCLXXXVII=787
DCCLXXXVIII=788
DCCLXXXIX=789
DCCXC=790
DCCXCI=791
DCCXCII=792
DCCXCIII=793
DCCXCIV=794
DCCXCV=795
DCCXCVI=796
DCCXCVII=797
DCCXCVIII=798
DCCXCIX=799
DCCC=800
DCCCI=801
DCCCII=802
DCCCIII=803
DCCCIV=804
DCCCV=805
DCCCVI=806
DCCCVII=807
DCCCVIII=808
DCCCIX=809
DCCCX=810
DCCCXI=811
DCCCXII=812
DCCCXIII=813
DCCCXIV=814
DCCCXV=815
DCCCXVI=816
DCCCXVII=817
DCCCXVIII=818
DCCCXIX=819
DCCCXX=820
DCCCXXI=821
DCCCXXII=822
DCCCXXIII=823
DCCCXXIV=824
DCCCXXV=825
DCCCXXVI=826
DCCCXXVII=827
DCCCXXVIII=828
DCCCXXIX=829
DCCCXXX=830
DCCCXXXI=831
DCCCXXXII=832
DCCCXXXIII=833
DCCCXXXIV=834
DCCCXXXV=835
DCCCXXXVI=836
DCCCXXXVII=837
DCCCXXXVIII=838
DCCCXXXIX=839
DCCCXL=840
DCCCXLI=841
DCCCXLII=842
DCCCXLIII=843
DCCCXLIV=844
DCCCXLV=845
DCCCXLVI=846
DCCCXLVII=847
DCCCXLVIII=848
DCCCXLIX=849
DCCCL=850
DCCCLI=851
DCCCLII=852
DCCCLIII=853
DCCCLIV=854
DCCCLV=855
DCCCLVI=856
DCCCLVII=857
DCCCLVIII=858
DCCCLIX=859
DCCCLX=860
DCCCLXI=861
DCCCLXII=862
DCCCLXIII=863
DCCCLXIV=864
DCCCLXV=865
DCCCLXVI=866
DCCCLXVII=867
DCCCLXVIII=868
DCCCLXIX=869
DCCCLXX=870
DCCCLXXI=871
DCCCLXXII=872
DCCCLXXIII=873
DCCCLXXIV=874
DCCCLXXV=875
DCCCLXXVI=876
DCCCLXXVII=877
DCCCLXXVIII=878
DCCCLXXIX=879
DCCCLXXX=880
DCCCLXXXI=881
DCCCLXXXII=882
DCCCLXXXIII=883
DCCCLXXXIV=884
DCCCLXXXV=885
DCCCLXXXVI=886
DCCCLXXXVII=887
DCCCLXXXVIII=888
DCCCLXXXIX=889
DCCCXC=890
DCCCXCI=891
DCCCXCII=892
DCCCXCIII=893
DCCCXCIV=894
DCCCXCV=895
DCCCXCVI=896
DCCCXCVII=897
DCCCXCVIII=898
DCCCXCIX=899
CM=900
CMI=901
CMII=902
CMIII=903
CMIV=904
CMV=905
CMVI=906
CMVII=907
CMVIII=908
CMIX=909
CMX=910
CMXI=911
CMXII=912
CMXIII=913
CMXIV=914
CMXV=915
CMXVI=916
CMXVII=917
CMXVIII=918
CMXIX=919
CMXX=920
CMXXI=921
CMXXII=922
CMXXIII=923
CMXXIV=924
CMXXV=925
CMXXVI=926
CMXXVII=927
CMXXVIII=928
CMXXIX=929
CMXXX=930
CMXXXI=931
CMXXXII=932
CMXXXIII=933
CMXXXIV=934
CMXXXV=935
CMXXXVI=936
CMXXXVII=937
CMXXXVIII=938
CMXXXIX=939
CMXL=940
CMXLI=941
CMXLII=942
CMXLIII=943
CMXLIV=944
CMXLV=945
CMXLVI=946
CMXLVII=947
CMXLVIII=948
CMXLIX=949
CML=950
CMLI=951
CMLII=952
CMLIII=953
CMLIV=954
CMLV=955
CMLVI=956
CMLVII=957
CMLVIII=958
CMLIX=959
CMLX=960
CMLXI=961
CMLXII=962
CMLXIII=963
CMLXIV=964
CMLXV=965
CMLXVI=966
CMLXVII=967
CMLXVIII=968
CMLXIX=969
CMLXX=970
CMLXXI=971
CMLXXII=972
CMLXXIII=973
CMLXXIV=974
CMLXXV=975
CMLXXVI=976
CMLXXVII=977
CMLXXVIII=978
CMLXXIX=979
CMLXXX=980
CMLXXXI=981
CMLXXXII=982
CMLXXXIII=983
CMLXXXIV=984
CMLXXXV=985
CMLXXXVI=986
CMLXXXVII=987
CMLXXXVIII=988
CMLXXXIX=989
CMXC=990
CMXCI=991
CMXCII=992
CMXCIII=993
CMXCIV=994
CMXCV=995
CMXCVI=996
CMXCVII=997
CMXCVIII=998
CMXCIX=999
M=1000

But I cannot find a way to add the macro for only numbered id's, i.e. figure 5, fig. 12 etc. (UE v 14.10.0.1018)
3 posts Page 1 of 1