windowsのステップを記録しJavaScriptにする。
@@ -3,7 +3,7 @@ | ||
3 | 3 | Public Class Form1 |
4 | 4 | |
5 | 5 | Private isRec As Boolean = False |
6 | - | |
6 | + Private cnt As Integer = 0 | |
7 | 7 | Private WithEvents MouseHook As New MouseHookClass |
8 | 8 | |
9 | 9 | Private Sub btnPlay_Click(sender As Object, e As EventArgs) Handles btnPlay.Click |
@@ -50,23 +50,28 @@ | ||
50 | 50 | End Sub |
51 | 51 | |
52 | 52 | Private Sub MouseHook_MouseHook(sender As Object, e As MouseHookClass.MouseHookEventArgs) Handles MouseHook.MouseHook |
53 | - 'カレットの位置を取得 | |
54 | - Dim selectPos As Integer = TextBox1.SelectionStart | |
53 | + | |
55 | 54 | InsertMouseMove(e.Point.x, e.Point.y, e.Message) |
56 | - 'カーソルを戻す | |
57 | - Me.TextBox1.SelectionStart = selectPos | |
58 | 55 | |
56 | + | |
59 | 57 | End Sub |
60 | 58 | |
61 | 59 | Private Sub InsertMouseMove(x As Integer, y As Integer, message As MouseHookClass.MouseMessage) |
62 | 60 | Dim code As String = String.Empty |
63 | 61 | If message = MouseHookClass.MouseMessage.Move Then |
64 | - code = $" sh.Run(""rundll32.exe MouseEmulator.dll, _SetMouseXY@16 {x}, {y}"");" | |
62 | + code = $" sh.Run(""rundll32.exe MouseEmulator.dll, _SetMouseXY@16 {x}, {y}"");//{cnt}{vbCrLf}" | |
65 | 63 | End If |
64 | + cnt += 1 | |
65 | + InsertToTextBox(code) | |
66 | 66 | |
67 | + End Sub | |
68 | + | |
69 | + Private Sub InsertToTextBox(code As String) | |
67 | 70 | TextBox1.SelectedText = code |
71 | + | |
68 | 72 | End Sub |
69 | 73 | |
74 | + | |
70 | 75 | Private Sub Button1_Click(sender As Object, e As EventArgs) |
71 | 76 | |
72 | 77 | End Sub |
@@ -0,0 +1,72 @@ | ||
1 | +<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ | |
2 | +Partial Class Form2 | |
3 | + Inherits System.Windows.Forms.Form | |
4 | + | |
5 | + 'フォームがコンポーネントの一覧をクリーンアップするために dispose をオーバーライドします。 | |
6 | + <System.Diagnostics.DebuggerNonUserCode()> _ | |
7 | + Protected Overrides Sub Dispose(ByVal disposing As Boolean) | |
8 | + Try | |
9 | + If disposing AndAlso components IsNot Nothing Then | |
10 | + components.Dispose() | |
11 | + End If | |
12 | + Finally | |
13 | + MyBase.Dispose(disposing) | |
14 | + End Try | |
15 | + End Sub | |
16 | + | |
17 | + 'Windows フォーム デザイナーで必要です。 | |
18 | + Private components As System.ComponentModel.IContainer | |
19 | + | |
20 | + 'メモ: 以下のプロシージャは Windows フォーム デザイナーで必要です。 | |
21 | + 'Windows フォーム デザイナーを使用して変更できます。 | |
22 | + 'コード エディターを使って変更しないでください。 | |
23 | + <System.Diagnostics.DebuggerStepThrough()> _ | |
24 | + Private Sub InitializeComponent() | |
25 | + Me.TextBox1 = New System.Windows.Forms.TextBox() | |
26 | + Me.Button1 = New System.Windows.Forms.Button() | |
27 | + Me.TextBox2 = New System.Windows.Forms.TextBox() | |
28 | + Me.SuspendLayout() | |
29 | + ' | |
30 | + 'TextBox1 | |
31 | + ' | |
32 | + Me.TextBox1.Location = New System.Drawing.Point(51, 29) | |
33 | + Me.TextBox1.Multiline = True | |
34 | + Me.TextBox1.Name = "TextBox1" | |
35 | + Me.TextBox1.Size = New System.Drawing.Size(419, 122) | |
36 | + Me.TextBox1.TabIndex = 0 | |
37 | + ' | |
38 | + 'Button1 | |
39 | + ' | |
40 | + Me.Button1.Location = New System.Drawing.Point(64, 184) | |
41 | + Me.Button1.Name = "Button1" | |
42 | + Me.Button1.Size = New System.Drawing.Size(75, 23) | |
43 | + Me.Button1.TabIndex = 1 | |
44 | + Me.Button1.Text = "Button1" | |
45 | + Me.Button1.UseVisualStyleBackColor = True | |
46 | + ' | |
47 | + 'TextBox2 | |
48 | + ' | |
49 | + Me.TextBox2.Location = New System.Drawing.Point(158, 184) | |
50 | + Me.TextBox2.Name = "TextBox2" | |
51 | + Me.TextBox2.Size = New System.Drawing.Size(100, 22) | |
52 | + Me.TextBox2.TabIndex = 2 | |
53 | + ' | |
54 | + 'Form2 | |
55 | + ' | |
56 | + Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!) | |
57 | + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font | |
58 | + Me.ClientSize = New System.Drawing.Size(620, 253) | |
59 | + Me.Controls.Add(Me.TextBox2) | |
60 | + Me.Controls.Add(Me.Button1) | |
61 | + Me.Controls.Add(Me.TextBox1) | |
62 | + Me.Name = "Form2" | |
63 | + Me.Text = "Form2" | |
64 | + Me.ResumeLayout(False) | |
65 | + Me.PerformLayout() | |
66 | + | |
67 | + End Sub | |
68 | + | |
69 | + Friend WithEvents TextBox1 As TextBox | |
70 | + Friend WithEvents Button1 As Button | |
71 | + Friend WithEvents TextBox2 As TextBox | |
72 | +End Class |
@@ -0,0 +1,7 @@ | ||
1 | +Public Class Form2 | |
2 | + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click | |
3 | + For i As Integer = 0 To 100 | |
4 | + TextBox1.SelectedText = $"メッセージ{i}{vbCrLf}" | |
5 | + Next | |
6 | + End Sub | |
7 | +End Class | |
\ No newline at end of file |
@@ -0,0 +1,52 @@ | ||
1 | +<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ | |
2 | +Partial Class Form3 | |
3 | + Inherits System.Windows.Forms.Form | |
4 | + | |
5 | + 'フォームがコンポーネントの一覧をクリーンアップするために dispose をオーバーライドします。 | |
6 | + <System.Diagnostics.DebuggerNonUserCode()> _ | |
7 | + Protected Overrides Sub Dispose(ByVal disposing As Boolean) | |
8 | + Try | |
9 | + If disposing AndAlso components IsNot Nothing Then | |
10 | + components.Dispose() | |
11 | + End If | |
12 | + Finally | |
13 | + MyBase.Dispose(disposing) | |
14 | + End Try | |
15 | + End Sub | |
16 | + | |
17 | + 'Windows フォーム デザイナーで必要です。 | |
18 | + Private components As System.ComponentModel.IContainer | |
19 | + | |
20 | + 'メモ: 以下のプロシージャは Windows フォーム デザイナーで必要です。 | |
21 | + 'Windows フォーム デザイナーを使用して変更できます。 | |
22 | + 'コード エディターを使って変更しないでください。 | |
23 | + <System.Diagnostics.DebuggerStepThrough()> _ | |
24 | + Private Sub InitializeComponent() | |
25 | + Me.TextBox1 = New System.Windows.Forms.TextBox() | |
26 | + Me.SuspendLayout() | |
27 | + ' | |
28 | + 'TextBox1 | |
29 | + ' | |
30 | + Me.TextBox1.Dock = System.Windows.Forms.DockStyle.Fill | |
31 | + Me.TextBox1.Location = New System.Drawing.Point(0, 0) | |
32 | + Me.TextBox1.Multiline = True | |
33 | + Me.TextBox1.Name = "TextBox1" | |
34 | + Me.TextBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both | |
35 | + Me.TextBox1.Size = New System.Drawing.Size(282, 253) | |
36 | + Me.TextBox1.TabIndex = 0 | |
37 | + ' | |
38 | + 'Form3 | |
39 | + ' | |
40 | + Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!) | |
41 | + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font | |
42 | + Me.ClientSize = New System.Drawing.Size(282, 253) | |
43 | + Me.Controls.Add(Me.TextBox1) | |
44 | + Me.Name = "Form3" | |
45 | + Me.Text = "Form3" | |
46 | + Me.ResumeLayout(False) | |
47 | + Me.PerformLayout() | |
48 | + | |
49 | + End Sub | |
50 | + | |
51 | + Friend WithEvents TextBox1 As TextBox | |
52 | +End Class |
@@ -0,0 +1,21 @@ | ||
1 | +Public Class Form3 | |
2 | + | |
3 | + Private WithEvents MouseHook As New MouseHookClass | |
4 | + | |
5 | + Private Sub MouseHook_MouseHook(sender As Object, e As MouseHookClass.MouseHookEventArgs) Handles MouseHook.MouseHook | |
6 | + TextBox1.SelectedText = $"{e.Point.x},{e.Point.y}:{e.Message}{vbCrLf}" | |
7 | + | |
8 | + | |
9 | + | |
10 | + End Sub | |
11 | + | |
12 | + Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load | |
13 | + MouseHook.MouseHookStart() | |
14 | + End Sub | |
15 | + | |
16 | + Private Sub Form3_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing | |
17 | + If MouseHook.Hooked Then | |
18 | + MouseHook.MouseHookEnd() | |
19 | + End If | |
20 | + End Sub | |
21 | +End Class | |
\ No newline at end of file |
@@ -1,10 +1,10 @@ | ||
1 | 1 | '------------------------------------------------------------------------------ |
2 | 2 | ' <auto-generated> |
3 | -' This code was generated by a tool. | |
4 | -' Runtime Version:4.0.30319.42000 | |
3 | +' このコードはツールによって生成されました。 | |
4 | +' ランタイム バージョン:4.0.30319.42000 | |
5 | 5 | ' |
6 | -' Changes to this file may cause incorrect behavior and will be lost if | |
7 | -' the code is regenerated. | |
6 | +' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 | |
7 | +' コードが再生成されるときに損失したりします。 | |
8 | 8 | ' </auto-generated> |
9 | 9 | '------------------------------------------------------------------------------ |
10 | 10 |
@@ -13,15 +13,15 @@ | ||
13 | 13 | |
14 | 14 | |
15 | 15 | Namespace My |
16 | - | |
17 | - 'NOTE: This file is auto-generated; do not modify it directly. To make changes, | |
18 | - ' or if you encounter build errors in this file, go to the Project Designer | |
19 | - ' (go to Project Properties or double-click the My Project node in | |
20 | - ' Solution Explorer), and make changes on the Application tab. | |
16 | + | |
17 | + 'メモ:このファイルは自動生成されました。直接変更しないでください。変更したり、 | |
18 | + ' ビルド エラーが発生した場合は、プロジェクト デザイナー へ移動し (プロジェクト | |
19 | + ' プロパティに移動するか、またはソリューション エクスプローラーのマイ プロジェクト | |
20 | + ' ノード上でダブルクリック)、アプリケーション タブ上で変更を行います。 | |
21 | 21 | ' |
22 | 22 | Partial Friend Class MyApplication |
23 | - | |
24 | - <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _ | |
23 | + | |
24 | + <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _ | |
25 | 25 | Public Sub New() |
26 | 26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) |
27 | 27 | Me.IsSingleInstance = false |
@@ -29,10 +29,10 @@ | ||
29 | 29 | Me.SaveMySettingsOnExit = true |
30 | 30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses |
31 | 31 | End Sub |
32 | - | |
33 | - <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _ | |
32 | + | |
33 | + <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _ | |
34 | 34 | Protected Overrides Sub OnCreateMainForm() |
35 | - Me.MainForm = Global.protoMacro.Form1 | |
35 | + Me.MainForm = Global.protoMacro.Form3 | |
36 | 36 | End Sub |
37 | 37 | End Class |
38 | 38 | End Namespace |