-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepeatInputParameters.vbs
More file actions
54 lines (45 loc) · 1.38 KB
/
RepeatInputParameters.vbs
File metadata and controls
54 lines (45 loc) · 1.38 KB
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
Dim INPUT_PARAM
Dim MAXCOUNT
Set WshShell=Wscript.CreateObject("Wscript.Shell")
'メインルーチン
INPUT_PARAM = InputBox("入力する値は")
MAXCOUNT = InputBox("入力を繰り返す回数")
If IsNumeric(INPUT_PARAM) = true AND IsNumeric(MAXCOUNT) = true Then
WScript.Echo "準備はよろしいですか?"
'5秒待機
WScript.Sleep(5000)
'キー送信を繰り返す
For s = 1 To MAXCOUNT Step 1
'キー送信を実行する
call sendkeyunit(INPUT_PARAM)
WScript.Sleep(200)
Next
WScript.Echo "完了!"
Else
WScript.Echo "失敗!"
End If
Set WshShell = Nothing
'キー送信を実行する。
Sub sendkeyunit( InputParam )
'編集前のグリッド入力値をクリップボードに格納
WshShell.SendKeys("{ENTER}")
WshShell.SendKeys("^(c)")
WScript.Sleep(100)
WshShell.SendKeys("{ENTER}")
WshShell.SendKeys("{ENTER}")
WshShell.SendKeys(CStr(InputParam))
'クリップボードの値を判定する
If IsNumeric(GetClipboardText) = true AND GetClipboardText < 0 Then
'負数の場合
WshShell.SendKeys("{DOWN}")
Else
'正数の場合
WshShell.SendKeys("{ENTER}")
End If
End Sub
'クリップボードの値を取得する。
Function GetClipboardText()
Dim objHTML
Set objHTML = CreateObject("htmlfile")
GetClipboardText = Trim(objHTML.ParentWindow.ClipboardData.GetData("text"))
End Function