-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdnaspider.cpp
4148 lines (4040 loc) · 176 KB
/
dnaspider.cpp
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// @dnaspider
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
#include <chrono>
#include <regex>
#include <codecvt>
#include <thread>
using namespace std;
using ctp = chrono::steady_clock::time_point;
#pragma region global_var
wstring&&
Kb_Key_A = L"a", Kb_Key_B = L"b", Kb_Key_C = L"c", Kb_Key_D = L"d", Kb_Key_E = L"e", Kb_Key_F = L"f", Kb_Key_G = L"g", Kb_Key_H = L"h", Kb_Key_I = L"i", Kb_Key_J = L"j", Kb_Key_K = L"k", Kb_Key_L = L"l", Kb_Key_M = L"m", Kb_Key_N = L"n", Kb_Key_O = L"o", Kb_Key_P = L"p", Kb_Key_Q = L"q", Kb_Key_R = L"r", Kb_Key_S = L"s", Kb_Key_T = L"t", Kb_Key_U = L"u", Kb_Key_V = L"v", Kb_Key_W = L"w", Kb_Key_X = L"x", Kb_Key_Y = L"y", Kb_Key_Z = L"z",
Kb_Key_0 = L"0", Kb_Key_1 = L"1", Kb_Key_2 = L"2", Kb_Key_3 = L"3", Kb_Key_4 = L"4", Kb_Key_5 = L"5", Kb_Key_6 = L"6", Kb_Key_7 = L"7", Kb_Key_8 = L"8", Kb_Key_9 = L"9",
Kb_Key_F1 = L"", Kb_Key_F2 = L"", Kb_Key_F3 = L"", Kb_Key_F4 = L"", Kb_Key_F5 = L"", Kb_Key_F6 = L"", Kb_Key_F7 = L"", Kb_Key_F8 = L"", Kb_Key_F9 = L"", Kb_Key_F10 = L"", Kb_Key_F11 = L"", Kb_Key_F12 = L"",
Kb_Key_Left = L"", Kb_Key_Up = L"", Kb_Key_Right = L"", Kb_Key_Down = L"",
Kb_Key_Esc = L"", Kb_Key_Space = L"", Kb_Key_Tab = L"", Kb_Key_Left_Shift = L"", Kb_Key_Right_Shift = L"", Kb_Key_Left_Alt = L"", Kb_Key_Right_Alt = L"", Kb_Key_Left_Ctrl = L"", Kb_Key_Right_Ctrl = L"", Kb_Key_Enter = L"", Kb_Key_Caps = L"", Kb_Key_Grave_Accent = L"", Kb_Key_Minus = L"", Kb_Key_Equal = L"", Kb_Key_Left_Bracket = L"", Kb_Key_Right_Bracket = L"", Kb_Key_Backslash = L"", Kb_Key_Semicolon = L"", Kb_Key_Quote = L"", Kb_Key_Comma = L"", Kb_Key_Period = L"", Kb_Key_Forwardslash = L"", Kb_Key_Menu = L"",
Kb_Key_Print_Screen = L"", Kb_Key_Insert = L"", Kb_Key_Delete = L"", Kb_Key_Home = L"", Kb_Key_End = L"", Kb_Key_PgUp = L"", Kb_Key_PgDn = L"",
Kb_Key_Numpad_0 = L"", Kb_Key_Numpad_1 = L"", Kb_Key_Numpad_2 = L"", Kb_Key_Numpad_3 = L"", Kb_Key_Numpad_4 = L"", Kb_Key_Numpad_5 = L"", Kb_Key_Numpad_6 = L"", Kb_Key_Numpad_7 = L"", Kb_Key_Numpad_8 = L"", Kb_Key_Numpad_9 = L"", Kb_Key_Numlock = L"", Kb_Key_Numpad_Divide = L"", Kb_Key_Numpad_Multiply = L"", Kb_Key_Numpad_Minus = L"", Kb_Key_Numpad_Add = L"", Kb_Key_Numpad_Period = L"", Kb_Key_Numpad_Enter = L""
;
wstring&& pre = L""; //previous reTail
wstring&& io = L" ";//i*o
wstring&& linkr = L"";
wstring&& link = L""; //<app|rgb|ifcb,,,<link:>
wstring&& editor1 = L"Notepad", editor = L"Visual Studio Code", db = L"db.txt - ", se = L"se.txt - ", editorSe = se + editor, editorDb = db + editor;
wstring database, settings, replacerDb;
wstring&& strand = L""; //>> supply
wstring&& tail = L""; //strand:tail
wstring&& re = L"";//repeat clone
wstring&& reTail = L"";
wstring&& codes = L""; //tail re
wstring star_num; //<x*#>
wstring qq; //<x>
wstring qp; //<x:#>
wstring qx, qy; //<xy:#,#>
wstring&& OutsTemplate = L"";
wstring&& Loop_Insert_Text = L"";
wstring&& multiLineDelim = L"\n"; //DbMultiLineDelimiter:
wstring&& OutTab = L"\t"; //OutTabs
double RgbScaleLayout = 1.00; //100%
size_t i = 0;
size_t qqLen = 2;
int rri = 0; //++RSHIFTLSHIFT_Only
int CommaSleep = 128;
int ic = 0; //<+> icp
int frequency = 128; //>> ms response -> vk_
int speed = 0; //<<
int qxc = 0, qyc = 0;//<rp>
int qxcc = 0, qycc = 0;//cc
int CloseCtrlSpacer = 96;
short Kb_QQ_i = 0, Kb_QQ_k = 0; //qq < [Kb_Key_Q: >q '<bs>]
short strandLengthMode = 0;
short PauseKey = 123; //VK_F12
short ClearStrandKey = 123;
short reKey = VK_PAUSE; //repeat
short cKey = VK_SPACE, cKeyMax = 3; //<
short LSHIFTCtrlKeyMax, RSHIFTCtrlKeyToggleMax;
short RSHIFTLSHIFT_Only = 1;
bool toggle_ccm = 0; //RSHIFTCtrlKeyToggle close_ctrl_mode=0
bool LSHIFTCtrlKey = 0; //<
bool RSHIFTCtrlKeyToggle = 0;
bool ManualRepeat = 0;//<repeat>
bool io_Auto_BS = 1;//i*o
bool NoEscapeOrPause = 0; //<~esc>, <~~esc>
bool noClearStrand = 0; //<!>
bool OutTabs = 1;
bool multiblock = 0; //<~m>
bool Unicode = 1;
bool multiStrand = 1, showMultiStrandElapsedOnly = 0;
bool relink = 0;
bool fail = 0;
bool sleep = 1;
bool esc_pressed = 0;
bool pause_resume = 0;
bool enableEscX = true;
bool ignoreNumPad = true;
bool startHidden = true;
bool ignoreAZ = false;
bool ignore09 = false;
bool ignoreArrows = true;
bool ignoreF1s = true;//f1-f12
bool qScanOnly = true;
bool showStrand = false; //cout <<
bool showIntro = false;
bool showSettings = true;
bool shft = false;
bool close_ctrl_mode = true; //x>, x:, x-
bool SlightPauseInBetweenConnects = false;
bool EscCommaAutoBs = true;
bool EscEqualAutoBs = true;
bool EscHAutoBs = true;
bool AutoBs_RepeatKey = false;
bool SeHotReload_CtrlS = true;
bool SeDbClearStrand_CtrlS = true;
bool assume = true;
#pragma endregion
#pragma region protos
void showOutsMsg(wstring, wstring, wstring, bool);
ctp clockr(ctp&);
void cbSet(wstring&);
wstring randn(bool);
void repeat();
#pragma endregion
#pragma region classo
struct Store {
wstring v, v1;
};
struct Mainn {
wstring s = L"", s1 = L"", t = tail;//strand
ctp c1{}, c2{};//elapsed
Mainn() {
if (!multiStrand) return;
if (showMultiStrandElapsedOnly) { clockr(c1); return; }
}
~Mainn() {
if (!multiStrand) return;
if (showMultiStrandElapsedOnly) { clockr(c2); chrono::duration<double, milli> ts = c1 - c2; wstring q = L""; if (!showStrand) { q = strand[strand.size() - 1] == '>' ? L"" : strand.size() > 0 ? L">" : L""; wstring p = q; q = strand + p; } bool x = showStrand; showStrand = 1; showOutsMsg(L"", OutsTemplate, q, 1); showStrand = x; cout << dec << "(" << abs(static_cast<long>(ts.count())) << "ms elapsed)\n"; return; }
}
};
struct Multi {
wstring qp, r, g, b, a, x, m, l, t = tail, q = qq, s = strand;
size_t i_ = i, icp = 0;
int cx = 0, cy = 0, speed_ = 0;
bool esc = 0, br = 0;//break
//~Multi() {}
};
#pragma endregion
#pragma region global_sub
static wstring getTime(wstring& w) {
auto np = chrono::system_clock::now();
auto n = chrono::system_clock::to_time_t(np);
char b[26];
ctime_s(b, sizeof(b), &n);
for (auto i = 0; i < 26; ++i) {
if (b[i] == '\n') break;
w += b[i];
}
return w;
}
ctp clockr(ctp& t) {
return t = chrono::high_resolution_clock::now();
}
static wstring check_if_num(wstring &s) {
if (assume) return s;
if (s > L"") {
int c = 0, d = 0;
auto f = [&s]() { if (showStrand) wcout << "NAN: " << OutTab << OutTab << s << endl; s.clear(); return s; };
for (size_t t = 0; t < s.length(); ++t) {//!0-9
if (s[0] == ' ') {
if (s.length() == 1) {
s.clear(); return s;
}
s = s.substr(1, s.length()); --t;
continue;
}//rem ws
if (c > 1 || d > 1) f();
if (s[t] == '.') { if (s.length() == 1) { f(); } ++d; continue; }
if (t == 0 && (s[0] == 45 || s[0] == 43) && s.length() != 1) { ++c; continue; }//-+
if (!(s[t] >= 48 && s[t] <= 57)) f();
}
}
else s.clear();
return s;
}
static void kb(wchar_t b) {//out char
INPUT ip[2]{}; ip[0].type = INPUT_KEYBOARD;
ip[0].ki.dwFlags = KEYEVENTF_UNICODE;
if (VkKeyScanW(b) == -1) { ip[0].ki.wScan = b; ip[0].ki.wVk = 0; }
else { ip[0].ki.wVk = VkKeyScanW(b); }
ip[1] = ip[0]; ip[1].ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(2, ip, sizeof(ip[0]));
}
static void kb(wstring &b) {
if (b.find('\\') != string::npos) b = regex_replace(b, wregex(L"\\\\g"), L">");
INPUT ip[2]{}; ip[0].type = INPUT_KEYBOARD;
ip[0].ki.dwFlags = KEYEVENTF_UNICODE;
for (auto &i : b) {
ip[0].ki.wScan = i; ip[0].ki.wVk = 0;
ip[1] = ip[0]; ip[1].ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(2, ip, sizeof(ip[0]));
}
}
static void kbHold(short key) {
INPUT ip{}; ip.type = INPUT_KEYBOARD; ip.ki.wVk = key; ip.ki.time = 0;
if (key == VK_LMENU || key == VK_CONTROL) ip.ki.dwFlags = 0; else ip.ki.dwFlags = 1;
SendInput(1, &ip, sizeof(INPUT));
}
static void kbRelease(short key) {
INPUT ip{}; ip.type = INPUT_KEYBOARD; ip.ki.wVk = key;
ip.ki.dwFlags = KEYEVENTF_KEYUP; SendInput(1, &ip, sizeof(INPUT));
GetAsyncKeyState(key);
}
static void mouseEvent(short key) {
INPUT ip{}; ip.type = INPUT_MOUSE; ip.mi.time = 0;
ip.mi.dwFlags = key;
if (key == MOUSEEVENTF_HWHEEL) {
if (qq.substr(0, 3) == L"<sr") ip.mi.mouseData = WHEEL_DELTA;//scroll right
else if (qq.substr(0, 3) == L"<sd") { ip.mi.dwFlags = MOUSEEVENTF_WHEEL; ip.mi.mouseData = -WHEEL_DELTA; }//scroll down
else if (qq.substr(0, 3) == L"<sl") ip.mi.mouseData = -WHEEL_DELTA;//scroll left
else if (qq.substr(0, 3) == L"<su") { ip.mi.dwFlags = MOUSEEVENTF_WHEEL; ip.mi.mouseData = WHEEL_DELTA; }//scroll up
}
SendInput(1, &ip, sizeof(ip));
}
static void shftRelease() {
INPUT ip{}; ip.type = INPUT_KEYBOARD; ip.ki.dwFlags = 2;
ip.ki.wVk = VK_LSHIFT;
SendInput(1, &ip, sizeof(INPUT));
ip.ki.wVk = VK_RSHIFT;
SendInput(1, &ip, sizeof(INPUT));
if (shft) { shft = false; }
if (Kb_Key_Left_Shift[0]) GetAsyncKeyState(VK_LSHIFT);
if (Kb_Key_Right_Shift[0]) GetAsyncKeyState(VK_RSHIFT);
}
static void printq() { kbHold(VK_LSHIFT); kb('<'); shftRelease(); }
static void prints() { if (showStrand) { auto s = L""+strand; OutsTemplate[0] == '\\' && OutsTemplate[OutsTemplate.length() - 2] == '\\' ? s = s.replace(0, s.length(), OutsTemplate.substr(0, 2) + s + OutsTemplate.substr(OutsTemplate.length() - 2)) : s = s.replace(0, s.length(), L"\\G" + s + L"\\7"); showOutsMsg(L"", OutsTemplate + s, L"\n", 1); } }
static bool qqb(const wstring s) {
return qq.substr(0, s.length()) == s && qq.find('>') != string::npos;
}
static bool testqqb(const wstring s) {
return qqb(s) && qq[s.length()] != '>';
}
static void clearAllKeys() {
if (!ignoreAZ) for (int i = 65; i <= 90; ++i) { GetAsyncKeyState(i); }
if (!ignore09) for (int i = 48; i <= 57; ++i) { GetAsyncKeyState(i); }
if (Kb_Key_Right_Shift[0]) GetAsyncKeyState(VK_RSHIFT);
if (Kb_Key_Left_Shift[0]) GetAsyncKeyState(VK_LSHIFT);
GetAsyncKeyState(VK_BACK);
if (Kb_Key_Esc[0]) GetAsyncKeyState(VK_ESCAPE);
GetAsyncKeyState(VK_PAUSE);
if (Kb_Key_Space[0]) GetAsyncKeyState(VK_SPACE);
if (!ignoreF1s) { GetAsyncKeyState(VK_F1); GetAsyncKeyState(VK_F2); GetAsyncKeyState(VK_F3); GetAsyncKeyState(VK_F4); GetAsyncKeyState(VK_F5); GetAsyncKeyState(VK_F6); GetAsyncKeyState(VK_F7); GetAsyncKeyState(VK_F8); GetAsyncKeyState(VK_F9); GetAsyncKeyState(VK_F10); GetAsyncKeyState(VK_F11); GetAsyncKeyState(VK_F12); }
if (!ignoreArrows) { GetAsyncKeyState(VK_LEFT); GetAsyncKeyState(VK_UP); GetAsyncKeyState(VK_RIGHT); GetAsyncKeyState(VK_DOWN); }
if (Kb_Key_Tab[0])GetAsyncKeyState(VK_TAB);
if (Kb_Key_Left_Alt[0])GetAsyncKeyState(VK_LMENU);
if (Kb_Key_Right_Alt[0])GetAsyncKeyState(VK_RMENU);
if (Kb_Key_Left_Ctrl[0])GetAsyncKeyState(VK_LCONTROL);
if (Kb_Key_Right_Ctrl[0])GetAsyncKeyState(VK_RCONTROL);
if (Kb_Key_Enter[0])GetAsyncKeyState(VK_RETURN);
if (Kb_Key_Caps[0])GetAsyncKeyState(VK_CAPITAL);
if (Kb_Key_Grave_Accent[0])GetAsyncKeyState(VK_OEM_3);
if (Kb_Key_Minus[0])GetAsyncKeyState(VK_OEM_MINUS);
if (Kb_Key_Equal[0])GetAsyncKeyState(VK_OEM_PLUS);
if (Kb_Key_Left_Bracket[0])GetAsyncKeyState(VK_OEM_4);
if (Kb_Key_Right_Bracket[0])GetAsyncKeyState(VK_OEM_6);
if (Kb_Key_Backslash[0])GetAsyncKeyState(VK_OEM_5);
if (Kb_Key_Semicolon[0])GetAsyncKeyState(VK_OEM_1);
if (Kb_Key_Quote[0])GetAsyncKeyState(VK_OEM_7);
if (Kb_Key_Comma[0])GetAsyncKeyState(VK_OEM_COMMA);
if (Kb_Key_Period[0])GetAsyncKeyState(VK_OEM_PERIOD);
if (Kb_Key_Forwardslash[0])GetAsyncKeyState(VK_OEM_2);
if (!ignoreNumPad) { GetAsyncKeyState(VK_NUMLOCK); GetAsyncKeyState(VK_DIVIDE); GetAsyncKeyState(VK_MULTIPLY); GetAsyncKeyState(VK_SUBTRACT); GetAsyncKeyState(VK_ADD); GetAsyncKeyState(VK_RETURN); GetAsyncKeyState(VK_DECIMAL); GetAsyncKeyState(VK_NUMPAD0); GetAsyncKeyState(VK_NUMPAD1); GetAsyncKeyState(VK_NUMPAD2); GetAsyncKeyState(VK_NUMPAD3); GetAsyncKeyState(VK_NUMPAD4); GetAsyncKeyState(VK_NUMPAD5); GetAsyncKeyState(VK_NUMPAD6); GetAsyncKeyState(VK_NUMPAD7); GetAsyncKeyState(VK_NUMPAD8); GetAsyncKeyState(VK_NUMPAD9); }
// if (!ignoreNumPad) { if (Kb_Key_Numlock[0]) GetAsyncKeyState(VK_NUMLOCK); if (Kb_Key_Numpad_Divide[0]) GetAsyncKeyState(VK_DIVIDE); if (Kb_Key_Numpad_Multiply[0]) GetAsyncKeyState(VK_MULTIPLY); if (Kb_Key_Numpad_Minus[0]) GetAsyncKeyState(VK_SUBTRACT); if (Kb_Key_Numpad_Add[0]) GetAsyncKeyState(VK_ADD); if (Kb_Key_Numpad_Enter[0]) GetAsyncKeyState(VK_RETURN); if (Kb_Key_Numpad_Period[0]) GetAsyncKeyState(VK_DECIMAL); if (Kb_Key_Numpad_0[0]) GetAsyncKeyState(VK_NUMPAD0); if (Kb_Key_Numpad_1[0]) GetAsyncKeyState(VK_NUMPAD1); if (Kb_Key_Numpad_2[0]) GetAsyncKeyState(VK_NUMPAD2); if (Kb_Key_Numpad_3[0]) GetAsyncKeyState(VK_NUMPAD3); if (Kb_Key_Numpad_4[0]) GetAsyncKeyState(VK_NUMPAD4); if (Kb_Key_Numpad_5[0]) GetAsyncKeyState(VK_NUMPAD5); if (Kb_Key_Numpad_6[0]) GetAsyncKeyState(VK_NUMPAD6); if (Kb_Key_Numpad_7[0]) GetAsyncKeyState(VK_NUMPAD7); if (Kb_Key_Numpad_8[0]) GetAsyncKeyState(VK_NUMPAD8); if (Kb_Key_Numpad_9[0]) GetAsyncKeyState(VK_NUMPAD9); }
if (Kb_Key_Insert[0]) GetAsyncKeyState(VK_INSERT); if (Kb_Key_Delete[0]) GetAsyncKeyState(VK_DELETE); if (Kb_Key_Home[0]) GetAsyncKeyState(VK_HOME); if (Kb_Key_End[0]) GetAsyncKeyState(VK_END); if (Kb_Key_PgUp[0]) GetAsyncKeyState(VK_PRIOR); if (Kb_Key_PgDn[0]) GetAsyncKeyState(VK_NEXT);
if (Kb_Key_Menu[0]) GetAsyncKeyState(VK_APPS); //menu
}
static void printDb() {
wcout << database << "\n";
wifstream f(database); wstring cell;
if (Unicode) f.imbue(locale(f.getloc(), new codecvt_utf8_utf16<wchar_t>));
while (getline(f, cell)) { wcout << cell << endl; }
f.close(); cout << endl;
}
static wstring loadVar(wstring q = L"") {
wifstream f(replacerDb); if (!f) { showOutsMsg(L"\nReplacerDb \"", replacerDb, L"\" not found!", 0); return q; }
if (Unicode) f.imbue(locale(f.getloc(), new codecvt_utf8_utf16<wchar_t>));
wstring cell, se; GetAsyncKeyState(VK_ESCAPE); while (getline(f, cell, multiLineDelim[0])) {
if (!NoEscapeOrPause && GetAsyncKeyState(VK_ESCAPE) || cell.substr(0, 4) == L"<'''") break;
if (!cell[0] || cell[0] == '\n' || cell[0] == ' ') continue;
se = cell.substr(0, q.length());
if (se == q) {
wstring v = cell.substr(q.length());
q = v;
f.close();
return q;
}
}
q.clear();
f.close();
return q;
}
static wstring isVar(wstring &q) { // Replacer | {var} {var:} {var-} {var>} | <r:>
if (!replacerDb[0]) return q;
if (q.find('{') != string::npos) {
wstring tqg = q, tq{};
GetAsyncKeyState(VK_ESCAPE);
while (tqg.find('{') != string::npos) {
if (!NoEscapeOrPause && GetAsyncKeyState(VK_ESCAPE)) break;
q = q.substr(q.find('{') + 1, q.find(L'}', q.find('{')) - q.find('{') - 1); tq = q;
if (q > L"") {
if (multiLineDelim[0] != '\\') { q = regex_replace(q, wregex(L"\n"), L""); q = regex_replace(q, wregex(L"\t"), L""); }
if (q[0] == '\'' && q != L"'") { tqg.replace(tqg.find('{'), 2 + q.length(), L""); q = tqg; continue; } //{'ignore}
q = loadVar(q);
}
if (q == L"") {
tqg.replace(tqg.find('{'), 1, L"::_::"); q = tqg;
continue;
}
q = regex_replace(q, wregex(L"\\$"), L":s:_:s:");
tq = regex_replace(tq, wregex(L"\\\\"), L":b:_:b:");
tq = regex_replace(tq, wregex(L"\\$"), L"\\$");
tq = regex_replace(tq, wregex(L"\\["), L"\\[");
tq = regex_replace(tq, wregex(L"\\]"), L"\\]");
tq = regex_replace(tq, wregex(L"\\("), L"\\(");
tq = regex_replace(tq, wregex(L"\\)"), L"\\)");
tq = regex_replace(tq, wregex(L"\\{"), L"\\{");
tq = regex_replace(tq, wregex(L"\\}"), L"\\}");
tq = regex_replace(tq, wregex(L"\\|"), L"\\|");
tq = regex_replace(tq, wregex(L"\\?"), L"\\?");
tq = regex_replace(tq, wregex(L"\\+"), L"\\+");
tq = regex_replace(tq, wregex(L"\\*"), L"\\*");
tq = regex_replace(tq, wregex(L"\\^"), L"\\^");
tq = regex_replace(tq, wregex(L"\\."), L"\\.");
tq = regex_replace(tq, wregex(L":b:_:b:"), L"\\\\");
tqg = regex_replace(tqg, wregex(L"\\{" + tq + L"\\}"), q);
q = tqg;
}
tqg = regex_replace(tqg, wregex(L"::_::"), L"{"); tqg = regex_replace(tqg, wregex(L":s:_:s:"), L"$"); q = tqg;
}
return q;
}
static wstring makeXY() {
wstring re = L"><shift>,<shift->xy:";
POINT pt; GetCursorPos(&pt);
wstring xy = to_wstring(pt.x) + L" " + to_wstring(pt.y);
re += xy;
re += L">";
if (showStrand) { showOutsMsg(L"", OutsTemplate, L"", 1); wcout << L"<xy:" + xy + L">\n"; }
return re;
}
static void scanDb(); static wstring conn(bool bg = 0) {//<connect:>
bool con = false; wstring qqs = qq.substr(0, qq.find('>') + 1);
if (qqs.find(io[0]) != std::string::npos || qqs.find(':') != std::string::npos || qqs.find('-') != std::string::npos) {// :> | ->
wstring x = L""; x += io[0]; x += L">";
if (qqs.substr(qqs.length() - 2, 2) == x || qqs.substr(qqs.length() - 2, 2) == L":>" || qqs.substr(qqs.length() - 2, 2) == L"->") {
con = true;
}
}
if (con) {
wifstream f(database); wstring cell;
if (Unicode) f.imbue(locale(f.getloc(), new codecvt_utf8_utf16<wchar_t>));//properties, general, language standard, >c++14 //_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
while (getline(f, cell, multiLineDelim[0])) {
if (cell.substr(0, 4) == L"<'''") break;
if (qqs == cell.substr(0, qqs.length())) { //<h:> | <h->
wstring x = cell.substr(qqs.length()), xx = qq.substr(qqs.length());
if (bg) return x;
if (relink) tail = x; else tail = x + xx;
tail = isVar(tail);
if (SlightPauseInBetweenConnects) Sleep(150);
f.close(); i = -1;
if (speed > 0) sleep = 0;
re = L" ";//codes
return L"";
}
} f.close(); if (fail) { if (showStrand && !assume) { wcout << "Fail: " << OutTab << OutTab << qqs << endl; } fail = 0; i = tail.length(); return L""; } printq();
}
else printq();
return L"";
}
static void setQxQy(wstring x, size_t z = 0) {
if (x.find(',') != string::npos) {
qx = x.substr(z, x.find(','));//x <xy:#,#>
qy = x.substr(x.find(',') + 1, x.find('>') - x.find(',') - 1);//y
}
else if (x.find(' ') != string::npos) {
qx = x.substr(z, x.find(' '));//x <xy:# #>
qy = x.substr(x.find(' ') + 1, x.find('>') - x.find(' ') - 1);
}
else { qx.clear(), qy.clear(); } //wcout << "x: " << x << "\nqx: " << qx << "\nqy: " << qy << endl;
}
static void kbPress(Multi multi, wstring s, short key) {
if (multiStrand) qq = multi.q;
if (qq.find('>') == std::string::npos) { printq(); return; }
wstring n = s;
if (qq[n.length()] == '>') star_num = L"1";
else {
n = qq.substr(n.length(), qq.find('>') - n.length());
if (n[0] == ':') n = n.substr(1);
if (n[0] == ' ') n = n.substr(1);
if ((qq[qq.find('>') - 1] == io[0] || qq.substr(qq.find('>') - 1, 1) == L":" || qq.substr(qq.find('>') - 1, 1) == L"-") && n[0] != '<') { conn(); return; }
if (n > L"") {
if (n[0] == '*') n = n.substr(1, n.length()); //case: <f1*
else if (n[0] == '+') { if (n[1] == '+') { ++ic; } n = to_wstring(ic); } //<f1+> | <f1++> | Variable press <key<+>>
n = check_if_num(n);
if (n == L"") { printq(); return; }
if (n[0] == '<') {//Assume
if (n[n.length() - 1] == io[0] || n[n.length() - 1] == ':' || n[n.length() - 1] == '-') {//<x:>
wstring t = qq;
qq = n + L">";
n = conn(1);
qq = t;
}
if (n.substr(1, 5) == L"rand:") {//x:<rand:0,5> | <up{x:}>
setQxQy(n, 6);
n = randn(1);
}
if (multiStrand) i = multi.i_;
if (n != L"0") i += 1;
if (n == L"0") { i += qq.find('>'); if (multiStrand) { multi.i_ = i; } return; }
}
star_num = n;
if (n[0] == '{' || !(stoi(n) > 0)) { printq(); return; };
}
else { printq(); return; }
}
INPUT ip[2]{}; ip[0].type = INPUT_KEYBOARD; ip[0].ki.wVk = key;
if (key == VK_LEFT || key == VK_UP || key == VK_RIGHT || key == VK_DOWN || key == VK_HOME || key == VK_END) ip[0].ki.dwFlags = 1; else ip[0].ki.dwFlags = 0;
ip[1] = ip[0]; ip[1].ki.dwFlags = 2;
auto sn = stoi(star_num);
for (int j = 0; j < sn; ++j) {
GetAsyncKeyState(VK_ESCAPE); if (GetAsyncKeyState(VK_ESCAPE)) { esc_pressed = 1; pause_resume = 0; if (speed > 0) { speed = 0; } return; }//stop
if (s.length() == 3) {
if (s == L"<lc") { mouseEvent(MOUSEEVENTF_LEFTDOWN); mouseEvent(MOUSEEVENTF_LEFTUP); }
else if (s == L"<rc") { mouseEvent(MOUSEEVENTF_RIGHTDOWN); mouseEvent(MOUSEEVENTF_RIGHTUP); }
else if (s == L"<mc") { mouseEvent(MOUSEEVENTF_MIDDLEDOWN); mouseEvent(MOUSEEVENTF_MIDDLEUP); }
else if (s == L"<sd" || s == L"<sr" || s == L"<su" || s == L"<sl") mouseEvent(MOUSEEVENTF_HWHEEL);
else SendInput(2, ip, sizeof(ip[0]));
}
else SendInput(2, ip, sizeof(ip[0]));
GetAsyncKeyState(key);
if (speed > 0 && sn != j + 1) Sleep(speed);
}
if (multiStrand) { i = multi.i_; qq = multi.q; }
i += qq.find('>');
if (multiStrand) multi.i_ = i;
}
static void out(wstring ai) { re = L">" + ai; strand.clear(); scanDb(); re.clear(); }
static void calc() {
if (assume) { i += qq.find('>'); return; }
qq = to_wstring(ic) + qq.substr(qq.find('>') + 1, qq.length());
i = -1;
if (speed > 0) sleep = 0;
re = L" ";
tail = qq;
}
static void loadSe() {
wifstream f(settings); if (!f) { showOutsMsg(L"\nSettings \"", settings, L"\" not found!", 0); if (!settings[0]) { cout << "Create c:\\dna\\se.txt manually\n"; } return; }
if (Unicode) f.imbue(locale(f.getloc(), new codecvt_utf8_utf16<wchar_t>));
wstring cell; while (getline(f, cell)) {
if (!cell[0] || cell[0] == ' ') continue;
wstring se = cell.substr(0, cell.find_first_of(L":\t ")); se += ':';
wstring v = (cell.substr(cell.find_first_of(L":\t ") + 1)); if (v.find_first_not_of(L"\t ") == string::npos) {//""
if (v != L" ") v.clear();
} if (se == cell + L":") v.clear();
if (v[0] && v != L" ") v = v.substr(v.find_first_not_of(L"\t "));
int x = 0; for (size_t i = 0; i <= se.length(); ++i) x += se[i];
if (v[0] == '>' && se.substr(0, 7) == L"Kb_Key_") {//set Kb_QQ_k
wstring s = se.substr(7);
if (s.length() > 2 || v[0] == '>') {
{ auto x = v.substr(1, v.find(' ') - 1); auto l = x.length(); bool b = x[0] < 127; qqLen = l > 0 && b ? l + 1 : b ? 1 : l / 2 + 1; } //Kb_Key_Comma >,, '<bs>
int x = 0; for (size_t i = 0; i <= s.length() - 2; ++i) x += s[i];
switch (x) {
case 391://Caps
Kb_QQ_k = VK_CAPITAL;
break;
case 283://Esc
Kb_QQ_k = VK_ESCAPE;
break;
case 779://Left_Alt
Kb_QQ_k = VK_LMENU;
break;
case 894://Right_Alt
Kb_QQ_k = VK_RMENU;
break;
case 493://Comma
Kb_QQ_k = VK_OEM_COMMA;
break;
default: qqLen = v.find_first_of(' ');
}
}
else
Kb_QQ_k = (short)se[se.length() - 2];
}
auto er = [se, v]() { showOutsMsg(L"Error in ", settings, L" [" + se + L" " + v + L"]", 0); };
switch (x) {
case 1536://RSHIFT+LSHIFT_Only:
{ if (short x = stoi(v); x >= 0) { RSHIFTLSHIFT_Only = x; rri = 0; } else er(); } break;
case 1261://LSHIFT+CtrlKey:
{ if (short x = stoi(v); x >= 0) LSHIFTCtrlKey = LSHIFTCtrlKeyMax = x; else er(); } break;
case 1972://RSHIFT+CtrlKey_Toggle:
{ if (short x = stoi(v); x >= 0) RSHIFTCtrlKeyToggle = RSHIFTCtrlKeyToggleMax = x; else er(); } break;
case 1273://ManualRepeat:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') ManualRepeat = stoi(v); else er(); } break;
case 959://AutoBs_io:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') io_Auto_BS = stoi(v); else er(); } break;
case 274://io:
{ if (!v[0]) { v[0] = ' '; } io = v; } break;
case 2738://ShowMultiStrandElapsedOnly:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') showMultiStrandElapsedOnly = stoi(v); else er(); } break;
case 865://PauseKey:
{ if (check_if_num(v)[0]) PauseKey = stoi(v); else er(); } break;
case 1543://NoEscapeOrPause:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') { NoEscapeOrPause = stoi(v); GetAsyncKeyState(VK_ESCAPE); } else er(); } break;
case 1708://Loop_Insert_Text:
{ if (!v[0]) { v[0] = '>'; } if (v[v.length() - 1] != '>') v += '>'; Loop_Insert_Text = v; } break;
case 1946://Kb_Key_Print_Screen:
Kb_Key_Print_Screen = v; break;
case 783://Kb_Key_A:
Kb_Key_A = v; break;
case 784://Kb_Key_B:
Kb_Key_B = v; break;
case 785://Kb_Key_C:
Kb_Key_C = v; break;
case 786://Kb_Key_D:
Kb_Key_D = v; break;
case 787://Kb_Key_E:
Kb_Key_E = v; break;
case 788://Kb_Key_F:
Kb_Key_F = v; break;
case 789://Kb_Key_G:
Kb_Key_G = v; break;
case 790://Kb_Key_H:
Kb_Key_H = v; break;
case 791://Kb_Key_I:
Kb_Key_I = v; break;
case 792://Kb_Key_J:
Kb_Key_J = v; break;
case 793://Kb_Key_K:
Kb_Key_K = v; break;
case 794://Kb_Key_L:
Kb_Key_L = v; break;
case 795://Kb_Key_M:
Kb_Key_M = v; break;
case 796://Kb_Key_N:
Kb_Key_N = v; break;
case 797://Kb_Key_O:
Kb_Key_O = v; break;
case 798://Kb_Key_P:
Kb_Key_P = v; break;
case 799://Kb_Key_Q:
Kb_Key_Q = v; break;
case 800://Kb_Key_R:
Kb_Key_R = v; break;
case 801://Kb_Key_S:
Kb_Key_S = v; break;
case 802://Kb_Key_T:
Kb_Key_T = v; break;
case 803://Kb_Key_U:
Kb_Key_U = v; break;
case 804://Kb_Key_V:
Kb_Key_V = v; break;
case 805://Kb_Key_W:
Kb_Key_W = v; break;
case 806://Kb_Key_X:
Kb_Key_X = v; break;
case 807://Kb_Key_Y:
Kb_Key_Y = v; break;
case 808://Kb_Key_Z:
Kb_Key_Z = v; break;
case 766://Kb_Key_0:
Kb_Key_0 = v; break;
case 767://Kb_Key_1:
Kb_Key_1 = v; break;
case 768://Kb_Key_2:
Kb_Key_2 = v; break;
case 769://Unicode: | //Kb_Key_3:
{ if (se == L"Unicode:") { if (v.length() == 1 && v[0] == '1' || v[0] == '0') Unicode = stoi(v); else er(); }
else if (se == L"Kb_Key_3:") Kb_Key_3 = v;
} break;
case 770://Kb_Key_4:
Kb_Key_4 = v; break;
case 771://Kb_Key_5:
Kb_Key_5 = v; break;
case 772://Kb_Key_6:
Kb_Key_6 = v; break;
case 773://Kb_Key_7:
Kb_Key_7 = v; break;
case 774://Kb_Key_8:
Kb_Key_8 = v; break;
case 775://Kb_Key_9:
Kb_Key_9 = v; break;
case 837://Kb_Key_F1:
Kb_Key_F1 = v; break;
case 838://Kb_Key_F2:
Kb_Key_F2 = v; break;
case 839://Kb_Key_F3:, EditorDb:
{ if (se == L"EditorDb:") editorDb = v;
else if (se == L"Kb_Key_F3:") Kb_Key_F3 = v;
} break;
case 840://Kb_Key_F4:
Kb_Key_F4 = v; break;
case 841://Kb_Key_F5:
Kb_Key_F5 = v; break;
case 842://Kb_Key_F6:
Kb_Key_F6 = v; break;
case 843://Kb_Key_F7:
Kb_Key_F7 = v; break;
case 844://Kb_Key_F8:
Kb_Key_F8 = v; break;
case 845://Kb_Key_F9:
Kb_Key_F9 = v; break;
case 885://Kb_Key_F10:
Kb_Key_F10 = v; break;
case 886://Kb_Key_F11:
Kb_Key_F11 = v; break;
case 887://Kb_Key_F12:
Kb_Key_F12 = v; break;
case 1113://Kb_Key_Left:
Kb_Key_Left = v; break;
case 1126://Kb_Key_Down:
Kb_Key_Down = v; break;
case 1210://Kb_Key_Space:
Kb_Key_Space = v; break;
case 1718://Kb_Key_Left_Shift:
Kb_Key_Left_Shift = v; break;
case 1833://Kb_Key_Right_Shift:
Kb_Key_Right_Shift = v; break;
case 1497://Kb_Key_Left_Alt:
Kb_Key_Left_Alt = v; break;
case 1612://Kb_Key_Right_Alt:
Kb_Key_Right_Alt = v; break;
case 1613://Kb_Key_Left_Ctrl:
Kb_Key_Left_Ctrl = v; break;
case 1728://Kb_Key_Right_Ctrl:
Kb_Key_Right_Ctrl = v; break;
case 1228://Kb_Key_Enter: | Kb_Key_Right:
{ if (se == L"Kb_Key_Enter:") Kb_Key_Enter = v;
else if (se == L"Kb_Key_Right:") Kb_Key_Right = v;
} break;
case 1109://Kb_Key_Caps:
Kb_Key_Caps = v; break;
case 1904://Kb_Key_Grave_Accent:
Kb_Key_Grave_Accent = v; break;
case 1242://Kb_Key_Minus:
Kb_Key_Minus = v; break;
case 1222://Kb_Key_Equal:
Kb_Key_Equal = v; break;
case 1908://Kb_Key_Left_Bracket:
Kb_Key_Left_Bracket = v; break;
case 1626://Kb_Key_Backslash:
Kb_Key_Backslash = v; break;
case 1655://Kb_Key_Semicolon:
Kb_Key_Semicolon = v; break;
case 1244://Kb_Key_Quote:
Kb_Key_Quote = v; break;
case 1211://Kb_Key_Comma:
Kb_Key_Comma = v; break;
case 1329://Kb_Key_Period:
Kb_Key_Period = v; break;
case 1982://Kb_Key_Forwardslash:
Kb_Key_Forwardslash = v; break;
case 1123://Kb_Key_Menu:
Kb_Key_Menu = v; break;
case 1347://Kb_Key_Insert:
Kb_Key_Insert = v; break;
case 1111://Kb_Key_Home:
Kb_Key_Home = v; break;
case 997://Kb_Key_End: | Kb_Key_Tab:
{ if (se == L"Kb_Key_End:") Kb_Key_End = v;
else if (se == L"Kb_Key_Tab:") Kb_Key_Tab = v;
} break;
case 1079://Kb_Key_PgDn:
Kb_Key_PgDn = v; break;
case 1474://Kb_Key_Numpad_0:
Kb_Key_Numpad_0 = v; break;
case 1475://Kb_Key_Numpad_1:
Kb_Key_Numpad_1 = v; break;
case 1476://Kb_Key_Numpad_2:
Kb_Key_Numpad_2 = v; break;
case 1477://Kb_Key_Numpad_3:
Kb_Key_Numpad_3 = v; break;
case 1478://Kb_Key_Numpad_4:
Kb_Key_Numpad_4 = v; break;
case 1479://Kb_Key_Numpad_5:
Kb_Key_Numpad_5 = v; break;
case 1480://Kb_Key_Numpad_6:
Kb_Key_Numpad_6 = v; break;
case 1481://Kb_Key_Numpad_7:
Kb_Key_Numpad_7 = v; break;
case 1482://Kb_Key_Numpad_8:
Kb_Key_Numpad_8 = v; break;
case 1483://Kb_Key_Numpad_9:
Kb_Key_Numpad_9 = v; break;
case 1447://Kb_Key_Numlock:
Kb_Key_Numlock = v; break;
case 2023://Kb_Key_Numpad_Divide: | Kb_Key_Right_Bracket:
{if (se == L"Kb_Key_Numpad_Divide:") Kb_Key_Numpad_Divide = v;
else if (se == L"Kb_Key_Right_Bracket:") Kb_Key_Right_Bracket = v;
} break;
case 2290://Kb_Key_Numpad_Multiply:
Kb_Key_Numpad_Multiply = v; break;
case 1950://Kb_Key_Numpad_Minus:
Kb_Key_Numpad_Minus = v; break;
case 1691://Kb_Key_Numpad_Add:
Kb_Key_Numpad_Add = v; break;
case 2037://Kb_Key_Numpad_Period:
Kb_Key_Numpad_Period = v; break;
case 1936://Kb_Key_Numpad_Enter:
Kb_Key_Numpad_Enter = v; break;
case 2066://DbMultiLineDelimiter:
multiLineDelim = v[0] != '\\' ? v[0] : L'\n'; break;
case 764://OutTabs:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') { OutTabs = stoi(v); OutTab = OutTabs ? L"\t" : L""; } else er(); } break;
case 1462://ClearStrandKey:
{ if (check_if_num(v)[0]) ClearStrandKey = stoi(v); else er(); } break;
case 1056://CommaSleep:
{ if (check_if_num(v)[0]) { if (stoi(v) <= 0) { v = L"1"; } CommaSleep = stoi(v); } else er(); } break;
case 673://Editor:
editor = v; break;
case 722://Editor1:
editor1 = v; break;
case 857://EditorSe:
editorSe = v; break;
case 680://Assume:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') assume = stoi(v); else er(); } break;
case 1095://ShowStrand:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') showStrand = stoi(v); else er(); } break;
case 847://Database:
{ if (v.length() > 0) { database = v; database = regex_replace(database, wregex(L"/"), L"\\"); db = database.substr(database.find_last_of('\\') + 1) + L" - "; } else er(); } break;
case 1038://ReplacerDb:
replacerDb = v; break;
case 1313://OutsTemplate: | Kb_Key_Delete:
{ if (se == L"OutsTemplate:") OutsTemplate = v;
else if (se == L"Kb_Key_Delete:") Kb_Key_Delete = v;
} break;
case 1354://CloseCtrlMode:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') close_ctrl_mode = stoi(v); else er(); } break;
case 1659://CtrlScanOnlyMode:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') qScanOnly = stoi(v); else er(); } break;
case 1677://StrandLengthMode:
{ if (short x = stoi(v); x >= 0) strandLengthMode = x; else er(); } break;
case 965://Ignore_A-Z:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') ignoreAZ = stoi(v); else er(); } break;
case 915://Ignore_0-9: | Kb_Key_Up:
{ if (se == L"Ignore_0-9:") { if (v.length() == 1 && v[0] == '1' || v[0] == '0') ignore09 = stoi(v); else er(); }
else if (se == L"Kb_Key_Up:")Kb_Key_Up = v;
} break;
case 1172://StartHidden:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') startHidden = stoi(v); else er(); } break;
case 760://CtrlKey: (vk_enum max)
{ if (v.find(' ') != string::npos) {
wstring max = v.substr(v.find(' ') + 1); if (max.find(' ') != string::npos || max[0] == 0) { er(); break; }
v = v.substr(0, v.find(' '));
cKeyMax = max == L"1" ? 3 : stoi(max);
} else cKeyMax = 1;
cKey = stoi(v); } break;
case 999://ShowIntro:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') showIntro = stoi(v); else er(); } break;
case 1324://ShowSettings:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') showSettings = stoi(v); else er(); } break;
case 1004://Frequency:
{ if (check_if_num(v)[0]) frequency = stoi(v); else er(); } break;
case 964://RepeatKey:
{ if (check_if_num(v)[0]) reKey = stoi(v); else er(); } break;
case 1649://AutoBs_RepeatKey:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') AutoBs_RepeatKey = stoi(v); else er(); } break;
case 2913://SlightPauseInBetweenConnects:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') SlightPauseInBetweenConnects = stoi(v); else er(); } break;
case 1571://CloseCtrlSpacer:
{ if (check_if_num(v)[0]) { if (stoi(v) <= 0) { v = L"1"; } CloseCtrlSpacer = stoi(v); } else er(); } break;
case 1467://RgbScaleLayout:
{ if (check_if_num(v)[0]) RgbScaleLayout = stod(v); else er(); } break;
case 1201://MultiStrand:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') multiStrand = stoi(v); else er(); } break;
case 1098://AutoBs_EscH: | Ignore_F1-F12: | Kb_Key_PgUp:
{ if (se == L"AutoBs_EscH:") { if (v.length() == 1 && v[0] == '1' || v[0] == '0') EscHAutoBs = stoi(v); else er(); }
else if (se == L"Ignore_F1-F12:") { if (v.length() == 1 && v[0] == '1' || v[0] == '0') ignoreF1s = stoi(v); else er(); }
else if (se == L"Kb_Key_PgUp:") Kb_Key_PgUp = v;
} break;
case 1519://AutoBs_EscComma:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') EscCommaAutoBs = stoi(v); else er(); } break;
case 1530://AutoBs_EscEqual:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') EscEqualAutoBs = stoi(v); else er(); } break;
case 1723://SeHotReload_CtrlS:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') SeHotReload_CtrlS = stoi(v); else er(); } break;
case 2098://SeDbClearStrand_CtrlS:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') SeDbClearStrand_CtrlS = stoi(v); else er(); } break;
case 1403://Ignore_Arrows:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') ignoreArrows = stoi(v); else er(); } break;
case 1001://Kb_Key_Esc:
Kb_Key_Esc = v; break;
case 1346://Ignore_NumPad:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') ignoreNumPad = stoi(v); else er(); } break;
case 934://Exit_EscX:
{ if (v.length() == 1 && v[0] == '1' || v[0] == '0') enableEscX = stoi(v); else er(); } break;
}
}
f.close();
}
static void printSe() {
loadSe();
if (showSettings) {
if (qq[1] == 'S') return;
wcout << settings << '\n'; ifstream f(settings); if (f.fail()) { showOutsMsg(L"Copy to ", settings, L"\n", 1); }
cout << "ShowSettings: " << showSettings << '\n';
cout << "ShowIntro: " << showIntro << '\n';
cout << "ShowStrand: " << showStrand << '\n';
cout << "ClearStrandKey: " << ClearStrandKey << '\n';
cout << "MultiStrand: " << multiStrand << '\n';
cout << "ShowMultiStrandElapsedOnly: " << showMultiStrandElapsedOnly << '\n';
wcout << "OutsTemplate: " << OutsTemplate << '\n';
wcout << "OutTabs: " << OutTabs << '\n';
wcout << "Settings: " << settings << '\n';
wcout << "Database: " << database << '\n';
cout << "DbMultiLineDelimiter: "; if (multiLineDelim[0] == '\n') cout << "\\n\n"; else showOutsMsg(L"", multiLineDelim, L"\n", 1);
wcout << "ReplacerDb: " << replacerDb << '\n';
cout << "CtrlKey: " << cKey << ' ' << cKeyMax << '\n';
cout << "LSHIFT+CtrlKey: " << LSHIFTCtrlKey << '\n';
cout << "CloseCtrlMode: " << close_ctrl_mode << '\n';
cout << "CloseCtrlSpacer: " << CloseCtrlSpacer << '\n';
cout << "RSHIFT+CtrlKey_Toggle: " << RSHIFTCtrlKeyToggle << '\n';
cout << "CtrlScanOnlyMode: " << qScanOnly << '\n';
cout << "RSHIFT+LSHIFT_Only: " << RSHIFTLSHIFT_Only << '\n';
cout << "StrandLengthMode: " << strandLengthMode << '\n';
cout << "RepeatKey: " << reKey << '\n';
cout << "PauseKey: " << PauseKey << '\n';
cout << "RgbScaleLayout: " << RgbScaleLayout << '\n';
cout << "Frequency: " << frequency << '\n';
cout << "Ignore_0-9: " << ignore09 << '\n';
wcout << "Kb_Key_0: " << Kb_Key_0 << '\n';
wcout << "Kb_Key_1: " << Kb_Key_1 << '\n';
wcout << "Kb_Key_2: " << Kb_Key_2 << '\n';
wcout << "Kb_Key_3: " << Kb_Key_3 << '\n';
wcout << "Kb_Key_4: " << Kb_Key_4 << '\n';
wcout << "Kb_Key_5: " << Kb_Key_5 << '\n';
wcout << "Kb_Key_6: " << Kb_Key_6 << '\n';
wcout << "Kb_Key_7: " << Kb_Key_7 << '\n';
wcout << "Kb_Key_8: " << Kb_Key_8 << '\n';
wcout << "Kb_Key_9: " << Kb_Key_9 << '\n';
cout << "Ignore_A-Z: " << ignoreAZ << '\n';
wcout << "Kb_Key_A: " << Kb_Key_A << '\n';
wcout << "Kb_Key_B: " << Kb_Key_B << '\n';
wcout << "Kb_Key_C: " << Kb_Key_C << '\n';
wcout << "Kb_Key_D: " << Kb_Key_D << '\n';
wcout << "Kb_Key_E: " << Kb_Key_E << '\n';
wcout << "Kb_Key_F: " << Kb_Key_F << '\n';
wcout << "Kb_Key_G: " << Kb_Key_G << '\n';
wcout << "Kb_Key_H: " << Kb_Key_H << '\n';
wcout << "Kb_Key_I: " << Kb_Key_I << '\n';
wcout << "Kb_Key_J: " << Kb_Key_J << '\n';
wcout << "Kb_Key_K: " << Kb_Key_K << '\n';
wcout << "Kb_Key_L: " << Kb_Key_L << '\n';
wcout << "Kb_Key_M: " << Kb_Key_M << '\n';
wcout << "Kb_Key_N: " << Kb_Key_N << '\n';
wcout << "Kb_Key_O: " << Kb_Key_O << '\n';
wcout << "Kb_Key_P: " << Kb_Key_P << '\n';
wcout << "Kb_Key_Q: " << Kb_Key_Q << '\n';
wcout << "Kb_Key_R: " << Kb_Key_R << '\n';
wcout << "Kb_Key_S: " << Kb_Key_S << '\n';
wcout << "Kb_Key_T: " << Kb_Key_T << '\n';
wcout << "Kb_Key_U: " << Kb_Key_U << '\n';
wcout << "Kb_Key_V: " << Kb_Key_V << '\n';
wcout << "Kb_Key_W: " << Kb_Key_W << '\n';
wcout << "Kb_Key_X: " << Kb_Key_X << '\n';
wcout << "Kb_Key_Y: " << Kb_Key_Y << '\n';
wcout << "Kb_Key_Z: " << Kb_Key_Z << '\n';
cout << "Ignore_Arrows: " << ignoreArrows << '\n';
wcout << "Kb_Key_Left: " << Kb_Key_Left << '\n';
wcout << "Kb_Key_Up: " << Kb_Key_Up << '\n';
wcout << "Kb_Key_Right: " << Kb_Key_Right << '\n';
wcout << "Kb_Key_Down: " << Kb_Key_Down << '\n';
wcout << "Kb_Key_Backslash: " << Kb_Key_Backslash << '\n';
wcout << "Kb_Key_Caps: " << Kb_Key_Caps << '\n';
wcout << "Kb_Key_Comma: " << Kb_Key_Comma << '\n';
wcout << "Kb_Key_Delete: " << Kb_Key_Delete << '\n';
wcout << "Kb_Key_End: " << Kb_Key_End << '\n';
wcout << "Kb_Key_Enter: " << Kb_Key_Enter << '\n';
wcout << "Kb_Key_Equal: " << Kb_Key_Equal << '\n';
wcout << "Kb_Key_Esc: " << Kb_Key_Esc << '\n';
cout << "Ignore_F1-F12: " << ignoreF1s << '\n';
wcout << "Kb_Key_F1: " << Kb_Key_F1 << '\n';
wcout << "Kb_Key_F2: " << Kb_Key_F2 << '\n';
wcout << "Kb_Key_F3: " << Kb_Key_F3 << '\n';
wcout << "Kb_Key_F4: " << Kb_Key_F4 << '\n';
wcout << "Kb_Key_F5: " << Kb_Key_F5 << '\n';
wcout << "Kb_Key_F6: " << Kb_Key_F6 << '\n';
wcout << "Kb_Key_F7: " << Kb_Key_F7 << '\n';
wcout << "Kb_Key_F8: " << Kb_Key_F8 << '\n';
wcout << "Kb_Key_F9: " << Kb_Key_F9 << '\n';
wcout << "Kb_Key_F10: " << Kb_Key_F10 << '\n';
wcout << "Kb_Key_F11: " << Kb_Key_F11 << '\n';
wcout << "Kb_Key_F12: " << Kb_Key_F12 << '\n';
wcout << "Kb_Key_Print_Screen: " << Kb_Key_Print_Screen << '\n';
wcout << "Kb_Key_Forwardslash: " << Kb_Key_Forwardslash << '\n';
wcout << "Kb_Key_Grave_Accent: " << Kb_Key_Grave_Accent << '\n';
wcout << "Kb_Key_Home: " << Kb_Key_Home << '\n';
wcout << "Kb_Key_Insert: " << Kb_Key_Insert << '\n';
wcout << "Kb_Key_Left_Alt: " << Kb_Key_Left_Alt << '\n';
wcout << "Kb_Key_Left_Bracket: " << Kb_Key_Left_Bracket << '\n';
wcout << "Kb_Key_Left_Ctrl: " << Kb_Key_Left_Ctrl << '\n';
wcout << "Kb_Key_Left_Shift: " << Kb_Key_Left_Shift << '\n';
wcout << "Kb_Key_Menu: " << Kb_Key_Menu << '\n';
wcout << "Kb_Key_Minus: " << Kb_Key_Minus << '\n';
cout << "Ignore_NumPad: " << ignoreNumPad << '\n';
wcout << "Kb_Key_Numpad_0: " << Kb_Key_Numpad_0 << '\n';
wcout << "Kb_Key_Numpad_1: " << Kb_Key_Numpad_1 << '\n';
wcout << "Kb_Key_Numpad_2: " << Kb_Key_Numpad_2 << '\n';
wcout << "Kb_Key_Numpad_3: " << Kb_Key_Numpad_3 << '\n';
wcout << "Kb_Key_Numpad_4: " << Kb_Key_Numpad_4 << '\n';
wcout << "Kb_Key_Numpad_5: " << Kb_Key_Numpad_5 << '\n';
wcout << "Kb_Key_Numpad_6: " << Kb_Key_Numpad_6 << '\n';
wcout << "Kb_Key_Numpad_7: " << Kb_Key_Numpad_7 << '\n';
wcout << "Kb_Key_Numpad_8: " << Kb_Key_Numpad_8 << '\n';
wcout << "Kb_Key_Numpad_9: " << Kb_Key_Numpad_9 << '\n';
wcout << "Kb_Key_Numlock: " << Kb_Key_Numlock << '\n';
wcout << "Kb_Key_Numpad_Divide: " << Kb_Key_Numpad_Divide << '\n';
wcout << "Kb_Key_Numpad_Multiply: " << Kb_Key_Numpad_Multiply << '\n';
wcout << "Kb_Key_Numpad_Minus: " << Kb_Key_Numpad_Minus << '\n';
wcout << "Kb_Key_Numpad_Add: " << Kb_Key_Numpad_Add << '\n';
wcout << "Kb_Key_Numpad_Period: " << Kb_Key_Numpad_Period << '\n';
wcout << "Kb_Key_Numpad_Enter: " << Kb_Key_Numpad_Enter << '\n';
wcout << "Kb_Key_Period: " << Kb_Key_Period << '\n';
wcout << "Kb_Key_PgDn: " << Kb_Key_PgDn << '\n';
wcout << "Kb_Key_PgUp: " << Kb_Key_PgUp << '\n';
wcout << "Kb_Key_Quote: " << Kb_Key_Quote << '\n';
wcout << "Kb_Key_Right_Alt: " << Kb_Key_Right_Alt << '\n';
wcout << "Kb_Key_Right_Bracket: " << Kb_Key_Right_Bracket << '\n';
wcout << "Kb_Key_Right_Ctrl: " << Kb_Key_Right_Ctrl << '\n';
wcout << "Kb_Key_Right_Shift: " << Kb_Key_Right_Shift << '\n';
wcout << "Kb_Key_Semicolon: " << Kb_Key_Semicolon << '\n';
wcout << "Kb_Key_Space: " << Kb_Key_Space << '\n';
wcout << "Kb_Key_Tab: " << Kb_Key_Tab << '\n';
cout << "StartHidden: " << startHidden << '\n';
cout << "SlightPauseInBetweenConnects: " << SlightPauseInBetweenConnects << '\n';
cout << "CommaSleep: " << CommaSleep << '\n';
cout << "AutoBs_EscH: " << EscHAutoBs << '\n';
cout << "AutoBs_EscComma: " << EscCommaAutoBs << '\n';
cout << "AutoBs_EscEqual: " << EscEqualAutoBs << '\n';
cout << "AutoBs_RepeatKey: " << AutoBs_RepeatKey << '\n';
cout << "SeHotReload_CtrlS: " << SeHotReload_CtrlS << '\n';
cout << "SeDbClearStrand_CtrlS: " << SeDbClearStrand_CtrlS << '\n';
cout << "Assume: " << assume << '\n';
cout << "Unicode: " << Unicode << '\n';
wcout << "Editor: " << editor << '\n';
wcout << "Editor1: " << editor1 << '\n';
wcout << "EditorDb: "; showOutsMsg(editorDb, L"", L"", 0);
wcout << "EditorSe: "; showOutsMsg(editorSe, L"", L"", 0);
wcout << "Loop_Insert_Text: " << Loop_Insert_Text << '\n';
cout << "NoEscapeOrPause: " << NoEscapeOrPause << '\n';
wcout << "io: " << io << '\n';
wcout << "AutoBs_io: " << io_Auto_BS << '\n';
wcout << "ManualRepeat: " << ManualRepeat << '\n';
cout << "Exit_EscX: " << enableEscX << '\n';
cout << endl;
}
}
static void toggle_visibility() {
if (IsWindowVisible(GetConsoleWindow())) {
SetForegroundWindow(GetConsoleWindow());
kb(VK_F12);//if title "Select dnaspider"
ShowWindow(GetConsoleWindow(), SW_HIDE);
}
else
ShowWindow(GetConsoleWindow(), SW_SHOW);
Sleep(150);
strand = L"";
}
static wstring getAppT() {
HWND h = GetForegroundWindow();
int l = GetWindowTextLength(h);
wstring title(l, 0);
GetWindowTextW(h, &title[0], l + 1);
title = regex_replace(title, wregex(L","), L"\\,"); title = regex_replace(title, wregex(L">"), L"\\g"); title = regex_replace(title, wregex(L"\\|"), L"\\|"); title = regex_replace(title, wregex(L"&"), L"\\&");
return title;
}
static wstring makeApp() {
wstring re = L"", x = L"><shift>,<shift->app:";
out(L"<alt><esc><alt-><,1>");
x += getAppT();
out(L"<shift><alt><esc><alt-><shift->");
re = x + (Loop_Insert_Text > L"" ? Loop_Insert_Text : L">");
return re;
}
static wstring getRGB(bool b = 0, bool bg = 0) {
POINT pt; GetCursorPos(&pt); COLORREF color; HDC hDC;