Lars Nielsen, MobileNation ApS - Denmark
Member Username: Larsmservice
Post Number: 247 Registered: 10-2003
| | Posted on Tuesday, October 04, 2005 - 06:49 pm: | |
Found an old page here with an example of how to fetch incoming sms with Wscript. The code would remove all white spaces which is not the best thing to do. Try Named Arguments instead: Put this into your 2-way: c:\windows\system32\wscript.exe C:\NowSMS\script\test\namedarg.vbs "/sender:@@SENDER@@" "/prefix:@@SMSPREFIX@@" "/message:@@FULLSMS@@" "/recipient:@@RECIP@@" And in the file: "C:\NowSMS\script\test\namedarg.vbs" put this: Set argsNamed = WScript.Arguments.Named LogTxt = "BEGIN:" & vbcrlf LogTxt = LogTxt & "Sender=" & argsNamed.Item("sender") & vbcrlf LogTxt = LogTxt & "prefix=" & argsNamed.Item("prefix") & vbcrlf LogTxt = LogTxt & "message=" & argsNamed.Item("message") & vbcrlf LogTxt = LogTxt & "recipient=" & argsNamed.Item("recipient") & vbcrlf LogTxt = LogTxt & "END" & vbcrlf writelog(LogTxt) Set argsNamed = nothing function writelog(logstr) Dim fsl,flog Set fsl=CreateObject("Scripting.FileSystemObject") if Not (fsl.FileExists("C:\NowSMS\script\test\NAMEDTEST.log"))=true Then Set flog=fsl.CreateTextFile("C:\NowSMS\script\test\NAMEDTEST.log",true) flog.WriteLine(now() & " " & logstr) flog.Close Else Dim fll Set fll=fsl.OpenTextFile("C:\NowSMS\script\test\NAMEDTEST.log",8,true) fll.WriteLine(now() & " " & logstr) fll.Close Set fll=Nothing End if Set flog=nothing Set fsl=nothing End function Should return something like: " 5-10-2005 01:15:22 BEGIN: Sender=+4561304050 prefix=Hello message=Hello World. How are you ;-) recipient=28600879 END " |