Menu
Home
Basic information:
Slideshow, watch this first
License
How to compile/install
- Instructions for Windows
How to configure
- Configuring providers
Localizing
How to run/use
SMS file format
- User Data Header
Additional information:
Version history (3.x)
National language shift tables
Hardware compatibility
Status monitor, Statistics file
Event handler, Alarm handler
Blacklist and Whitelist
Support:
Frequently asked questions
SMSTools3 Community
Get SMS Server Tools 3:
Download
Sponsored links
Search
Custom Search
Visitor locations
SMS Server Tools 3 Community
Welcome, Guest. The forum is currently read-only, but will open soon.
Sat Oct 12, 2024 09:14
Login
Register
Search
Active Topics
Terms of Use
Contact Admin
•
SMSTools3 Community
»
Sample scripts / setups
Bottom
Python script to create a message to send in /var/spool/sms/outgoing/
Login and Post Reply
Page: 1
Author
Post
mhmedia
Bottom
#1
Wed Apr 25, 2018 16:12, 78 months ago.
Member
Registered:
Apr 2018
Posts: 2
Location: United Kingdom
Here's a simple Python script to create a message to a (fixed) phone number via the command line. It writes out to /var/spool/sms/outgoing/ but can easily be changed to suit your setup.
makesms.py
#!/usr/bin/env python import sys import os,xmpp,random,string def SMStext(msg): try: ext = '.' + ''.join(random.choice(string.ascii_lowercase + string.ascii_uppercase + string.digits) for x in range(6)) outputfile = '/var/spool/sms/outgoing/makesms_send' + ext smsfile = open(outputfile, "w", 0) smsfile.write("To: 0nnnnnnnnnn\n\n") smsfile.write( msg ) smsfile.write("\n") smsfile.close() except IOError: print "There was an error writing to", outputfile sys.exit(1) try: msg = ' '.join(sys.argv[1:]) except: print 'No message text specified' sys.exit(1) finally: if ( len(sys.argv) == 1 ): print "no message specified: try "+sys.argv[0]+" hello world\n" sys.exit(1) SMStext(msg) sys.exit(0)
[ Select ]
[ Expand ]
edit:the "random" stuff is to create a semi-unique extension to the filename to avoid collisions. I.e.
makesms_send.OOLBLn
« Last edit by
mhmedia
on Wed Apr 25, 2018 16:16, 78 months ago. »
agardelein
Top
#2
Fri Jun 22, 2018 22:17, 76 months ago.
Member
Registered:
Jun 2018
Posts: 1
Location: France
And here is another one, based on GTK:
https://github.com/agardelein/textoter
This is based on GTK, there's an history of previous numbers.
Login and Post Reply
Page: 1
•
SMSTools3 Community
»
Sample scripts / setups
Top
Time in this board is UTC.
Privacy Policy
SMS Server Tools 3 Copyright © Keijo Kasvi.