Thursday, February 09, 2006

Sample code - Link to page in PDF doc, Text Messaging – send as plain text from Visualfiles

Link to page in PDF doc

Text Messaging – send as plain text from Visualfiles

Link to page in PDF doc

Link PDF:Link Page2

Text Messaging – send as plain text from Visualfiles

________________________________________________________________________

SCRIPT NAME: Send-SMS

DESCRIPTION: Send text message to mobile

TEMPLATE: System Script

DEVELOPER: Michael McGuire 11-Jan-2006

_______________________

[&Assign TF11=" "]

[&Assign TF11=MT05]

[&If TF11=" "]

[&Assign TF11='Case not found - Enter file code'(text)]

[&Select MT,code=TF11]

[&If Status(Select)<>""]

[&message "Case Not found - " +MT05]

[&QUIT]

[&endif]

[&endif]

[&Message "This will send an SMS text message on file "+MT05+". "+""+"This should only be used to send to a mobile number for "+CL01+"."+"The message entered will be prefixed by "+US12+". "]

[&Assign TF04=" "]

[&Assign TF05=" "] *** oscommand text

[&Assign TF08=" "]

[&Grid action="delete"]

[&Grid action="create"]

[&Grid action="create"]

[&Grid action="create-col",name="Name",format="X(30)",type="char"]

[&Grid action="create-col",name="Mobile No",format="X(30)",type="char",update,key]

[&Grid action="create-row"]

[&Assign GR02=ALLCLIENTS_ALLCLIENTS.PRINCIPALCONTACT_INDI.FIL05]

[&Grid action="assign",column="1",value="Client Mobile"]

[&Grid action="create-row"]

[&Assign GR02=ALLCLIENTS_ALLCLIENTS.PRINCIPALCONTACT_INDI.FIL04]

[&Grid action="assign",column="1",value="Client Tel 1"]

[&Grid action="create-row"]

[&Assign GR02=ALLCLIENTS_ALLCLIENTS.PRINCIPALCONTACT_INDI.FIL03]

[&Grid action="assign",column="1",value="Client Tel 2"]

[&Grid action="create-row"]

[&Grid action="assign",column="1",value="Other - please enter"]

[&Grid action="assign",column="2",value=" ",update]

[&Grid action="display",title="Select Mobile to text",button1="Cancel",button2="OK",result=TF03,rows=3]

[&DoWhile TF03=""]

[&Grid action="display",title="Select Mobile to text",button1="Cancel",button2="OK",result=TF03,rows=3]

[&EndDoWhile]

[&Assign TF08=TF03:Char(first=1,number=2)]

[&IF TF08<>"07"]

[&message "The selected number does not appear to be a mobile number. Please re-select"]

[&Grid action="display",title="Select Mobile to text",button1="OK",button2="Cancel",result=TF03,rows=3]

[&EndIf]

[&Assign TF03=TF03:REPLACE(" ","")]

[&Assign TF03=TF03+"@clientinform.net"]

*** ___________________________format message

[&Assign TF01=" "]

[&Grid action="create"]

[&Grid action="create-col",name="Click below and type message",format="X(100)",type="char",key,update]

[&Grid action="create-row"]

[&Grid action="assign",column="1",update]

[&Grid action="create-row"]

[&Grid action="assign",column="1",value=" "]

[&Grid action="create-row"]

[&Grid action="assign",column="1",value="Click OK when finished, do NOT press return"]

[&Grid action="display",title="Text Message",button1="Cancel",button2="OK",result=TF01,rows=3]

*** ______________________________________________________send to mobile

[&Assign TF21="mgm@beteshfox.co.uk"]

[&Assign TF02="From "+US12+"-"+TF01]

[&Assign TF05="S:\sendsms.bat " +quote+TF03+quote+" "+quote+TF02+quote+" "+quote+US12+quote]

[&oscommand TF05]

&oscommand TF05,interactive]

[&Out "S:\Departments\reports\client_sms.txt":date+","+time+","+MT05+","+CLI16+","+TF03+","+US02+","+TF02,append]

* &Out "S:\Departments\reports\client_sms.txt":date+","+time+","+MT05+","+CLI16+","+TF03+","+US02+","+TF02+","+"command="+TF05,append]

[&Assign TF022="Contact Client- "+TF02]

[&History TF022,activity="11",units=1,noconfirm]

[&Grid action="delete"]

*** _________________________________________________________________________***

*&Message "This will send an SMS text message on file "+MT05+". This should only be used to send to a Client's mobile number."+""+"The message entered will be prefixed by Betesh Fox & Co and your name. "]

*** &Assign TF991='Continue ' (Choose "No":"Yes")]

*** &amp;If TF991="No"] &QUIT] &endif]

*** &Assign TF991='Continue ' (Choose "No":"Yes")]

*** &amp;If TF991="No"] &QUIT] &endif]

* &message TF02]

* &Mail to=TF03, subject="Betesh Fox contact.", message=TF02]

* &Mail to=TF03,bcc = TF21,subject="Betesh Fox contact."+MT05, message=TF02]

&Assign TF01='Type message'(Notes)]

&Assign TF011=TF01(Notes)]

&Assign TF02=TF01:Char(first=121,number=10)]

&If TF02<>""] *** message>120 chars

&Message "You have exceeded 120 Characters, please amend your message."]

&Assign TF01=TF01:Char(first=1,number=120)]

&EndIf]

&Assign TF01=" "]

&Grid action="create"]

&Grid action="create-col",name="Confirm Message",format="X(120)",type="char",key,update]

&Grid action="create-row"]

&Grid action="assign",column="2",value=" ",update]

&Grid action="display",title="Message",button1="Cancel",button2="OK",result=TF01,rows=3]

&message TF01]

&debug]

&Mail to=TF03, subject="Betesh Fox contact.", message=TF02]

&Mail to=TF21, subject="Betesh Fox contact.Sent", message=TF02+"-"+TF03]

&Assign TF05="C:\sendsms.bat " +quote+TF03+" "+quote+TF02+quote+" "+quote+US12+quote]

&oscommand TF05,interactive]

*** sendsms.bat

____________________________________________________________________________

SCRIPT NAME: SendSMS.bat

DESCRIPTION: Sendmail text message to mobile

TEMPLATE: Batch file

DEVELOPER: Michael McGuire 7-Feb-2006

____________________________________________________________________________

@echo off

SETLOCAL

SET SENDMAIL=sndmail.exe -b mess.txt -f %~3 -X 200.1.1.44

SET MAILUSER=-u betesh\stephen.marsh -p tax.man9

SET SUBJECT=Betesh Fox contact

cd /d S:

echo.

echo Send SMS text message...

echo.
echo. >mess.txt
echo %~2 >>mess.txt
%sendmail% -s "%SUBJECT%" -r %~1
::echo error %errorlevel%

%sendmail% -s "%SUBJECT% -message sent" -r mgm@beteshfox.co.uk
%sendmail% -s "%SUBJECT% -message sent" -r %~3

***_______________________________________________________________________________________

0 Comments:

Post a Comment

<< Home