An example of 2 way sms scripting

An example of 2 way sms scripting SearchSearch
Author Message
lars mservice
Posted on Wednesday, May 28, 2003 - 09:28 pm:   

Hi.
This is a small example of how to use scripting when working with the 2 way sms system i nowsms.

This example should get you started on making your own creative services using nowsms.

I have done a lot now and is still writing more and more advanced features into it so that many more services can be sold to our customers.

Enough said here's the example using wscript.

Open nowsms and go to the 2 way sms tab.

Type in a keyword or just an asterix * in the sms command prefix field.

In the Command to excute do something like this:

c:\windows\system32\cscript.exe //Nologo c:\temp\incall.vbs @@SENDER@@ @@SMSPREFIX@@ @@SMS@@

Use whatever path or filename you desire.

Now open notepad and put this into it:
 
on error resume next

Set Args = WScript.Arguments
For I = 0 to Args.Count - 1
if (I > 0) Then
LogTxt = LogTxt & " "
End if
LogTxt = LogTxt & Args(I)
Next
Set Args = nothing

writelog(LogTxt)

public function writelog(logstr)
Dim fsl,flog
Set fsl=CreateObject("Scripting.FileSystemObject")
if Not (fsl.FileExists("c:\temp\NowSMS.log"))=true Then
Set flog=fsl.CreateTextFile("c:\temp\NowSMS.log",true)
flog.WriteLine(now() & " - " & logstr)
flog.Close
Else
Dim fll
Set fll=fsl.OpenTextFile("c:\temp\NowSMS.log",8,true)
fll.WriteLine(now() & " - " & logstr)
fll.Close
Set fll=Nothing
End if
Set flog=nothing
Set fsl=nothing
End function


save it given the filename tou wrote in the Command to execute field. eg. incall.vbs

Now when somebody sends a sms with your selected keyword, nowsms will execute the vbsfile. In this example it will put all into a logfile.

Thats it basically.

Now this 2 way sms tool is very usefull. Just imagine what you can use it for.


Hope this little thing will help some outthere to get started..

In doubt... mail me...


;)Lars