Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Menu, Tray, NoStandard
- Menu, Standards, Standard
- Menu, Script, Add, Select Ringtone, SelectRingtone
- Menu, Script, Add, Select Message Tone, SelectMessageTone
- Menu, Script, Add, Set Ringtone ring time, RingTime
- Menu, Tray, Add, Script Stuff, :Script
- Menu, Tray, Add, Standard Stuff, :Standards
- IncomingCallText:="Incoming call on"
- PickUpText:="You have picked up the phone"
- MessageText:="You got a message on your phone"
- RingStopText:="The ringing has stopped"
- File = %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
- SettingsFile:="Settings.ini"
- IniRead, Ringtone, %SettingsFile%, Tones, Ringtone, None
- IniRead, MessageTone, %SettingsFile%, Tones, MessageTone, None
- If Ringtone = None
- Gosub, SelectRingtone
- If MessageTone = None
- Gosub, SelectMessageTone
- Goto, CheckChat
- Return
- SelectRingtone:
- FileSelectFile, Ringtone, 3,, Select a new Ringtone (Audio Files Only)
- IniWrite, %Ringtone%, %SettingsFile%, Tones, Ringtone
- MsgBox, 64, Ringtone Set!, New Ringtone Set!
- Return
- SelectMessageTone:
- FileSelectFile, MessageTone, 3,, Select a new Message Tone (Audio Files Only)
- IniWrite, %MessageTone%, %SettingsFile%, Tones, MessageTone
- MsgBox, 64, Message Tone Set!, New Message Tone Set!
- Return
- RingTime:
- Gui, Destroy
- 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.
- Gui, Add, Edit, w200
- Gui, Add, UpDown, vRingTime, 10000
- Gui, Add, Button, gSubmitTime, Submit
- Gui, Show
- Return
- SubmitTime:
- Gui, Submit, NoHide
- Gui, Destroy
- If Ringtime is not Number
- {
- MsgBox, 16, Invalid, INVALID INPUT!`nPlease input only numbers!
- Return
- }
- IniWrite, %RingTime%, %SettingsFile%, Times, RingTime
- MsgBox, 64, Success!, New Ring Time Set!
- Return
- CheckChat:
- Loop,
- {
- FileReadLine, RandomVar, %File%, %A_Index%
- If ErrorLevel
- {
- TotalLines:=A_Index-2
- Goto, CheckLine
- }
- ; Uncomment the following line to allow a splash image box to appear. Used for debugging.
- ; SplashImage,, x2000, %RandomVar%`n%A_Index%`n%TotalLines%
- }
- Return
- CheckLine:
- FileReadLine, LineCheck, %File%, %TotalLines%
- If TotalLines > 100
- {
- FileCreateDir, FileSaves
- FileMove, %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt, FileSaves\%A_Now%.txt
- }
- ; Uncomment the following line to allow a splash image box to appear. Used for debugging.
- ; SplashImage,,, %LineCheck%`n%TotalLines%
- IncomingCall:=InStr(LineCheck, "Incoming call on")
- PickUp:=InStr(LineCheck, "You have picked up the phone")
- Message:=InStr(LineCheck, "You got a message on your phone")
- RingStop:=InStr(LineCheck, "The ringing has stopped")
- ; Uncomment the following line to create a message box that appears on each loop. Used for debugging.
- /*
- MsgBox,
- (
- Line: %LineCheck%
- IncomingCall: %IncomingCall%
- PickUp: %PickUp%
- Message: %Message%
- RingStop: %RingStop%
- )
- */
- IniRead, Ringtone, %SettingsFile%, Tones, Ringtone, Ringtone.mp3
- IniRead, MessageTone, %SettingsFile%, Tones, MessageTone, MessageTone.mp3
- IniRead, RingSetting, %SettingsFile%, Times, RingTime, 600000
- If (Ringing = 1) and (A_TickCount-RingTime > RingSetting)
- {
- SoundPlay, %Ringtone%
- }
- If IncomingCall
- {
- FileAppend, AHK ITNTERCEPT`n`n, %File%
- SoundPlay, %Ringtone%
- RingTime:=A_TickCount
- Ringing:=1
- }
- If PickUp
- {
- FileAppend, AHK ITNTERCEPT`n`n, %File%
- SoundPlay, Silence.Silence
- Ringing:=0
- }
- If Message
- {
- FileAppend, AHK ITNTERCEPT`n`n, %File%
- SoundPlay, %MessageTone%
- }
- If RingStop
- {
- FileAppend, AHK ITNTERCEPT`n`n, %File%
- SoundPlay, Silence.Silence
- Ringing:=0
- }
- Sleep, 500
- Goto, CheckChat
- Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement