Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.
Thread: Execute script on SMS receipt?is a discussion within the
File Modsforums, a part of the
I've written a bash script that will change my SMS ringtone for every tenth SMS that I get (I just like to mix things up haha). But for it to...
06-27-2010, 02:00 PM #1Execute script on SMS receipt?
I've written a bash script that will change my SMS ringtone for every tenth SMS that I get (I just like to mix things up haha). But for it to work, obviously, the script has to be executed when I receive a text message. Is there any way to do that? I have biteSMS installed and obviously it executes code when a text is received so it must be possible. Alternatively if there was some way I could just schedule a cron job or the like to run my script every x minutes that would be sufficient. Is there any way to do either one of these things? Thank you!
06-27-2010, 02:36 PM #2
Im pretty sure theres something like this on cydia that changes it every text message. If i find it, ill let you know and maybe you can contact the author of that program.
Pretty sure it is possible.
06-27-2010, 02:49 PM #3
^^ I know for a fact I remember seeing something like that on cydia. Unfortunatly I have a new bootrom 3GS with ios 4 so I cant check what it's called sorry. Good luck mate
06-27-2010, 04:43 PM #4
Thanks for the help, I looked on cydia but couldn't find it. But just using launchd to schedule a task I've been able to make my script run, and it successfully edits the iphone com.apple.springboard.plist to change the ringtone. But the iPhone doesn't recognize the changed preference until I respring which sort of defeats the purpose of this entire thing. Is there any way to manually force the iPhone to recognize the new preferences?
06-28-2010, 12:40 PM #5
Yea, I am overseas and have no sim w/ data i can use to browse. Good luck to you though, post it here when you have a solution as I would like to mess with this type of mod.
06-30-2010, 07:03 PM #6
11-11-2011, 11:53 PM #7Trigger Script on SMS message
This should get you on the right track at least.
Here is a link to an example script and launchd plist that triggers a script after a string is received in a text message
Last edited by Matthew Jasmer; 11-13-2011 at 02:13 AM. Reason: URL change
11-13-2011, 07:27 PM #8
the iPhone doesn't recognize the changed preference until I respring which sort of defeats the purpose of this entire thing.A lot of them are used for things like mathematical modelling of climate change, objects in space moving around another etc.
11-13-2011, 08:36 PM #9
11-14-2011, 12:50 AM #10Change sms ringtone every 6th incoming message
I think I have a solution. Use the plist I have at www.matthewjasmer.com and for your script use:
case $( sqlite3 /var/mobile/Library/SMS/sms.db "select COUNT(flags) % 35 from message where flags = 2" ) in
0) sb -s texttone:Chime sms-sound-identifier;;
6) sb -s texttone:Glass sms-sound-identifier;;
12) sb -s texttone:Horn sms-sound-identifier;;
18) sb -s texttone:Bell sms-sound-identifier;;
24) sb -s texttone:Electronic sms-sound-identifier;;
download sqlite and ericautils, throw that into a script. Try to send your self a bunch of texts and run it after each to test it. It Should change it every 6th incoming message. It doesn't play well with BiteSMS or the built in message app though. It seems like sqlite3 can't pull the data out of the file when either of those are open which probably won't be an issue with the launchd plist.
Last edited by Matthew Jasmer; 11-14-2011 at 01:56 AM.