Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb sender script delay?

Status
Not open for further replies.
Nov 9, 2020
2
RO
Option Explicit

Dim A2, A1, s, f1, ts, ts1, fso, fso1, Soobshenie, SiteAddr1, SiteAddr2, bs, cur_time, api_key, api_secret, Message, HTTPgetCrypted
Const ForReading = 1
Const ForWriting = 2

Main

Sub Die()

End Sub



Sub Main

'NEXMO Credentials
api_key = ""
api_secret = ""

Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso_OpenTextFile("nexmonumbers.txt", ForReading)
SiteAddr1 = "SiteAddr2 = "&type=unicode&text="
Message = "sms text"

Do While Not ts.AtEndOfStream
s = ts.ReadLine
HTTPgetCrypted = SiteAddr1 & s & SiteAddr2 & Message
A1 = ""
A1 = HTTPGetSend(HTTPGetCrypted)
cur_time = time & " --- " & date
Set fso1 = CreateObject("Scripting.FileSystemObject")
Set ts1 = fso1.OpenTextFile("nexmoresult.txt", 8, True)
ts1.WriteLine(cur_time)
ts1.WriteLine("--------------------------------------------------------------------------------------")
ts1.WriteLine(A1)
ts1.Close
Set fso1 = Nothing
Set ts1 = Nothing
Loop
ts.Close
MsgBox "SMS sending complete, please see nexmoresult.txt for log"
WScript.Quit()
End Sub

Function HTTPGetSend(ByVal URLGet)
Dim oHTTP
Set oHTTP = CreateObject("MSXML2.XMLHTTP")
oHTTP.Open "GET",URLGet,False
oHTTP.Send
HTTPGetSend = oHTTP.responseText
Set oHTTP = Nothing
End Function



Hello guys,i have this nexmo sms sender, how i can write this code for a delay between sms's ! Nexmo api support 1 sms per second but this script run to fast :)) . Exemple : put the numbers and start the script ,send first sms pause one second ,send 2nd sms pause another second..
 
Do you mean like have it dormant for a certain amount of time?

Sincerely,
Bob Space
 
Assuming your default scriptining engine is wscript, which appears to be the case, rather than cscript, Something like


Code:
[COLOR=blue]WScript.Sleep 1000[/color]

or, for both cscript or wscript, a (bad practice) tight loop

Code:
[COLOR=blue]start=Now
Do Until Now > DateAdd("s",1, start)
Loop[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top