アプリ版:「スタンプのみでお礼する」機能のリリースについて

×Windows Script Host
スクリプト 行14
文字35
エラー 終了していない文字型の定数です。
コード800A0409
ソースMicrosoft VBScript コンパイルエラー
------------------------------------------------------
以下のスクリプトを実行したら、上記のエラーとなります。どこがおかしいでしょうか。
------------------------------------------------------

strSendKey = "{F13}"

intSleepTime = 290000

strQuery = "Select * FROM Win32_Process WHERE (Caption = 'wscript.exe' OR Caption = 'cscript.exe') AND " _
& " CommandLine LIKE '%" & WScript.ScriptName & "%'"
Set Locator = CreateObject("WbemScripting.SWbemLocator")
Set Service = Locator.ConnectServer
Set Res = Service.ExecQuery(strQuery)

Dim cnt
cnt = 0
If Res.Count > 1 Then
strMsg = "送信処理を停止します。"
If MsgBox(strMsg , vbYesNo + vbQuestion) = vbYes Then
For Each proc In Res
cnt = cnt + 1
If cnt <> Res.Count then
proc.Terminate
End If
Next
End If
WScript.Quit 0
Else
strSleepTime = CStr(intSleepTime/1000)
strMsg = strSleepTime & "秒毎に" & strSendKey &"を送信します。"
If MsgBox(strMsg , vbYesNo + vbQuestion) = vbYes Then
Call StopScript(strSendKey, intSleepTime)
End If
End If

WScript.Quit 0

Sub StopScript(key, sleepTime)
Set WsShell = CreateObject("Wscript.Shell")
Do
WsShell.SendKeys(key)
WScript.Sleep sleepTime
Loop
End Sub

A 回答 (1件)

ファイルの文字エンコーディングがUTF-8とかになっていませんか?


Shift-JISでないと正しく動かないと思います。
    • good
    • 0
この回答へのお礼

早速ありがとうございました!UTF-8になっていました!

Shift-JIS=S JIS

ですね??S JISにしたら動きました!!!ありがとうございました!!!

お礼日時:2021/06/07 09:23

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!

このQ&Aを見た人はこんなQ&Aも見ています


このQ&Aを見た人がよく見るQ&A