Results 1 to 3 of 3

Thread: VB timeout and resume work?

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2020
    Posts
    2

    VB timeout and resume work?

    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 = "https://rest.nexmo.com/sms/json?api_key="&api_key&"&api_secret="&api_secret&"&from=12012857494&to="
    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..

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: VB timeout and resume work?

    Use a sleep call in your loop.

    -tg

    addendum - also when posting code, put it in [code][/code] or [highlight=X][/highlight] tags (where X is the name of the language) to preserve the formatting and to make it easier to read.
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2020
    Posts
    2

    Re: VB timeout and resume work?

    I don't know how

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width