script for timed "broadcasts"

Which hub software is the best? Where can I find script XXX? Discuss it here...(no, this is not for advertising your hub...)

Moderator: Moderators

Locked
Marv
Posts: 2
Joined: 2003-08-16 19:40
Location: 44
Contact:

script for timed "broadcasts"

Post by Marv » 2003-08-16 20:03

:oops:

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

Xan1977
Forum Moderator
Posts: 627
Joined: 2003-06-05 20:15

Post by Xan1977 » 2003-08-16 23:03

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.

HaArD
Posts: 147
Joined: 2003-01-04 02:20
Location: Canada http://hub-link.sf.net
Contact:

Post by HaArD » 2003-08-17 00:42

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

Marv
Posts: 2
Joined: 2003-08-16 19:40
Location: 44
Contact:

Post by Marv » 2003-08-17 11:09

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, Marv

»[44]{¤.5Mbit}µå®v?ñ?«
- Marvin

hub: uks.no-ip.com
web: http://uks.150m.com
web: http://uks.no-ip.info/index.htm

Locked