+ Reply
Results 1 to 10 of 10

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: Execute script on SMS receipt?

is a discussion within the

File Mods

forums, a part of the

iPhone Modding

section;
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
...
  1. #1
    What's Jailbreak?
    Join Date
    Jun 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Execute 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!

  2. #2
    iPhone? More like MyPhone
    Join Date
    Apr 2010
    Location
    Wouldn't you like to know?
    Posts
    139
    Thanks
    1
    Thanked 32 Times in 30 Posts

    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.

  3. #3
    iPhone? More like MyPhone thechronic's Avatar
    Join Date
    Jul 2008
    Posts
    122
    Thanks
    9
    Thanked 9 Times in 8 Posts

    ^^ 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

  4. #4
    What's Jailbreak?
    Join Date
    Jun 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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?

  5. #5
    iPhone? More like MyPhone
    Join Date
    Apr 2010
    Location
    Wouldn't you like to know?
    Posts
    139
    Thanks
    1
    Thanked 32 Times in 30 Posts

    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.

  6. #6
    iPhone? More like MyPhone
    Join Date
    Aug 2008
    Posts
    200
    Thanks
    11
    Thanked 12 Times in 12 Posts

    Quote Originally Posted by dr3wster View Post
    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?
    Some changes are to take affect after the reboot because some files are being used by the system and wont change until their USE flag is 0
    iPhone 4
    Firmware : iOS4
    Carrier : Softbank (Japan)
    Jailbroken using Jailbreakme

  7. #7
    What's Jailbreak?
    Join Date
    Nov 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Trigger Script on SMS message
    Quote Originally Posted by dr3wster View Post
    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!

    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

    www.matthewjasmer.com
    Last edited by Matthew Jasmer; 11-13-2011 at 02:13 AM. Reason: URL change

  8. #8
    Green Apple ifine's Avatar
    Join Date
    Nov 2011
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  9. #9
    What's Jailbreak?
    Join Date
    Nov 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Quote Originally Posted by ifine View Post
    the iPhone doesn't recognize the changed preference until I respring which sort of defeats the purpose of this entire thing.
    download ericautils and try
    sb -s texttone:Glass sms-sound-identifier

    This takes effect right away. Just make sure to properly capitalize the sms tone name

  10. #10
    What's Jailbreak?
    Join Date
    Nov 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Change sms ringtone every 6th incoming message
    Quote Originally Posted by ifine View Post
    the iPhone doesn't recognize the changed preference until I respring which sort of defeats the purpose of this entire thing.

    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;;
    esac


    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.

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts