script for timed "broadcasts"
Moderator: Moderators
script for timed "broadcasts"
sorry if this has been answered before but i can't find it.
is there, or could any of you amazing minds out there plez write me, a script to send out a series of messages at timed intervals on a dc hub,
e.g. maybe four different messages to be sent out at 15 mniute intervals
thnkx, Marv
hub: uks.no-ip.com
web: http://uks.150m.com
web: http://uks.no-ip.info/index.htm
thnkx, Marv
»[44]{¤.5Mbit}µå®v?ñ?«
- Marvin
hub: uks.no-ip.com
web: http://uks.150m.com
web: http://uks.no-ip.info/index.htm
»[44]{¤.5Mbit}µå®v?ñ?«
- Marvin
hub: uks.no-ip.com
web: http://uks.150m.com
web: http://uks.no-ip.info/index.htm
HaArD has an answer -> http://dcplusplus.sourceforge.net/forum ... ed+message
Actually, if you're talking about rotating messages, like 1 of 4 messages gets sent to main chat every 15 minutes, then the code will have to modified a bit.
Actually, if you're talking about rotating messages, like 1 of 4 messages gets sent to main chat every 15 minutes, then the code will have to modified a bit.
-
- Posts: 147
- Joined: 2003-01-04 02:20
- Location: Canada http://hub-link.sf.net
- Contact:
Wow... that takes me back... I modified/enhanced that one a bit....
Code: Select all
' InfoBot by HaArD
' Version 1.0
' April 14, 2003
'
' This script will send a message, contained in a text file, to Main Chat every 'n' minutes.
' Inspired and based on a script written by Shadowtek.
Dim sBotName, iMinutes, sFileName
Sub main()
sBotName = "InfoBot"
iMinutes = 1 'Set the time between message broadcast to 120 minutes (2 hours)
sFileName = "Message.txt" 'By default this file should be placed in the same dir as DC Hub.exe
'To use a different location specify the full path ie. "C:\Textfiles\Message.txt"
tmrScriptTimer.interval = 60000 'Set The Timer Interval to 1 minute
tmrScriptTimer.enabled = True
End Sub
Sub tmrScriptTimer_Timer()
If tmrScriptTimer.tag = "" Then
tmrScriptTimer.tag = "0"
End If
tmrScriptTimer.tag = clng(tmrScriptTimer.tag) + 1
If clng(tmrScriptTimer.tag) => iMinutes Then
tmrScriptTimer.tag = "0"
colUsers.SendChatToAll CStr(sBotName), ReadFile(sFileName)
End If
End Sub
Function ReadFile(sFileName)
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(sFileName) Then
Set file = fso.OpenTextFile(sFileName,1,True)
ReadFile = file.ReadAll
file.Close
Else
ReadFile = "Message file not found..."
End If
End Function
thnkx guys...i've never done it before but i'll try to change it to pick-up 1 of 4 rotating files.
thnkx again.
thnkx again.
thnkx, Marv
»[44]{¤.5Mbit}µå®v?ñ?«
- Marvin
hub: uks.no-ip.com
web: http://uks.150m.com
web: http://uks.no-ip.info/index.htm
»[44]{¤.5Mbit}µå®v?ñ?«
- Marvin
hub: uks.no-ip.com
web: http://uks.150m.com
web: http://uks.no-ip.info/index.htm