This repository has been archived by the owner on Jan 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
mdlMain.bas
1390 lines (1271 loc) · 56 KB
/
mdlMain.bas
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
Attribute VB_Name = "mdlMain"
Option Explicit
Option Compare Text
Public Const MARKER_SIZE = 24
Public Const FuncsCount = 28
' ******************** V - Variantes *******************************
Public ruFunctions(), enFunctions(), FuncsFirstTextParam(), _
ClickV(), WaitV(), PressV(), ExitV(), StartScriptV(), SetCursorPosV(), LoopV(), _
MsgBoxV(), InputBoxV(), PrintV(), CreateFileV(), WriteFileV(), ReadFileV(), _
SetWindowV(), ShowWindowV(), ShellV(), StopV(), SkipErrorsV(), ChangeResolutionV(), _
DeleteFileV(), KillProcessV(), DeleteDirV(), CreateDirV(), CloseWindowV(), DownloadFileV(), _
IfV(), VBScriptV(), GoToV()
Public blnExecuting As Boolean, NowHelp As String, blnMarkerShowed As Boolean, _
ConstName() As String, ConstVal() As String, FuncName(), FuncVal(), Funcs() As Variant, _
SpecialCharsArray() As String, arr As Variant, ClicksArray() As String, Operations() As String, _
VarName() As Variant, VarVal() As Variant, VarsCount As Long, tDebug As Object, blnCancel As Boolean, i&, n&, _
SelectedWindow As WindowMinAttribs, Window As RECT ' ãëîáàëüíàÿ ïåðåìåííàÿ Window, ÷òîá íå îáúÿâëÿòü ïî ñòî ðàç â ìîäóëÿõ
Public MaxLines As Long, Settings As mySettings, Resolution As POINTAPI, History As typeHistory, LoadedFile As typeFileStruct, _
CommandLine As typeCommandLineSettings, ScriptsPath As String, ErrorTitle As String, Downloader As ResponseInfo
Public VBScript As New ScriptControl
Type typeCommandLineSettings
HideMode As Boolean
SkipErrors As Boolean
Exit As Boolean
DisableHKs As Boolean
AutoStart As Boolean
FileName As String
Count As Long
End Type
Enum LoadSettingsMode
lsmAll
lsmPSettings
lsmSSettings
End Enum
Type typeHistory
Text() As String
Step As Long
SelStart() As Long
End Type
Type mySettings
bRecCursor As Boolean
bRecByWindow As Boolean
bReturnCursor As Boolean
lngUpdateMousePosInterval As Long
bShowListTT As Boolean
bShowTextTT As Boolean
bShowDebug As Boolean
bShowMarker As Boolean
' ---Script Settings ---
sngSpeed As Single
bSkipErrors As Boolean
bFakeWait As Boolean
lngIntervalLimit As Long
lngCoordsLimit As Long
lngDelayDownUp As Long
MouseMode As MouseModes
' ******* Specials
bSpecial1 As Boolean
End Type
Enum ToolTipType
tttFunc = 1
tttParam = 2
End Enum
Enum ParamType
' ptAny = 0
' ptAnyNum = 1
ptYesOrNo = 2
ptMouseEvent = 3
ptMouseKey = 4
ptMsgBoxStyle = 5
ptAppWinStyle = 6
ptHTTPmethod = 7
ptFunction = 10
End Enum
Enum ReplaceType
rtFunc = 1
rtParam = 2
rtVar = 3
rtExpression = 4 ' äëÿ ìàòèìàòè÷åñêèõ âûðàæåíèé
End Enum
Enum ActionType
atUnknown
atFunc
atOperation
End Enum
' /////////////// Error Struct ////////////////////
Public GlobalError As MyError
Public Const ErrNum = 66
Type MyError
Expression As Variant
Stage() As String
StageCount As Long
Description As String
line As Long 'LineNumber
End Type
' /////////////// Error Struct ////////////////////
Public Const DefaultColor = &HF1E4D9, RunColor = &H80000018, RecColor = &HC0&
Type POINTAPI
x As Long
Y As Long
End Type
Declare Function GetActiveWindow Lib "user32" () As Long
Declare Function GetForegroundWindow Lib "user32" () As Long
Declare Function GetTickCount Lib "kernel32.dll" () As Long
Declare Function GetUserDefaultLangID Lib "kernel32.dll" () As Integer '1049 - ðóññêèé
Declare Function DrawText Lib "user32" Alias "DrawTextW" (ByVal hDC As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Public Declare Function PostMessage Lib "user32.dll" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const WM_LBUTTONDBLCLK As Long = &H203
Public Const WM_LBUTTONDOWN As Long = &H201
Public Const WM_LBUTTONUP As Long = &H202
Public Const WM_RBUTTONDBLCLK As Long = &H206
Public Const WM_RBUTTONDOWN As Long = &H204
Public Const WM_RBUTTONUP As Long = &H205
Public Const WM_MBUTTONDBLCLK As Long = &H209
Public Const WM_MBUTTONDOWN As Long = &H207
Public Const WM_MBUTTONUP As Long = &H208
Public Const WM_SHOWWINDOW As Long = &H18
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Public Const SM_CYVTHUMB = 9 'Height of scroll box on horizontal scroll bar
Public Const SM_CXHTHUMB = 10 ' Width of scroll box on horizontal scroll bar
Public Const SM_CYCAPTION = 4 'Height of windows caption
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Declare Function GetCaretPos Lib "user32.dll" (ByRef lpPoint As POINTAPI) As Long
Declare Function HideCaret Lib "user32" (ByVal hwnd As Long) As Long
Declare Function ShowCaret Lib "user32" (ByVal hwnd As Long) As Long
'Public Declare Function IsUserAnAdmin Lib "shell32" () As Long
'
Public Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
'MessageBox 0, "Òåêñò ñîîáùåíèÿ", "Çàãîëîâîê ñîîáùåíèÿ", 48 (type)
Public Declare Function WinExec Lib "kernel32" (ByVal lpCmdLine As String, ByVal nCmdShow As Long) As Long
''WinExec "cmd /c C:\Windows\system32\calc.exe", 0
'
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
''äëÿ runas = ShellExecute 0, "runas", "C:\Windows\system32\cmd.exe", "", "C:\Windows\system32", 1
Function StartProgramm(ByVal sProgrammName As String, Optional ByVal sParameters As String)
If InStr(1, sProgrammName, ":\") = 0 Then sProgrammName = App.Path & "\" & sProgrammName
If IsFileExists(sProgrammName) Then
Shell sProgrammName & " " & sParameters, vbNormalFocus
Else
ShowNotFoundProgramm sProgrammName
End If
End Function
Sub ShowNotFoundProgramm(ByVal sFullName As String)
MsgBox "Ôàéë ñ èìåíåì '" & sFullName & "' íå íàéäåí. Ïîâòîðíàÿ óñòàíîâêà ïðèëîæåíèÿ ìîæåò ðåøèòü äàííóþ ïðîáëåìó.", vbExclamation, "Ôàéë íå íàéäåí"
End Sub
Function GetCount(ByVal str As String, ByVal Find As String) As Long
If str = "" Then Exit Function
GetCount = UBound(Split(str, Find))
End Function
Function GetLinesCount(ByVal str As String) As Long
str = vbCrLf & str
GetLinesCount = UBound(Split(str, vbCrLf))
End Function
Function GetLineNumberByCharNumber(ByVal str As String, ByVal CharNum As Long) As Long
Dim PrevCrLf As Long
If CharNum = 0 Then GetLineNumberByCharNumber = 1: Exit Function
If InStrRev(str, vbCrLf, CharNum) = 0 Then GetLineNumberByCharNumber = 1: Exit Function
If InStr(CharNum, str, vbCrLf) = 0 Then GetLineNumberByCharNumber = GetLinesCount(str): Exit Function
For n = 1 To GetLinesCount(str)
GetLineNumberByCharNumber = InStr(GetLineNumberByCharNumber + 1, str, vbCrLf)
If CharNum > PrevCrLf And CharNum < GetLineNumberByCharNumber Then
GetLineNumberByCharNumber = n
Exit For
End If
PrevCrLf = GetLineNumberByCharNumber
Next n
End Function
Function JustPositive(ByVal num As Long) As Long
If num < 0 Then JustPositive = 0 Else JustPositive = num
End Function
Sub ConvertResolution(ByRef x As Long, ByRef Y As Long, ByVal RecordResX As Long, ByVal RecordResY As Long, ByVal CurrentResX As Long, ByVal CurrentResY As Long)
x = x / (RecordResX / CurrentResX)
Y = Y / (RecordResY / CurrentResY)
End Sub
Sub GetLines(ByVal str As String, ByRef GetTo() As String, Optional GetLinesCountTo As Long)
str = vbCrLf & str '÷òîáû íà÷àòü ñ 1, à íå ñ 0
GetTo = Split(str, vbCrLf)
GetLinesCountTo = UBound(GetTo)
End Sub
Function ReplaceCrLf(ByVal str As String)
ReplaceCrLf = str
While InStr(1, ReplaceCrLf, vbCrLf & vbCrLf)
ReplaceCrLf = Replace(ReplaceCrLf, vbCrLf & vbCrLf, vbCrLf)
Wend
If Right(ReplaceCrLf, 2) = vbCrLf Then ReplaceCrLf = Left(ReplaceCrLf, Len(ReplaceCrLf) - 2)
If Left(ReplaceCrLf, 2) = vbCrLf Then ReplaceCrLf = Right(ReplaceCrLf, Len(ReplaceCrLf) - 2)
End Function
Sub GetSides(ByVal str As String, Side1, Side2, ByVal sDelimiter As String)
Dim DelimiterPos As Long
DelimiterPos = InStr(1, str, sDelimiter)
Side1 = Left(str, DelimiterPos - 1)
Side2 = Right(str, Len(str) - DelimiterPos - (Len(sDelimiter) - 1))
End Sub
Sub SetCustomConsts(str As String)
Dim line() As String, LinesCount As Long, n As Long
str = ReplaceCrLf(str)
GetLines str, line, LinesCount
ReDim ConstName(1 To LinesCount)
ReDim ConstVal(1 To LinesCount)
For n = 1 To LinesCount
GetSides line(n), ConstName(n), ConstVal(n), "="
Next n
End Sub
Function GetLineByLineNumber(ByVal str As String, ByVal LineNumber As Long, Optional GetLineStartTo As Long, Optional GetLineEndTo As Long) As String
Dim Lines() As String
GetLines str, Lines()
GetLineByLineNumber = Lines(LineNumber)
For n = 1 To LineNumber - 1
GetLineStartTo = InStr(GetLineStartTo + 1, str, vbCrLf)
Next n
If GetLineStartTo = 0 Then GetLineStartTo = 1
If GetLineStartTo > 1 Then GetLineStartTo = GetLineStartTo + 2
GetLineEndTo = InStr(GetLineStartTo + 1, str, vbCrLf)
If GetLineEndTo = 0 Then GetLineEndTo = Len(str)
End Function
Function GetLineByCharNumber(ByVal str As String, ByVal CharNumber As Long, Optional GetLineStartTo As Long, Optional GetLineEndTo As Long) As String
GetLineByCharNumber = GetLineByLineNumber(str, GetLineNumberByCharNumber(str, CharNumber), GetLineStartTo, GetLineEndTo)
End Function
Sub SetCustomFunctions(str As String)
Dim n As Long, EquallyPos As Long, FuncStart As Long, FuncEnd As Long, BlockStart As Long, BlockEnd As Long, Block As String, BlocksCount As Long
str = ReplaceCrLf(str)
ReplaceOutQuotes str, "[", "{"
ReplaceOutQuotes str, "]", "}"
BlocksCount = UBound(Split(str, "="))
ReDim FuncName(1 To BlocksCount)
ReDim FuncVal(1 To BlocksCount)
For n = 1 To BlocksCount
EquallyPos = InStr(BlockEnd + 1, str, "=") ' EquallyPos - Ïîçèöèÿ çíàêà =
BlockStart = InStrRev(str, vbCrLf, EquallyPos)
BlockEnd = InStr(BlockStart + 1, str, "}")
Block = Mid(str, BlockStart + 1, BlockEnd - BlockStart)
GetSides Block, FuncName(n), FuncVal(n), "="
ReplaceOutQuotes FuncVal(n), "}", ""
ReplaceOutQuotes FuncVal(n), "{", ""
FuncVal(n) = ReplaceCrLf(FuncVal(n))
Next n
End Sub
Function IsFormLoaded(ByVal sName As String) As Boolean
Dim arr
For Each arr In Forms
If arr.Name = sName Then IsFormLoaded = True: Exit Function
Next
End Function
Sub ShowMarker(Optional ByVal FuncInLine As Long, Optional ByVal bCallByUser As Boolean)
On Error Resume Next
Const lngTimeOfAppearance As Long = 200, lngUpdateInterval As Long = 10 ' èíòåðâàë îáíîâëåíèÿ ìàðêåðà - êàæäûå 10 ìñ
Dim Point As POINTAPI, Params(), Left As Single, Top As Single, FormSize As Single, _
lngEndTime As Long, lngTransparency As Long, lngDifference As Long, lngPrevDifference As Long
If FuncInLine = cClick Or FuncInLine = cSetCursorPos Then Point = GetPoint
If (Point.x = 0 And Point.Y = 0) Then
If bCallByUser Then GetCursorPosPT Point Else GoTo lHide
End If
Left = Point.x * Screen.TwipsPerPixelX
Top = Point.Y * Screen.TwipsPerPixelY
If Not IsFormLoaded("frmMarker") Then
Load frmMarker
frmMarker.Show , frmMain
Wait 1, False
frmMain.Show
End If
With frmMarker
If CompareValues(Point.x, .GetMarkerX, 5) And CompareValues(Point.Y, .GetMarkerY, 5) And blnMarkerShowed Then Exit Sub
blnMarkerShowed = True
.Move Left, Top
Alpha .hwnd, 5
lngPrevDifference = -1
lngEndTime = GetPerformanceTime + lngTimeOfAppearance
Do While lngEndTime > GetPerformanceTime
lngDifference = lngTimeOfAppearance - (lngEndTime - GetPerformanceTime)
If CompareValues(lngDifference, lngPrevDifference, lngUpdateInterval) Then GoTo lContinue
lngTransparency = GetSmartValue(lngDifference, lngTimeOfAppearance, 5, 220) ' îò 5 äî 220
FormSize = GetSmartValue(lngDifference, lngTimeOfAppearance, 1, MARKER_SIZE) ' ðàçìåð ôîðìû â ïèêñåëÿõ
DrawForm .hwnd, CLng(FormSize)
Alpha .hwnd, lngTransparency
.Left = Left - ((FormSize * Screen.TwipsPerPixelX) / 2)
.Top = Top - ((FormSize * Screen.TwipsPerPixelY) / 2)
lngPrevDifference = lngDifference
lContinue:
DoEvents
Loop
End With
Exit Sub
lHide:
HideMarker
End Sub
Function CompareValues(ByVal Val1 As Double, ByVal Val2 As Double, ByVal Imprecision As Double) As Boolean
If Abs(Val1 - Val2) <= Imprecision Then CompareValues = True
End Function
Function HideMarker()
If blnMarkerShowed Then
If frmMarker.mnuAlwaysOnTop.Checked = False Then
blnMarkerShowed = False
Alpha frmMarker.hwnd, 5
End If
End If
End Function
Function GetSmartValue(ByVal nVal As Double, ByVal nMaxVal As Double, ByVal Minimum As Double, ByVal Maximum As Double) As Double
GetSmartValue = Maximum * (nVal / nMaxVal)
If GetSmartValue < Minimum Then GetSmartValue = Minimum
End Function
Function GetPoint() As POINTAPI
Dim Params()
ParseParameters GetParamLine(GetScript(frmMain.GetScriptLine), 4), Params()
If (Not Not Params) = 0 Then Exit Function
If IsNumeric(Params(1)) Then GetPoint.x = Params(1)
If UBound(Params) > 1 Then
If IsNumeric(Params(2)) Then GetPoint.Y = Params(2)
End If
If GetPoint.x > Screen_Width Then GetPoint.x = Screen_Width
If GetPoint.Y > Screen_Height Then GetPoint.Y = Screen_Height
End Function
Function Any2Str(num As Variant) As String
Dim i&, d&, a&
If Settings.bSkipErrors Then
On Error GoTo lSkip
Else
On Error GoTo ErrHandler
End If
a = InStr(1, num, "+")
If a Then
Any2Str = Left(num, a - 2)
d = Right(num, Len(CStr(num)) - a)
For i = 1 To d
Any2Str = IIf(Abs(Any2Str) < 100000000000000#, Any2Str * 10, Any2Str & 0)
Next i
Else
a = InStr(2, num, "-")
If a Then
Any2Str = Left(num, a - 2)
d = Right(num, Len(CStr(num)) - a)
For i = 1 To d
Any2Str = IIf(InStr(1, Any2Str, ",") = 0 Or Abs(Any2Str) > 1, Any2Str / 10, Replace(Any2Str, ",", ",0"))
Next i
End If
End If
Ends:
If Any2Str = "" Then Any2Str = num
Exit Function
lSkip:
ADL "íå ïîëó÷àåòñÿ ïðåîáðàçîâàòü ÷èñëî â òåêñòîâûé âèä"
Exit Function
ErrHandler:
GlobalError.Description = "Îøèáêà ïðè ïîïûòêå ïðåîáðàçîâàòü ÷èñëî â òåêñòîâûé âèä"
Call GlobalErrorHandler
End Function
Sub GlobalErrorHandler()
ErrorTitle = Err.Description
If Not blnExecuting Then Err.Clear: Exit Sub
'ADL "Êðèòè÷åñêàÿ îøèáêà", , True
frmErrorBox.ShowError
Err.Clear
blnExecuting = False
frmMain.SetNormalState
frmMain.UpdateAll
End Sub
Sub LogEvent(ByVal sEvent As String)
Const LogName = "Log.txt"
If CommandLine.HideMode Then Exit Sub
If frmPSettings.chkLog.Value = 1 Then
WriteFileRev App.Path & "\" & LogName, EventTime & sEvent & vbCrLf
End If
End Sub
Function fDate()
fDate = Format(Date, "dd.mm.yy")
End Function
Function fTime()
fTime = Format(Time, "hh:mm:ss")
End Function
Function EventTime() As String
EventTime = "[" & fDate & "]" & "[" & fTime & "] "
End Function
Sub ADL(line As String, Optional IsError As Boolean = True, Optional SaveErr As Boolean) ' Add Debug Line
ErrorTitle = Err.Description
If Not Settings.bShowDebug Then Exit Sub
If CommandLine.HideMode Then Exit Sub
If IsError Then
line = "Îøèáêà íà ñòðîêå " & GlobalError.line & ": " & line
If Not SaveErr Then Err.Clear
End If
If Right(tDebug, 2) = vbCrLf Then
tDebug = tDebug & line
ElseIf tDebug = "" Then
tDebug = line
Else
tDebug = tDebug & vbCrLf & line
End If
If frmDebug.Left > (Screen.TwipsPerPixelX * (Screen_Width - 66)) Or frmDebug.Left < 0 Then frmDebug.Left = Screen.Width / 2 - frmDebug.Width / 2
If frmDebug.Top > (Screen.TwipsPerPixelY * (Screen_Height - 66)) Or frmDebug.Top < 0 Then frmDebug.Top = Screen.Height / 2 - frmDebug.Height / 2
If frmDebug.Visible = False Then frmDebug.Show , frmMain
tDebug.SelStart = Len(tDebug)
End Sub
Sub CleanAll()
Dim EmptyError As MyError, EmptyWindow As WindowMinAttribs
Resolution.x = 0
Resolution.Y = 0
GlobalError = EmptyError
SelectedWindow = EmptyWindow
tDebug = ""
ReDim VarName(1000)
ReDim VarVal(1000)
VarsCount = 0
End Sub
Sub AddStage(StageName As String)
Dim ExistSubNum As Long
GlobalError.StageCount = GlobalError.StageCount + 1
ReDim Preserve GlobalError.Stage(1 To GlobalError.StageCount)
For n = 1 To GlobalError.StageCount 'ñïåöèàëüíàÿ ïðîâåðêà íà òî, ñóùåñòâóåò ëè ôóíêöèÿ óæå â ìàññèâå, è åñëè äà, òî ñòåðåòü âñå ïîñëåäóþùèå çà íåé ôóíêöèè
If Len(GlobalError.Stage(n)) > 8 Then If Right$(GlobalError.Stage(n), Len(GlobalError.Stage(n)) - 8) = StageName Then ExistSubNum = n
If ExistSubNum > 0 And n > ExistSubNum Then
GlobalError.Stage(n) = ""
End If
Next n
If ExistSubNum = 0 Then
GlobalError.Stage(GlobalError.StageCount) = "Ýòàï " & GlobalError.StageCount & ": " & StageName
Else
GlobalError.StageCount = ExistSubNum
End If
'ADL GlobalError.Stage(GlobalError.StageCount)
End Sub
Function GetLargestNum(Numbers() As Double, Optional ByRef GetPosTo As Long) As Variant 'ïîêà ðàáîòàåò òîëüêî äëÿ ÷èñåë > 0
For n = LBound(Numbers) To UBound(Numbers)
If GetLargestNum < CDbl(Numbers(n)) Then GetLargestNum = Numbers(n): GetPosTo = n
Next n
End Function
Function GetLargestLen(Strings() As String) As Variant 'ïîêà ðàáîòàåò òîëüêî äëÿ ÷èñåë > 0
For n = LBound(Strings) To UBound(Strings)
If GetLargestLen < Len(Strings(n)) Then GetLargestLen = Len(Strings(n))
Next n
End Function
Sub StopAll()
blnRec = False
blnExecuting = False
DoEvents
End Sub
Sub SaveSettings(Optional blnSaveScriptSettings As Boolean)
Dim strSection As String
'If Dir(App.Path & "\" & SETTINGS_FILENAME) <> "" Then Kill App.Path & "\" & SETTINGS_FILENAME
strSection = "Main"
With frmMain
WriteIni "WindowState", .WindowState, strSection
WriteIni "Left", .Left, strSection
WriteIni "Top", .Top, strSection
WriteIni "Width", .Width, strSection
WriteIni "Height", .Height, strSection
End With
strSection = "File"
With LoadedFile
WriteIni "FileName", .FileName, strSection
WriteIni "Path", .Path, strSection
WriteIni "BaseName", .BaseName, strSection
WriteIni "BaseTitle", .BaseTitle, strSection
End With
strSection = "Debug"
With frmDebug
WriteIni "Left", .Left, strSection
WriteIni "Top", .Top, strSection
WriteIni "Width", .Width, strSection
WriteIni "Height", .Height, strSection
End With
strSection = "PSettings"
With frmPSettings
WriteIni "RecCursor", .chkRecCursor, strSection
WriteIni "UpdateMousePosInterval", .txtUpdateMousePosInterval, strSection
WriteIni "ReturnCursor", .chkReturnCursor, strSection
WriteIni "RecByWindow", .chkRecByWindow, strSection
WriteIni "ShowDebug", .chkShowDebug, strSection
WriteIni "ShowListTT", .chkShowListTT, strSection
WriteIni "ShowTextTT", .chkShowTextTT, strSection
WriteIni "ShowMarker", .chkShowMarker, strSection
WriteIni "execKey1", .execKey(1), strSection
WriteIni "execKey2", .execKey(2), strSection
WriteIni "execKey3", .execKey(3), strSection
WriteIni "recKey1", .recKey(1), strSection
WriteIni "recKey2", .recKey(2), strSection
WriteIni "recKey3", .recKey(3), strSection
WriteIni "Minimize", .chkMinimize, strSection
WriteIni "Maximize", .chkMaximize, strSection
WriteIni "ShowButtons", .chkShowButtons, strSection
WriteIni "MinimizeOnRecord", .chkMinimizeOnRecord, strSection
WriteIni "Log", .chkLog, strSection
End With
CacheProgrammSettings
If blnSaveScriptSettings Then
strSection = "SSettings"
With frmSSettings
WriteIni "Speed", .txtSpeed, strSection
WriteIni "SkipErrors", .chkSkipErrors, strSection
WriteIni "FakeWait", .chkFakeWait, strSection
WriteIni "RandomizeInterval", .txtIntervalLimit, strSection
WriteIni "RandomizeCoords", .txtCoordsLimit, strSection
WriteIni "IntervalLimit", .txtIntervalLimit, strSection
WriteIni "CoordsLimit", .txtCoordsLimit, strSection
WriteIni "DelayDownUp", .chkDelayDownUp, strSection
WriteIni "MouseMode", .cmbMouseMode.ListIndex, strSection
WriteIni "Special1", .chkSpecial1, strSection
End With
CacheScriptSettings
End If
UpdateHotKeys
End Sub
Sub LoadSettings(Optional Mode As LoadSettingsMode)
Select Case Mode
Case lsmAll
If Dir(App.Path & "\Scripts", vbDirectory) <> "" Then
ScriptsPath = App.Path & "\Scripts\"
Else
ScriptsPath = App.Path & "\"
End If
LoadFormSettings frmMain
LoadFormSettings frmDebug
LoadFormSettings frmPSettings
LoadFileSettings
Case lsmPSettings
LoadFormSettings frmPSettings
Case lsmSSettings
LoadFormSettings frmSSettings
End Select
CacheProgrammSettings
End Sub
Sub LoadFileSettings()
With LoadedFile
.FileName = ReadIni("FileName", "", "File")
If IsFileExists(.FileName) Then
.Path = ReadIni("Path", "", "File")
.BaseName = ReadIni("BaseName", "", "File")
.BaseTitle = ReadIni("BaseTitle", "", "File")
LoadScript .FileName
Else
' ÅÑËÈ ôàéëà íåò, àíóëèðîâàòü äàííûå
.FileName = ""
End If
End With
End Sub
Sub LoadFormSettings(Form As Object)
Dim strSection As String, obj As Object, buff As Variant
strSection = Form.LinkTopic
With Form
Select Case Form.LinkTopic
Case frmMain.LinkTopic
Dim wState As Single
wState = CSng(ReadIni("WindowState", 0, strSection, dNumeric))
If wState >= 0 And wState <= 2 Then .WindowState = wState
If wState = 0 Then
.Left = CSng(ReadIni("Left", (Screen.Width \ 2 - .Width \ 2), strSection, dNumeric))
.Top = CSng(ReadIni("Top", (Screen.Height \ 2 - .Height \ 2), strSection, dNumeric))
.Width = CSng(ReadIni("Width", .Width, strSection, dNumeric))
.Height = CSng(ReadIni("Height", .Height, strSection, dNumeric))
End If
Case frmDebug.LinkTopic
.Left = CSng(ReadIni("Left", .Left, strSection, dNumeric))
.Top = CSng(ReadIni("Top", .Top, strSection, dNumeric))
.Width = CSng(ReadIni("Width", .Width, strSection, dNumeric))
.Height = CSng(ReadIni("Height", .Height, strSection, dNumeric))
Case frmPSettings.LinkTopic
.chkRecCursor = CLng(ReadIni("RecCursor", 1, strSection, dChk))
.chkReturnCursor = CLng(ReadIni("ReturnCursor", 1, strSection, dChk))
.txtUpdateMousePosInterval = CLng(ReadIni("UpdateMousePosInterval", 100, strSection, dNumeric))
.chkRecByWindow = CLng(ReadIni("RecByWindow", 0, strSection, dChk))
.chkShowDebug = CLng(ReadIni("ShowDebug", 1, strSection, dChk))
.chkShowListTT = CLng(ReadIni("ShowListTT", 1, strSection, dChk))
.chkShowTextTT = CLng(ReadIni("ShowTextTT", 1, strSection, dChk))
.chkShowMarker = CLng(ReadIni("ShowMarker", 1, strSection, dChk))
.execKey(1) = ReadIni("execKey1", "Ctrl", strSection, dHotKey)
.execKey(2) = ReadIni("execKey2", "E", strSection, dHotKey)
.execKey(3) = ReadIni("execKey3", "íåò", strSection, dHotKey)
.recKey(1) = ReadIni("recKey1", "Ctrl", strSection, dHotKey)
.recKey(2) = ReadIni("recKey2", "R", strSection, dHotKey)
.recKey(3) = ReadIni("recKey3", "íåò", strSection, dHotKey)
If .execKey(1) = "íåò" Then .execKey(1) = "Ctrl"
If .recKey(1) = "íåò" Then .recKey(1) = "Ctrl"
.chkMinimize = ReadIni("Minimize", 1, strSection, dChk)
.chkMaximize = ReadIni("Maximize", 1, strSection, dChk)
.chkShowButtons = ReadIni("ShowButtons", 1, strSection, dChk)
.chkMinimizeOnRecord = ReadIni("MinimizeOnRecord", 1, strSection, dChk)
.chkLog = ReadIni("Log", 0, strSection, dChk)
' Case frmSSettings.LinkTopic
' .SetSpeed ReadIni("Speed", "1,0", strSection)
' .chkSkipErrors = ReadIni("SkipErrors", 0, strSection, dChk)
' .chkFakeWait = ReadIni("FakeWait", 1, strSection, dChk)
' .txtIntervalLimit = ReadIni("IntervalLimit", 100, strSection)
' .txtCoordsLimit = ReadIni("CoordsLimit", 0, strSection)
' .chkDelayDownUp = ReadIni("DelayDownUp", 0, strSection, dChk)
' If ReadIni("MouseMode", 1, strSection, dNumeric) < 4 Then .cmbMouseMode.ListIndex = ReadIni("MouseMode", 0, strSection, dNumeric)
' .chkSpecial1 = ReadIni("Special1", 0, strSection, dChk)
End Select
End With
End Sub
Sub LoadDefaultScriptSettings()
Dim strSection As String
strSection = "SSettings"
With Settings
.sngSpeed = ReadIni("Speed", "1,0", strSection)
.bSkipErrors = ReadIni("SkipErrors", 0, strSection, dChk)
.bFakeWait = ReadIni("FakeWait", 1, strSection, dChk)
.lngIntervalLimit = ReadIni("IntervalLimit", 10, strSection)
.lngCoordsLimit = ReadIni("CoordsLimit", 0, strSection)
.lngDelayDownUp = ReadIni("DelayDownUp", 0, strSection, dChk)
If ReadIni("MouseMode", 1, strSection, dNumeric) < 4 Then .MouseMode = ReadIni("MouseMode", 0, strSection, dNumeric)
.bSpecial1 = ReadIni("Special1", 0, strSection, dChk)
End With
End Sub
Function GetDataType(obj As Object) As TypeOfData
If TypeOf obj Is CheckBox Then GetDataType = dChk
If TypeOf obj Is TextBox Then If IsNumeric(obj.Text) Then GetDataType = dNumeric
If obj.Name = "execKey" Or obj.Name = "recKey" Then GetDataType = dHotKey
End Function
Sub LoadScript(Optional ByVal FileName As String, Optional JustUpdateInfo As Boolean, Optional JustLoadSettings As Boolean, Optional ByVal Content As String) ' Content çíà÷èò çàãðóçèòü ñêðèïò áåç ôàéëà
Dim ScriptBody As String, ParamsBody As String, Params() As String
If JustLoadSettings Then GoTo lLoadSettings
If Not IsFileExists(FileName) And Content = "" Then Exit Sub
If Not JustUpdateInfo And Not JustLoadSettings Then frmMain.MousePointer = vbHourglass
DoEvents
With LoadedFile
.FileName = FileName
.Path = Left$(.FileName, InStrRev(.FileName, "\"))
.BaseName = Right$(.FileName, Len(.FileName) - InStrRev(.FileName, "\"))
.BaseTitle = Left$(.BaseName, IIf(InStrRev(.BaseName, ".") > 0, InStrRev(.BaseName, ".") - 1, Len(.BaseName)))
If Content <> "" Then .Content = Content Else .Content = ReadFile(FileName)
n = InStrRev(.Content, vbCrLf & "Settings::")
If n > 0 Then
If n > 1 Then .ScriptBody = Left$(.Content, n - 1)
.SettingsBody = Right$(.Content, Len(.Content) - n - 1)
Else
.ScriptBody = LoadedFile.Content
End If
End With
If JustUpdateInfo Then Exit Sub
lLoadSettings:
With Settings
.sngSpeed = GetScriptSettings("Speed", "1,0", 100)
.bSkipErrors = GetScriptSettings("SkipErrors", 0)
.bFakeWait = GetScriptSettings("FakeWait", 1)
.lngIntervalLimit = GetScriptSettings("IntervalLimit", 5)
.lngCoordsLimit = GetScriptSettings("CoordsLimit", 0)
If CChk(GetScriptSettings("DelayDownUp", 0)) Then
.lngDelayDownUp = 50
Else
.lngDelayDownUp = 1
End If
.MouseMode = GetScriptSettings("MouseMode", 0, 3, , True)
.bSpecial1 = GetScriptSettings("Special1", 0)
End With
' With frmSSettings
' .SetSpeed GetScriptSettings("Speed", "1,0", 100)
' .chkSkipErrors = GetScriptSettings("SkipErrors", 0)
' .chkFakeWait = GetScriptSettings("FakeWait", 1)
' .txtIntervalLimit = GetScriptSettings("IntervalLimit", 10)
' .txtCoordsLimit = GetScriptSettings("CoordsLimit", 0)
' .chkDelayDownUp = CChk(GetScriptSettings("DelayDownUp", 0))
' .cmbMouseMode.ListIndex = GetScriptSettings("MouseMode", 0, 3)
' .chkSpecial1 = GetScriptSettings("Special1", 0)
' End With
If JustLoadSettings Then Exit Sub
frmMain.txtMain = LoadedFile.ScriptBody
ReDim History.Text(0)
ReDim History.SelStart(0)
History.Step = 0
History.Text(0) = frmMain.txtMain
frmMain.MousePointer = vbNormal
End Sub
Function CChk(s) As Integer 'ôóíêöèÿ ëèáî âîçâðàùàåò 0 ëèáî 1
If CBool(s) = True Then CChk = 1 Else CChk = 0
End Function
Function SaveScript(Optional ByVal FileName As String, Optional JustSetNewParams As Boolean) As Boolean
Dim OldFile As typeFileStruct
If Not JustSetNewParams Then frmMain.MousePointer = vbHourglass
OldFile = LoadedFile
LoadedFile.SettingsBody = "Settings::"
With Settings
AddScriptSettings "Speed", .sngSpeed
AddScriptSettings "SkipErrors", .bSkipErrors
AddScriptSettings "FakeWait", .bFakeWait
AddScriptSettings "RandomizeInterval", .lngIntervalLimit
AddScriptSettings "RandomizeCoords", .lngCoordsLimit
AddScriptSettings "IntervalLimit", .lngIntervalLimit
AddScriptSettings "CoordsLimit", .lngCoordsLimit
AddScriptSettings "DelayDownUp", (.lngDelayDownUp > 1)
AddScriptSettings "MouseMode", .MouseMode
AddScriptSettings "Special1", .bSpecial1
End With
If JustSetNewParams Then Exit Function
LoadedFile.Content = frmMain.txtMain & vbCrLf & LoadedFile.SettingsBody
If FileName = "" Then FileName = LoadedFile.FileName
If CreateFile(FileName, LoadedFile.Content) Then
LoadScript FileName, True
SaveScript = True
ElseIf LoadedFile.FileName <> "" Then
LoadedFile = OldFile
End If
frmMain.MousePointer = vbNormal
End Function
Function AddScriptSettings(ByVal strName As String, ByVal strValue As String)
If strValue = "True" Then strValue = "1"
If strValue = "False" Then strValue = "0"
LoadedFile.SettingsBody = LoadedFile.SettingsBody & strName & "=" & strValue & ";"
End Function
Function GetScriptSettings(ByVal strValue As String, ByVal strDefault, Optional ByVal Limit As Double = -100000, Optional IsCheckBox As Boolean, Optional ByVal IsPositiveNumeric As Boolean = True, Optional ByVal strSettings As String)
Dim ParamStart As Long, ParamEnd As Long, buff
If strSettings = "" Then strSettings = LoadedFile.SettingsBody
ParamStart = InStr(1, strSettings, strValue)
If ParamStart = 0 Then GoTo lSetDefault
ParamStart = ParamStart + Len(strValue) + 1
ParamEnd = InStr(ParamStart, strSettings, ";")
If ParamEnd = 0 Then ParamEnd = Len(strSettings)
buff = Mid(strSettings, ParamStart, ParamEnd - ParamStart)
If IsNumeric(strDefault) Then ' ÅÑËÈ äîëæíî áûòü ÷èñëî
If (Not IsNumeric(buff)) Then GoTo lSetDefault
If Limit > 0 And buff > Limit Then GoTo lSetDefault
If IsPositiveNumeric And (buff < 0) Then GoTo lSetDefault
End If
GetScriptSettings = buff
Exit Function
lSetDefault:
GetScriptSettings = strDefault
End Function
Function IsVirtKey(ByVal str As String) As Boolean
If Str2VK(str) <> -1 Then IsVirtKey = True
End Function
Function Str2VK(ByVal str As String) As KeyCodeConstants
If Len(str) = 1 Then
str = UCase(str)
If IsNumeric(str) Then
Str2VK = Asc(str)
ElseIf Asc(str) >= Asc("A") And Asc(str) <= Asc("Z") Then
Str2VK = Asc(str)
Else
Select Case str
Case "+": Str2VK = 187 '=
Case "-": Str2VK = 189
Case "/": Str2VK = 191
Case "\": Str2VK = 220
Case "[": Str2VK = 219
Case "]": Str2VK = 221
Case ";": Str2VK = 186
Case ",": Str2VK = 188
Case ".": Str2VK = 190
Case "'": Str2VK = 222
Case "`": Str2VK = 192
Case Else: Str2VK = -1
End Select
End If
ElseIf Left$(str, 1) = "F" And IsNumeric(Replace(str, "F", "")) Then
If CLng(Replace(str, "F", "")) >= 1 And CLng(Replace(str, "F", "")) <= 12 Then
Str2VK = 111 + CLng(Replace(str, "F", ""))
End If
Else
str = Replace(str, "{", "")
str = Replace(str, "}", "")
Select Case str
Case "Ctrl"
Str2VK = vbKeyControl
Case "Alt"
Str2VK = vbKeyMenu
Case "Shift"
Str2VK = vbKeyShift
Case "Win"
Str2VK = VK_STARTKEY
Case "Tab"
Str2VK = vbKeyTab
Case "Space"
Str2VK = vbKeySpace
Case "íåò"
Str2VK = 0
Case Else
Str2VK = -1
End Select
End If
End Function
Sub UpdateHotKeys(Optional ExecCaption = "Âûïîëíèòü ñêðèïò", Optional RecCaption = "Íà÷àòü çàïèñü")
Dim Keys(1 To 3) As Long, SordedKeys() As Long, i As Long
For i = 1 To 3
Keys(i) = Str2VK(frmPSettings.execKey(i))
Next i
SortByNumber Keys, SordedKeys
If Not CreateHotKey(hkExecuteScript, SordedKeys(1), SordedKeys(2), SordedKeys(3)) Then
MsgBox "Îøèáêà! Òàêàÿ êîìáèíàöèÿ ãîðÿ÷èõ êëàâèø óæå åñòü", vbExclamation, "Íåâîçìîæíî çàðåãèñòðèðîâàòü ãîðÿ÷àþ êëàâèøó"
End If
For i = 1 To 3
Keys(i) = Str2VK(frmPSettings.recKey(i))
Next i
SortByNumber Keys, SordedKeys
CreateHotKey hkStartRec, SordedKeys(1), SordedKeys(2), SordedKeys(3)
frmMain.mnuExecute.Caption = ExecCaption & vbTab & frmPSettings.execKey(1)
frmMain.mnuRec.Caption = RecCaption & vbTab & frmPSettings.recKey(1)
For i = 2 To 3
If frmPSettings.execKey(i) <> "íåò" Then frmMain.mnuExecute.Caption = frmMain.mnuExecute.Caption & "+" & frmPSettings.execKey(i)
If frmPSettings.recKey(i) <> "íåò" Then frmMain.mnuRec.Caption = frmMain.mnuRec.Caption & "+" & frmPSettings.recKey(i)
Next i
End Sub
Sub SortByNumber(Array1() As Long, ByRef Array2() As Long)
'Ïîèñê ñ ñàìîãî ìàëåíüêîãî ÷èñëà
Dim Index As Long
ReDim Array2(LBound(Array1) To UBound(Array1))
For n = LBound(Array1) To UBound(Array1)
Array2(n) = 2 ^ 31 - 1
For i = LBound(Array1) To UBound(Array1)
If Array1(i) < Array2(n) Then Array2(n) = Array1(i): Index = i
Next i
Array1(Index) = 2 ^ 31 - 1
Next n
End Sub
Sub SetAll()
sConsts.Date = "äàòà"
sConsts.Time = "âðåìÿ"
sConsts.Key = "êëàâèøà"
sConsts.Window = "îêíî"
VBScript.Language = "vbscript"
FuncsFirstTextParam = Array(cPress, cStartScript, cMsgBox, cInputBox, cPrint, cVBScript, _
cCreateFile, cWriteFile, cReadFile, cSetWindow, cShowWindow, cCloseWindow, _
cShell, cDeleteFile, cKillProcess, cDeleteDir, cCreateDir, cDownloadFile) ' Ñïèñîê ôóíêöèè, â êîòîðûõ ïåðâûé ïàðàìåòð òåêñòîâûé
ruFunctions = Array("Êëèê", "Æäàòü", "Íàæàòü êëàâèøó", "Ïåðåìåñòèòü êóðñîð", "Ïîâòîðèòü", _
"ÅÑËÈ", "Ïîêàçàòü îêíî", "Íàçíà÷èòü îêíî", "Çàêðûòü îêíî", "Ñêà÷àòü ôàéë", _
"Çàïóñòèòü ñêðèïò", "Ïîêàçàòü ñîîáùåíèå", "Ïîêàçàòü îêíî ââîäà", "Îòëàäêà", _
"Ñîçäàòü ôàéë", "Çàïèñàòü â ôàéë", "Ñ÷èòàòü ôàéë", "Óäàëèòü ôàéë", "Óäàëèòü ïàïêó", "Ñîçäàòü ïàïêó", _
"Çàïóñòèòü ïðîãðàììó", "Çàâåðøèòü ïðîöåññ", "Ñòîï", "VBScript", "Ïåðåéòè íà ñòðîêó", "Ðàçðåøåíèå ýêðàíà", "Ïðîïóñêàòü îøèáêè", _
"Âûõîä")
enFunctions = Array("Click", "Wait", "Press", "StartScript", "SetCursorPos", "Loop", "IF", "Download", _
"MessageBox", "InputBox", "Debug", "CreateFile", "WriteFile", "ReadFile", "DeleteFile", _
"SetWindow", "ShowWindow", "CloseWindow", "Shell", "KillProcess", "Stop", "GoTo", _
"SkipErrors", "ChangeResolution", "Exit")
ReDim Funcs(1 To FuncsCount)
Funcs(1) = cClick
Funcs(2) = cWait
Funcs(3) = cPress
Funcs(4) = cExit
Funcs(5) = cStartScript
Funcs(6) = cSetCursorPos
Funcs(7) = cLoop
Funcs(8) = cMsgBox
Funcs(9) = cInputBox
Funcs(10) = cPrint
Funcs(11) = cCreateFile
Funcs(12) = cWriteFile
Funcs(13) = cReadFile
Funcs(14) = cSetWindow
Funcs(15) = cShowWindow
Funcs(16) = cShell
Funcs(17) = cStop
Funcs(18) = cSkipErrors
Funcs(19) = cChangeResolution
Funcs(20) = cDeleteFile
Funcs(21) = cKillProcess
Funcs(22) = cDeleteDir
Funcs(23) = cCreateDir
Funcs(24) = cCloseWindow
Funcs(25) = cDownloadFile
Funcs(26) = cIf
Funcs(27) = cVBScript
Funcs(28) = cGoTo
ClickV = Array("Click", "Êëèêíóòü", "Êëèêàòü", "Ñäåëàòü êëèê", "Ìûøêà", "Ìûøü", "Êëèê")
WaitV = Array("Wait", "Ïîäîæäàòü", "Îáîæäàòü", "Æäàòü", "Ïàóçà", "Sleep", "Çàäåðæêà", "Pause", "Delay")
PressV = Array("Press", "Íàæàòü íà êíîïêó", "Íàæàòü êíîïêó", "Íàæàòü êëàâèøó", "Íàæàòü", "Push", "SendInput", "SendKeys", "Send")
ExitV = Array("Exit", "Âûõîä", "Âûéòè", "End", "Çàâåðøèòü ðàáîòó")
StartScriptV = Array("StartScript", "ExecuteScript", "Çàïóñòèòü ñêðèïò", "Âûïîëíèòü ñêðèïò", "PlayScript", "Play")
SetCursorPosV = Array("SetCursorPos", "Ïåðåìåñòèòü êóðñîð", "Ïåðåìåñòèòü ìûøü", "Ïåðåäâèíóòü êóðñîð", "Ñäâèíóòü êóðñîð", "Ïåðåäâèíóòü ìûøü", "Ñäâèíóòü ìûøü", "Êóðñîð")
LoopV = Array("Loop", "Öèêë", "Cycle", "Ïîâòîðèòü", "Ïîâòîð")
MsgBoxV = Array("MsgBox", "MessageBox", "Ïîêàçàòü ñîîáùåíèå", "Ñîîáùåíèå", "ShowMessage", "Message")
InputBoxV = Array("InputBox", "Ïîêàçàòü îêíî ââîäà", "Îêíî ââîäà", "ShowInput")
PrintV = Array("DPrint", "Print", "Debug", "Îòëàäêà", "Echo")
CreateFileV = Array("CreateFile", "Ñîçäàòü ôàéë", "Íîâûé ôàéë")
WriteFileV = Array("WriteFile", "Çàïèñàòü â ôàéë", "Çàïèñàòü ôàéë")
ReadFileV = Array("ReadFile", "Ñ÷èòàòü ôàéë", "Ïðî÷èòàòü ôàéë", "Ïîëó÷èòü ôàéë", "Ïîëó÷èòü èíôîðìàöèþ èç ôàéëà", "OpenFile")
SetWindowV = Array("SetWindow", "Íàçíà÷èòü îêíî", "Âûáðàòü îêíî", "SelectWindow", "SetTargetWindow", "TargetWindow")
ShowWindowV = Array("ShowWindow", "Ïîêàçàòü îêíî", "Îêíî íà ïåðåäíèé ïëàí")
ShellV = Array("Shell", "Çàïóñòèòü ïðîãðàììó", "ShellExecute", "Run", "Îòêðûòü ïðîãðàììó")
StopV = Array("Stop", "Ñòîï", "Îñòàíîâèòüñÿ", "Îñòàíîâèòü âûïîëíåíèå", "Îñòàíîâèòü ñêðèïò")
SkipErrorsV = Array("SkipErrors", "Ïðîïóñêàòü îøèáêè", "Ïðîïóñòèòü îøèáêè", "Ïðîïóñêàÿ îøèáêè")
ChangeResolutionV = Array("ChangeResolution", "SetResolution", "Ðàçðåøåíèå ýêðàíà", "Èçìåíèòü ðàçðåøåíèå") ', "Ðàçðåøåíèå")
DeleteFileV = Array("DeleteFile", "Óäàëèòü ôàéë", "Ñòåðåòü ôàéë")
KillProcessV = Array("KillProcess", "Çàâåðøèòü ïðîöåññ", "Çàâåðøèòü ïðîãðàììó", "TaskKill")
DeleteDirV = Array("DeleteDir", "Óäàëèòü ïàïêó", "Ñòåðåòü ïàïêó", "RmDir")
CreateDirV = Array("CreateDir", "Ñîçäàòü ïàïêó", "MkDir")
CloseWindowV = Array("CloseWindow", "Çàêðûòü îêíî", "TerminateWindow")
DownloadFileV = Array("DownloadFile", "Ñêà÷àòü ôàéë", "Ñêà÷àòü ñòðàíèöó", "Çàêà÷àòü ôàéë", "Çàêà÷àòü ñòðàíèöó", "Çàãðóçèòü ôàéë", "Çàãðóçèòü ñòðàíèöó", "DownloadPage", "Ñêà÷àòü", "Download")
IfV = Array("If", "ÅÑËÈ", "Óñëîâèå")
VBScriptV = Array("VBScript", "VBSFunction", "RunVBS", "VBS", "VBSCode")
GoToV = Array("GoTo", "Jump", "Ïåðåéòè íà ñòðîêó", "Âûïîëíèòü ñî ñòðîêè", "Çàïóñòèòü ñî ñòðîêè", "Ñòðîêà")
' ðàçäåëèòåëü âåçäå ïðîáåë
SpecialCharsArray = Split("+ ^ % ~ ( ) } { ] [", " ")
' ' êîíå÷íûé âàðèàíò âñåãäà äîëæåí áûòü ïîñëåäíèì, èáî èíà÷å áóäåò íå ïðàâèëüíûé ðåïëåéñ
ReDim Operations(1 To 6)
Operations(1) = "+"
Operations(2) = "-"
Operations(3) = "*"
Operations(4) = "/"
Operations(5) = "^"
Operations(6) = "="
Set tDebug = frmDebug.txtDebug
CreateHotKey hkSaveAs, vbKeyControl, vbKeyShift, vbKeyS, PrivateHK, frmMain.hwnd
CreateHotKey hkInsClick, vbKeyControl, vbKeyInsert
CreateHotKey hkInsCursorPos, vbKeyMenu, vbKeyInsert
UpdateHotKeys
'Settings.bSkipErrors = True
End Sub
'Sub MoveArray(sArray() As Variant, StartFrom As Long)
' Dim tempArray(StartFrom To UBound(sArray) + StartFrom) As Variant
' For i = LBound(sArray) To UBound(sArray)
' tempArray(StartFrom) = sArray(i)
' StartFrom = StartFrom + 1
' Next i
' ReDim sArray(LBound(tempArray) To UBound(tempArray))
' For i = LBound(tempArray) To UBound(tempArray)
' sArray(i) = tempArray(i)
' Next i
'End Sub
Sub CacheProgrammSettings()
With frmPSettings
Settings.lngUpdateMousePosInterval = .txtUpdateMousePosInterval
Settings.bReturnCursor = .chkReturnCursor
Settings.bRecCursor = .chkRecCursor
Settings.bRecByWindow = .chkRecByWindow
Settings.bShowDebug = .chkShowDebug
Settings.bShowListTT = .chkShowListTT
Settings.bShowTextTT = .chkShowTextTT
Settings.bShowMarker = .chkShowMarker
If Settings.bShowMarker = False Then HideMarker
End With
End Sub
Sub CacheScriptSettings()