Advertisement
Doug4347

MTG Ringtones

Nov 14th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Menu, Tray, NoStandard
  2. Menu, Standards, Standard
  3. Menu, Script, Add, Select Ringtone, SelectRingtone
  4. Menu, Script, Add, Select Message Tone, SelectMessageTone
  5. Menu, Script, Add, Set Ringtone ring time, RingTime
  6. Menu, Tray, Add, Script Stuff, :Script
  7. Menu, Tray, Add, Standard Stuff, :Standards
  8. IncomingCallText:="Incoming call on"
  9. PickUpText:="You have picked up the phone"
  10. MessageText:="You got a message on your phone"
  11. RingStopText:="The ringing has stopped"
  12. File = %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
  13. SettingsFile:="Settings.ini"
  14. IniRead, Ringtone, %SettingsFile%, Tones, Ringtone, None
  15. IniRead, MessageTone, %SettingsFile%, Tones, MessageTone, None
  16. If Ringtone = None
  17.     Gosub, SelectRingtone
  18. If MessageTone = None
  19.     Gosub, SelectMessageTone
  20. Goto, CheckChat
  21. Return
  22.  
  23. SelectRingtone:
  24.     FileSelectFile, Ringtone, 3,, Select a new Ringtone (Audio Files Only)
  25.     IniWrite, %Ringtone%, %SettingsFile%, Tones, Ringtone
  26.     MsgBox, 64, Ringtone Set!, New Ringtone Set!
  27. Return
  28.  
  29. SelectMessageTone:
  30.     FileSelectFile, MessageTone, 3,, Select a new Message Tone (Audio Files Only)
  31.     IniWrite, %MessageTone%, %SettingsFile%, Tones, MessageTone
  32.     MsgBox, 64, Message Tone Set!, New Message Tone Set!
  33. Return
  34.  
  35. RingTime:
  36.     Gui, Destroy
  37.     Gui, Add, Text,, Please set a ring time.`nThis is how long your ring tone will go on for, before restarting.`nThe time is in ms. This means that 1000 is equal to 1 second.`nThe ringtone will always stop when your phone stops ringing.
  38.     Gui, Add, Edit, w200
  39.     Gui, Add, UpDown, vRingTime, 10000
  40.     Gui, Add, Button, gSubmitTime, Submit
  41.     Gui, Show
  42. Return
  43.  
  44. SubmitTime:
  45.     Gui, Submit, NoHide
  46.     Gui, Destroy
  47.     If Ringtime is not Number
  48.     {
  49.         MsgBox, 16, Invalid, INVALID INPUT!`nPlease input only numbers!
  50.         Return
  51.     }
  52.     IniWrite, %RingTime%, %SettingsFile%, Times, RingTime
  53.     MsgBox, 64, Success!, New Ring Time Set!
  54. Return
  55.  
  56. CheckChat:
  57.     Loop,
  58.     {
  59.         FileReadLine, RandomVar, %File%, %A_Index%
  60.         If ErrorLevel
  61.         {
  62.             TotalLines:=A_Index-2
  63.             Goto, CheckLine
  64.         }
  65.         ; Uncomment the following line to allow a splash image box to appear. Used for debugging.
  66.         ; SplashImage,, x2000, %RandomVar%`n%A_Index%`n%TotalLines%
  67.     }
  68. Return
  69.  
  70. CheckLine:
  71.     FileReadLine, LineCheck, %File%, %TotalLines%
  72.     If TotalLines > 100
  73.     {
  74.         FileCreateDir, FileSaves
  75.         FileMove, %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt, FileSaves\%A_Now%.txt
  76.     }
  77.     ; Uncomment the following line to allow a splash image box to appear. Used for debugging.
  78.     ; SplashImage,,, %LineCheck%`n%TotalLines%
  79.     IncomingCall:=InStr(LineCheck, "Incoming call on")
  80.     PickUp:=InStr(LineCheck, "You have picked up the phone")
  81.     Message:=InStr(LineCheck, "You got a message on your phone")
  82.     RingStop:=InStr(LineCheck, "The ringing has stopped")
  83.     ; Uncomment the following line to create a message box that appears on each loop. Used for debugging.
  84.     /*
  85.     MsgBox,
  86.     (
  87.     Line: %LineCheck%
  88.     IncomingCall: %IncomingCall%
  89.     PickUp: %PickUp%
  90.     Message: %Message%
  91.     RingStop: %RingStop%
  92.     )
  93.     */
  94.     IniRead, Ringtone, %SettingsFile%, Tones, Ringtone, Ringtone.mp3
  95.     IniRead, MessageTone, %SettingsFile%, Tones, MessageTone, MessageTone.mp3
  96.     IniRead, RingSetting, %SettingsFile%, Times, RingTime, 600000
  97.     If (Ringing = 1) and (A_TickCount-RingTime > RingSetting)
  98.     {
  99.         SoundPlay, %Ringtone%
  100.     }
  101.     If IncomingCall
  102.     {
  103.         FileAppend, AHK ITNTERCEPT`n`n, %File%
  104.         SoundPlay, %Ringtone%
  105.         RingTime:=A_TickCount
  106.         Ringing:=1
  107.     }
  108.     If PickUp
  109.     {
  110.         FileAppend, AHK ITNTERCEPT`n`n, %File%
  111.         SoundPlay, Silence.Silence
  112.         Ringing:=0
  113.     }
  114.     If Message
  115.     {
  116.         FileAppend, AHK ITNTERCEPT`n`n, %File%
  117.         SoundPlay, %MessageTone%
  118.     }
  119.     If RingStop
  120.     {
  121.         FileAppend, AHK ITNTERCEPT`n`n, %File%
  122.         SoundPlay, Silence.Silence
  123.         Ringing:=0
  124.     }
  125.     Sleep, 500
  126.     Goto, CheckChat
  127. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement