Serious Newbie Help

Serious Newbie Help SearchSearch
Author Message
Anonymous
 
Posted on Friday, July 16, 2004 - 03:17 pm:   

Can anyone point me in the right direction for the following.
I would like to action the gateway to send a flat file text message depending upon the first line of text sent.

Many thanks
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 3071
Registered: 10-2002
Posted on Friday, July 16, 2004 - 07:38 pm:   

If I'm interpreting your request correctly, you want to have people send SMS messages to you, and based upon the starting text of the message, you want to send back a reply using text from a flat text file.

If that's what you want to do, then this is actually quite simple.

As a starting point, I'd encourage you to first try the "Echo" example in our documentation. This example can be found in the 2-way documentation at the following link:

http://www.nowsms.com/documentation/ProductDocumentation/2_way_sms_support.htm

As a next step, I'm going to ask you to create a file named 2way.bat with the following content:

@echo off
if %2 == test goto test
if %2 == help goto help
goto exit
:test
echo Test OK!
goto exit
:help
echo You need help.
goto exit
:exit

For the sake of this example, I'm going to assume that you put this 2way.bat file into a directory named c:\smsin.

Now, define a "2-way" command as follows:

Define an “SMS Command Prefix” of “*” (wildcard), or any prefix of your choosing.

Define “Command to Execute” as “c:\windows\system32\cmd.exe /c c:\smsin\2way.bat @@SENDER@@ @@FULLSMS@@”.

Check “Command returns response text”.

Press “Add” to add the command to the “Received SMS Command Table”.

If you send a message in to the gateway with the start of the SMS message saying "test", then you will get a reply back that says "Test OK!". If you send a message that starts with "help", then you will get a reply back that says "You need help".

Other keywords will be silently ignored, although you could modify this example to take some other action.

If you wanted to change this example to return content from a flat text file, just change the "echo" references to "type c:\path\filename.ext" as appropriate.

Moving beyond batch files there are some more complex 2-way examples that can be found at the following link:

http://support.nowsms.com/discus/messages/1/4520.html
Anonymous
 
Posted on Monday, July 19, 2004 - 10:50 am:   

Many Thanks Bryce, this has answered my question.
Anonymous
 
Posted on Monday, July 19, 2004 - 12:11 pm:   

Just another quick question, if for example I wanted to change the scripts you gave me to work on 2 different keywords, how could i do that. For example, say i had an object and that object had 3 variables eg, if i txt 'car 1' i would like to to work on both keywords, run a script for car, then parse the second keyword. Not sure if this is clear or not.
Many thanks in advance for any information.