
나는 이 스크립트를 사용하여 내가 항상 짧은 메시지를 보내는 사람들에게 이메일을 보내고 내 업데이트를 업데이트합니다.우유를 기억해할일은 런치에서 나왔습니다.
새 작업을 추가해야 할 때
- 때리다Alt+스페이스바(호출발사)
- 유형rr
- 때리다탭
- "이게 내 할 일이야"라고 입력하세요
- 엔터 키를 치시오
제가 하고 싶은 것은 속도가 많이 느려지므로 ""를 쓸 필요가 없는 것입니다.
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = "smtp.GMAIL.com"
Flds.Item(schema & "smtpserverport") = 465
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = "[email protected]"
Flds.Item(schema & "sendpassword") = "YOURPASSWORD"
Flds.Item(schema & "smtpusessl") = 1
Flds.Update
With iMsg
.To = "[email protected]"
.From = "jacob <[email protected]"
.Subject = wscript.arguments.item(0)
.HTMLBody = message
.Sender = " "
.Organization = " "
.ReplyTo = " "
Set .Configuration = iConf
SendGMAILGmail = .Send
End With
set iMsg = nothing
set iConf = nothing
set Flds = nothing
답변1
질문을 완전히 이해했는지는 모르겠지만 입력한 내용을 스크립트에 명령줄 인수로 전달하여 작업이 실행되고 wscript.arguments.item(0)
제목으로 사용하고 있기 때문에 따옴표를 추가해야 한다고 가정합니다. 전체 주제가 첫 번째 인수에 포함되어 있는지 확인하십시오.
(약간 미친) 코드를 사용하여여기, 다음이 작동해야합니다
Set oWMISrvc = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\.\root\cimv2")
sProcName = Mid(wsh.fullname, InstrRev(wsh.fullname, "\") + 1)
Set cProcesses = oWMISrvc.ExecQuery( _
"select * from win32_process where Name = '" & sProcName & "'")
For Each oProcess in cProcesses
If Instr(lcase(oProcess.Commandline), lcase(wsh.scriptname)) > 0 Then
sCmdLine = oProcess.Commandline
End If
Next
iNamePos = instr(lcase(sCmdLine), lcase(Wscript.ScriptName))
sArguments = trim(mid(sCmdLine, iNamePos + len(Wscript.ScriptName)))
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = "smtp.GMAIL.com"
Flds.Item(schema & "smtpserverport") = 465
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = "[email protected]"
Flds.Item(schema & "sendpassword") = "YOURPASSWORD"
Flds.Item(schema & "smtpusessl") = 1
Flds.Update
With iMsg
.To = "[email protected]"
.From = "jacob <[email protected]"
.Subject = sArguments
.HTMLBody = message
.Sender = " "
.Organization = " "
.ReplyTo = " "
Set .Configuration = iConf
SendGMAILGmail = .Send
End With
set iMsg = nothing
set iConf = nothing
set Flds = nothing
또는 제공된 모든 인수를 연결하면 됩니다.
sArguments = ""
For i = 0 to Wscript.Arguments.Count - 1
if i > 0 Then
sArguments = sArguments + " "
End If
sArguments = sArguments + Wscript.Arguments(i)
Next
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = "smtp.GMAIL.com"
Flds.Item(schema & "smtpserverport") = 465
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = "[email protected]"
Flds.Item(schema & "sendpassword") = "YOURPASSWORD"
Flds.Item(schema & "smtpusessl") = 1
Flds.Update
With iMsg
.To = "[email protected]"
.From = "jacob <[email protected]"
.Subject = sArguments
.HTMLBody = message
.Sender = " "
.Organization = " "
.ReplyTo = " "
Set .Configuration = iConf
SendGMAILGmail = .Send
End With
set iMsg = nothing
set iConf = nothing
set Flds = nothing
사용 방법은 요구 사항에 따라 다릅니다. 첫 번째 방법은 명령줄의 모든 따옴표를 유지하는 반면 두 번째 방법은 단어 사이의 공백을 무시합니다.