Results 1 to 14 of 14
  1.    #1  
    I decided to take on a request, as discussed on this thread. They were looking for an app that will randomly change the ringtone. {Image to come soon}.

    Here's the source code:
    Code:
    #        Author : Crazie.Eddie@Flashmail.com
    #   Description : Changes ringtone randomly
    #       Version : 1.0 Beta
    #
    # Mortscript ver: 4.0, 4.0 (RC10)
    #    Support PPC: Treo 700wx (Sprint)
    #
    # CHANGE LOG:
    # 2007.04.18 - Initial creation (CE)
    #
    ##################################################################
    #
      ThisScriptPath = SystemPath("ScriptPath")
      ThisScriptName = SystemPath("ScriptName") & SystemPath("ScriptExt")
      ThisScript     = ThisScriptPath \ ThisScriptName
    
      MP3Path        = "\Windows\Rings"
    # ================================================================
    #
    # Determines the DeviceType.
    # ----------------------------------------------------------------
    #
      DeviceVal = RegRead ("HKLM","Software\Palm\Version","SoftwareVersionString")
      DeviceType = SubStr(DeviceVal, 5, 5)
    
    # Message(DeviceVal, "SOFTWARE VERSION")
    
      If (DeviceType ne "700WX")
           Message(ThisScriptName & " may not function properly on this device.", "WARNING")
      EndIf
    
    # ================================================================
    # 
    # Verifies valid MP3 directory.  Also reads the files in the
    # directory.  Script will only execute if there is more than 1
    # MP3 in the selected directory.
    # ----------------------------------------------------------------
    
      MP3FullPath = MP3Path \ "*.*"
    
      DirValid     = DirExists(MP3Path)
      If (DirValid = 0)
          Message(MP3FullPath & " does not exist", "TERMINATION ERROR")
          Exit
      EndIf     
    
    
      MP3Count    = 0
    
      ForEach Song in files (MP3FullPath)
              MP3Count = MP3Count + 1
              MP3[MP3Count] = Song
      EndForEach
    
      If (MP3Count <= 1)
          Message("Must have more than 1 MP3", "TERMINATION ERROR")
          Exit
      EndIf
    
    
    
    # ================================================================
    #
    # Option to start script or creates/restore settings for RingTone
    # ----------------------------------------------------------------
    
      RingerINI = ThisScriptPath \ (SystemPath("ScriptName") & ".ini")
    
      RingerINIval = FileExists(RingerINI)
    
      If (RingerINIval = 0)
             MenuOption[1] = "Randomize ringtones"
             MenuOption[2] = "Save default settings"
    
             Choice ("Create Settings", SystemPath("ScriptName") & ".ini NOT found. Select to start the script or SAVE settings." , MenuOption)
    
                    Case 1
                         Message("Ringtone Randomizer started. To terminate script, perform a SOFT RESET", "SCRIPT STATUS")
                         Call CreateINI
                         Call MainScript
                    Case 2
                         Call CreateINI
                         Message(RingerINI & " settings file created", "SCRIPT STATUS")
             EndChoice
             EXIT
    
          Else
    
             MenuOption[1] = "Randomize ringtones"
             MenuOption[2] = "Restore default settings"
    
             Choice ("Restore Settings", SystemPath("ScriptName") & ".ini found. Select to start the script or to RESTORE settings.", MenuOption)
    
                    Case 1
                         Message("Ringtone Randomizer started. To terminate script, perform a SOFT RESET", "SCRIPT STATUS")
                         Call MainScript
                    Case 2
                         KnownCaller   = IniRead(RingerINI, "Default", "KnownCaller")
                         UnknownCaller = IniRead(RingerINI, "Default", "UnknownCaller")
                         RoamingCaller = IniRead(RingerINI, "Default", "RoamingCaller")
    
                         RegWriteString ("HKCU","ControlPanel\Sounds\PlmORingTone1","Sound", KnownCaller)
                         RegWriteString ("HKCU","ControlPanel\Sounds\PlmORingTone2","Sound", UnknownCaller)
                         RegWriteString ("HKCU","ControlPanel\Sounds\PlmORingTone3","Sound", RoamingCaller)
                         Message("Ringtone restored to " & KnownCaller, "SCRIPT STATUS")
             EndChoice
             EXIT
      EndIf
    
    # ================================================================
    #
    # Main subroutine which will change the MP3 randomly.
    # If MP3 is somehow removed, it will select another MP3.
    # If this is somehow removed, the script will terminate.
    # ----------------------------------------------------------------
    
      Sub MainScript
    
          While(1)
    
    #          Changes ringtone for Known Caller
               Call Randomize
               MP3toPlay = MP3[Y]
               RegWriteString ("HKCU","ControlPanel\Sounds\PlmORingTone1","Sound", MP3toPlay)
    
    #          Changes ringtone for Unknown Caller
               Call Randomize
               MP3toPlay = MP3[Y]
               RegWriteString ("HKCU","ControlPanel\Sounds\PlmORingTone2","Sound", MP3toPlay)
    
    #          Changes Ringtone when Roaming
               Call Randomize
               MP3toPlay = MP3[Y]
               RegWriteString ("HKCU","ControlPanel\Sounds\PlmORingTone3","Sound", MP3toPlay)
    
               ThisScriptVal = FileExists(ThisScript)
               If (ThisScriptVal = 0 )
                   Message(ThisScript & " does not exist", "APPLICATION TERMINATING")
                   EXIT
               EndIf
    
               Sleep (60549)
          EndWhile
    
      EndSub
    
    # ================================================================
    #
    # Subroutine which creates the ini file if it does not exist.
    # The ini file consists of the default ringtone and total number
    # of songs found.
    # ----------------------------------------------------------------
      Sub CreateINI
    
          KnownCaller   = RegRead ("HKCU","ControlPanel\Sounds\PlmORingTone1","Sound")
          UnknownCaller = RegRead ("HKCU","ControlPanel\Sounds\PlmORingTone2","Sound")
          RoamingCaller = RegRead ("HKCU","ControlPanel\Sounds\PlmORingTone3","Sound")
    
          WriteFile (RingerINI, "# =======================================", 0)
          WriteFile (RingerINI, "^NL^", 1)
          WriteFile (RingerINI, "# ---------------------------------------", 1)
          WriteFile (RingerINI, "^NL^", 1)
          WriteFile (RingerINI, "[Default]", 1)
          WriteFile (RingerINI, "^NL^", 1)
          WriteFile (RingerINI, "KnownCaller=", 1)
          WriteFile (RingerINI, KnownCaller, 1)
          WriteFile (RingerINI, "^NL^", 1)
          WriteFile (RingerINI, "UnknownCaller=", 1)
          WriteFile (RingerINI, UnknownCaller, 1)
          WriteFile (RingerINI, "^NL^", 1)
          WriteFile (RingerINI, "RoamingCaller=", 1)
          WriteFile (RingerINI, RoamingCaller, 1)
          WriteFile (RingerINI, "^NL^", 1)
          WriteFile (RingerINI, "[Playlist]", 1)
          WriteFile (RingerINI, "^NL^", 1)
          WriteFile (RingerINI, "MP3Count=", 1)
          WriteFile (RingerINI, MP3Count, 1)
          WriteFile (RingerINI, "^NL^", 1)
    
      EndSub
    
    
    # ================================================================
    #
    # Subroute to create a random number >0 and no greater than the
    # number of songs
    # ----------------------------------------------------------------
    
      Sub Randomize
    
          x=TimeStamp()
          tp=substr(x,9,2)
          z=(substr(tp,2,1) & substr(tp,1,1))
          r=z*MP3Count/100
          y=part(r,".",1)+1
    
      EndSub
    The script saves the default settings for your ringtone to an .ini file. It then uses the default ringtone directory as \Windows\Rings, which can easily be modified within the script. The script lists all .wav, .mp3, & .mid files in the selected folder and produces a playlist for the ringtone. It then assigns each song into an array. A pseudo random subroutine determines which song in the array to assign as a ringtone. The ringtone is changed every 60 seconds.


    This script has been tested on a Treo 700wx and should function on a Treo 700w. I'm currently working to make in functional on a Treo 750.



    VERSION:
    1.0 Beta

    CHANGE LOG:
    2007.04.18 - Initial creation (CE)


    Install Instructions:
    1. Download the zip file.
    2. Extract the zip file.
    3. Copy the extracted .CAB file onto your device.
    4. Click on .CAB on your device to execute the installation.
    5. Go to Programs and click on RingtoneRND.


    Mortscript.exe must be installed and registered on your device


    Future Releases:
    - Functional on Treo 750
    - Better calculation for randomizing
    - Have a separate ringtone for Known caller, Unknown caller, and Roaming. Right now, the script uses the same ringtone for each.
    Last edited by crazie.eddie; 04/22/2007 at 10:33 PM.
  2.    #2  
    Anyone with a 700w and 750 and familiar with registries, may I ask for some assistance? I was wondering if you can let me know where the registry entries for Known caller, Unknown caller, and Roaming caller is for each device.

    Thanks
  3. #3  
    unknown entry is here on 750

    hkcu/control panel/notifications
    {93395D1D-1E98-4784-9AD2-F236BE9BF32E}
    Palm III > HS Visor > Treo 600 > Treo 650 > Treo 750 > Treo Pro > PrePlus GSM

    "95% of all software issues are due to USER ERROR."
  4. #4  
    roaming:

    {58CA00A1-FE18-4ABC-8A5A-78B0F5661848}
    Palm III > HS Visor > Treo 600 > Treo 650 > Treo 750 > Treo Pro > PrePlus GSM

    "95% of all software issues are due to USER ERROR."
  5.    #5  
    Thanks Scotty. Are those the only locations? I had something similar on my 700wx for Unknown and Roaming caller, but after some searching, I also found...
    HKCU\ControlPanel\Sounds\PlmORingTone2\Sound
    HKCU\ControlPanel\Sounds\PlmORingTone3\Sound
  6. #6  
    ringtone2 looks like unknown and I have that entry... 3 looks to be roaming ringtone...you're rigt
    Palm III > HS Visor > Treo 600 > Treo 650 > Treo 750 > Treo Pro > PrePlus GSM

    "95% of all software issues are due to USER ERROR."
  7.    #7  
    Ok. Thanks. So it looks like the only issue might be a 700w, since the 700wx and 750 appear to be similar regarding the registries.
  8. #8  
    I would like to comment on the quality of this code. It's very well documented and organized. The presentation is, like, really awesome.

    -- JDC
  9.    #9  
    Quote Originally Posted by jdcochran View Post
    I would like to comment on the quality of this code. It's very well documented and organized. The presentation is, like, really awesome.

    -- JDC
    If you're serious, then thanks. Actually, I think I got the idea from your codes.

    If you're not serious, then :P LOL
  10. #10  
    I don't think he's kidding. I thought the same when I saw your code. Perfection.
  11.    #11  
    In that case, thanks to the both of you. I can't really take all the credit. I was also impressed with JDCochrans coding on Forcecast and just followed along a similar format.
    Last edited by crazie.eddie; 04/23/2007 at 04:14 AM.
  12. #12  
    Quote Originally Posted by crazie.eddie View Post
    In that case, thanks to the both of you. I can't really take all the credit. I was also impressed with JDCochrans coding on Forcecast and just followed along a similar format.
    That explains it. I must be a narcissist.

    Seriously, you took my format and cranked it up a notch or two. The commenting was so clear, even a newbie would be forced to stop, pause, read, and say to themselves: this dude has it going on.

    I was also impressed with your installations instructions.

    Keep up the good work.

    Sincerely, and with tongue firmly planted away from cheek.

    -- John
  13. #13  
    I don't know if I'm missing something but i can't find the link to download the file. Can anyone help me with this? I've been dying for a rogram like this.
  14. #14  
    I think this is the latest version.

    http://discussion.treocentral.com/sh...4&postcount=33

Posting Permissions