Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Multiple variable with multiple text files  (Read 5054 times)

0 Members and 1 Guest are viewing this topic.

Zev

  • Guest
Multiple variable with multiple text files
« on: December 15, 2011, 02:04:00 PM »
I am trying to do something I think is simple however I am having difficulty. I am trying to create a simple smpp application to send messages that will read the Numbers as well as text from a file as a variable. I can do one or the other but have been unable to do both at the same time.
This will send to the list of phone numbers in the list1.txt file

@echo off
FOR /F "tokens=*" %%I in (C:\Users\Clay\Desktop\batch\list1.txt) do call :smppclient %%I goto :eof

:smppclient

echo %TIME% >> bulk.txt
smppclient -u username -p password -a ipaddress/port -s 1 -T "batch file test" -O Alerts -D %1  >> bulk.txt
:: DONE



The above will read the numbers from the  text file called list1.txt and send the text batch file test to each number.

What I want to do is one step futher and make the text "batch file test" a variable and put it in a seperate text file.
Any help is appreciated and or samples / examples.


Clay
[email protected]

Salmon Trout

  • Guest
Re: Multiple variable with multiple text files
« Reply #1 on: December 15, 2011, 02:36:40 PM »
FOR /F "tokens=*" %%I in (C:\Users\Clay\Desktop\batch\list1.txt) do call :smppclient %%I goto :eof

Why is that there?

also, pls show at least part of list1.txt


Raven19528



    Hopeful
  • Thanked: 30
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    Re: Multiple variable with multiple text files
    « Reply #2 on: December 15, 2011, 04:16:28 PM »
    What I want to do is one step futher and make the text "batch file test" a variable and put it in a seperate text file.

    I think the question you are thinking is not the question you are asking. The answer to this is:

    Code: [Select]
    set bft="batch file test"
    echo %bft% > seperate.txt

    You seem like you probably already knew how to do this, so my question is, what exactly is your question?

    In regards to your initial statement, a FOR command like you have set up will capture text and numbers just the same. How do you know you are not able to capture both at the same time? Also, be aware that if there is text on one line, and a number on the next, then it isn't that the FOR command won't read them because they are different formats, but that it won't read them together because they are on different lines.

    In any case, please expand and provide us with some better information so that we can give you the most correct answer.
    "All things that are
    Are with more spirit chased than enjoy'd" -Shakespeare

    Squashman



      Specialist
    • Thanked: 134
    • Experience: Experienced
    • OS: Other
    Re: Multiple variable with multiple text files
    « Reply #3 on: December 15, 2011, 04:31:24 PM »
    Are you saying that whatever  text message you want to send out to each number you just want to hard code it into a TXT file and read in that TXT file to send to each number?
    This way you never have to edit the batch file.  You would only have to edit your list of phone numbers and the text message you want to send out.

    Zev

    • Guest
    Re: Multiple variable with multiple text files
    « Reply #4 on: December 16, 2011, 08:52:32 AM »
    I have two text files.
    First text file is list1.txt and contains the following
    539990000
    539990001
    539990002
    539990003
    539990004
    539990005
    539990006
    539990007
    539990008
    539990009
    539990010
    539990011
    539990012
    539990013
    539990014
    539990015
    539990016
    539990017
    539990018
    539990019
    539990020
    539990021
    539990022
    539990023
    539990024
    539990025
    539990026
    539990027
    539990028
    539990029
    539990030


    the second text file will contain up to 160 characters in this case for testing it will say
    test of smppclient



    contents of text.txt
    test message


    I have an application called smppproxy which I can manually inject messages I am trying to create a batch file to send to a list of numbers ( from a file) as well as use the text as a variable.
    So if I want to send the text test message  to a given list of numbers ( list1.txt) with the text of (test mesage) I can
    or I can change the text by having a different text in the text file.   


    Below is the information on the smppproxy if that helps.  I apologize if I am not making myself clear. I have just been unable to read the text.txt file in as a variable
    I have been able to send a message to an entire list of numbers with no trouble with the batch file below.  All I am trying to do is add one extra variable for the text
    "batch file test" and the text is read from a file
    The text also has to be in " "



    @echo off
    FOR /F "tokens=*" %%I in (C:\Users\Clay\Desktop\batch\list1.txt) do call :smppclient %%I goto :eof

    :smppclient

    smppclient -u SMPPSMS -p TANSTAAF -a 208.52.110.18/16400 -s 1 -T "batch file test" -O Alerts -D %1  >> bulk.txt
    :: DONE







    C:\Services\executables>smppclient
    Usage:

    Option  Content     Description
    ------  -------     -----------
    -h    BOOLEAN(0,1)    1 to print this usage message
    -t    BOOLEAN(0,1)    1 to enable SMPP Tracing
    -pp   BOOLEAN(0,1)    1 to enable Optional Parameter Printing
    -lp   BOOLEAN(0,1)    1 to load Optional Params
    -lap  BOOLEAN(0,1)    1 to load All Params
    -pl   VALUE           1 to 8000, Payload length
    -lm   BOOLEAN(0,1)    1 Send More Message Optional Parameter Value 1
    -plt  VALUE           0-Default(WAP WDP),1-WCMP
    -pf   STRING          Load the payload from this file name.
    -V    VALUE           0x34 (Version 3.4)
    -X    BOOLEAN(0,1)    ClientTransmitter = 1 (default)
                          ClientReceiver    = 0
                          ClientTransceiver = 2
    -Q    BOOLEAN(0,1)    1 to Suppress output to screen
    -k    BOOLEAN(0,1)    When unbinding, keep the TCP/IP session alive
    -u    STRING(1..12)   Username, Ex: SYSID
    -p    STRING(1..12)   Password, Ex: PASSWORD
    -a    HOSTNAME/PORT   Ex: hostname/9703
    -s    NUMBER(1..8000) number of Submits
    -r    NUMBER(1..8000) number of Replaces
    -c    NUMBER(1..8000) number of Cancels
    -data NUMBER(1..8000) number of Data_sm
    -sm   NUMBER(1..8000) number of Submit multis
    -i    NUMBER(1..8000) number of Infos
    -q    NUMBER(1..8000) number of Querys
    -l    NUMBER(1..8000) number of EnquireLinks
    -W    NUMBER(1..nnnn) Wait/Delay (milliseconds) between transactions
    -rc   NUMBER(1..n)    Number of retries on connect fault
    -rd   BOOLEAN(0,1)    Registered Delivery (mask)
                          0x00=None,   0x01:DlvNonDlv 0x02:NonDlv
                          0x04=DlvAck, 0x08:ManAck    0x10:IntAck
                          0x20=AlrAck
    -ec   NUMBER          Esm Class, (mask)
                          0x00=Default 0x01=Datagram
                          0x02=Transactional 0x03=StoreForward
    -rp   BOOLEAN(0,1)    ReplaceIfPresent    0 = No, 1 = Yes
    -rb   BOOLEAN(0,1)    0 = No Rebind, 1 = Perform Rebind
    -rcon BOOLEAN(0,1)    0 = No Reconnect, 1 = Perform reconnect and rebind
    -dm   NUMBER(1..n)    Default message catalogue number
    -vt   BOOLEAN(0..1)   Generate varied text strings
    -T    DATA(1..128)    Message text
    -d                    DCS/DataCodingScheme
    -P    NUMBER(0..255)  PID/ProtocolId
    -R    STRING          Address range for bind_receiver
    -D    NUMBER          Dest Addr , Default 1230000...
    -O    NUMBER          Orig Addr
    -S    NUMBER          Service Type
    -DT   STRING          DestTypeOfNumber
    -OT   STRING          OrigTypeOfNumber
    -DN   STRING          DestNumberPlan
    -ON   STRING          OrigNumberPlan
    -ba   STRING          Base Dest Address, will be incremented
    -bo   STRING          Base Orig Address, will be incremented
    -mp   NUMBER          Message Priority, 0 = Normal, 1 = Urgent
    -mr   NUMBER          Message Reference - for Query/Cancel
    -dt   UTC_TIME        Deferred Delivery Time  UTC_TIME: YYMMDDhhmmssnnp
    -et   UTC_TIME        Message Expiry Time     UTC_TIME: YYMMDDhhmmssnnp
    -st   STRING          System Type
    -rt   NUMBER          Set the socket read timeout to NUMBER seconds. The default is no timeout.
    -stats                Print statistics
    -smcount NUMBER(1..8000) number of destinations per submit multi
    -ws      NUMBER       The Bind Transmitter window size. The default is 1
    -sp      NUMBER       WAP Source port
    -dp      NUMBER       WAP Destination port
    -ssu     NUMBER       WAP source subunit
    -dsu     NUMBER       WAP destination subunit
    -umr     NUMBER       User message reference

    -mwi     NUMBER       Set the message waiting flags. The posible values are:
                          SMPP_MWI_OFF=0x00 - Turn MWI indication off
                          SMPP_MWI_ON =0x80 - Turn MWI indication on
                          The MWI ON/OFF values should be ored with these values:
                          SMPP_MWI_VOICE=0x00 - Voice mail message waiting
                          SMPP_MWI_FAX=0x01   - Fax message waiting
                          SMPP_MWI_EMAIL=0x02 - Email message waiting
                          SMPP_MWI_OTHER=0x03 - Other messaeg waiting
                          Count - No. of messages waiting [0-254] or 255(unknown)
                          Format: MWI or MWI,Count,...,MWI,Count
    -rxcnt   NUMBER       messages count a client receiver will receive before sending an Unbind
    Examples:
    Submit:  smppclient -u 987654 -p PSWD -a hostname/5016 -s 10 -T HelloWorld -D 1234567
    Replace: smppclient -u 987654 -p PSWD -a hostname/5016 -r 10 -T HelloWorld -D 1234567
    Query:   smppclient -u 987654 -p PSWD -a hostname/5016 -q 10 -mr 1234...
    Delete:  smppclient -u 987654 -p PSWD -a hostname/5016 -c 10 -mr 1234...
    MWI:     smppclient -u 987654 -p PSWD -a hostname/5016 -s 1 -lp 1 -mwi 0x80,0x3,0x82,0x8




    [regaining space - attachment deleted by admin]

    Squashman



      Specialist
    • Thanked: 134
    • Experience: Experienced
    • OS: Other
    Re: Multiple variable with multiple text files
    « Reply #5 on: December 16, 2011, 09:18:31 AM »
    set /p message=<text.txt

    Zev

    • Guest
    Re: Multiple variable with multiple text files
    « Reply #6 on: December 16, 2011, 09:32:20 AM »
    Thank you all for the comments. However it is aparent I am neither qualified or can not explain the issue well enough.
    I will remove myself from this very usefull  forum so you can deal with people on a higher level than I.

    Squashman



      Specialist
    • Thanked: 134
    • Experience: Experienced
    • OS: Other
    Re: Multiple variable with multiple text files
    « Reply #7 on: December 16, 2011, 09:35:32 AM »
    I just gave you the answer.  You said you wanted to know how to put the contents of a TEXT file into a variable.  I just showed you that.

    Code: [Select]
    H:\>set /p message=<text.txt

    H:\>echo %message%
     Some text message I want to send

    H:\>

    Squashman



      Specialist
    • Thanked: 134
    • Experience: Experienced
    • OS: Other
    Re: Multiple variable with multiple text files
    « Reply #8 on: December 16, 2011, 09:39:05 AM »
    Will make it even easier for you.

    Code: [Select]
    @echo off
    set /p message=<text.txt
    FOR /F "tokens=*" %%I in (C:\Users\Clay\Desktop\batch\list1.txt) do (
    echo %TIME% >> bulk.txt
    smppclient -u username -p password -a ipaddress/port -s 1 -T "%message%" -O Alerts -D %%I  >> bulk.txt
    )

    patio

    • Moderator


    • Genius
    • Maud' Dib
    • Thanked: 1769
      • Yes
    • Experience: Beginner
    • OS: Windows 7
    Re: Multiple variable with multiple text files
    « Reply #9 on: December 16, 2011, 09:39:36 AM »
    Hi Bill...
    " Anyone who goes to a psychiatrist should have his head examined. "

    Squashman



      Specialist
    • Thanked: 134
    • Experience: Experienced
    • OS: Other
    Re: Multiple variable with multiple text files
    « Reply #10 on: December 16, 2011, 09:42:37 AM »
    Did he just delete his account.  Man that ticks me off.  Try and help someone and they just give up.  So all the time that you put in to helping them is just wasted.

    Raven19528



      Hopeful
    • Thanked: 30
      • Computer: Specs
      • Experience: Experienced
      • OS: Windows 7
      Re: Multiple variable with multiple text files
      « Reply #11 on: December 16, 2011, 11:08:01 AM »
      Did he just delete his account.  Man that ticks me off.  Try and help someone and they just give up.  So all the time that you put in to helping them is just wasted.

      Can't change people Squashman, best to leave it be. You did answer the question, and if anyone else ever comes with the same or similar problem, you can refer them to this post instead of rehashing it again.

      Best thing to do is just go pick up your favorite violent game and kill something. That always helps me feel better and is a great way to relieve frustrations.  ;D
      "All things that are
      Are with more spirit chased than enjoy'd" -Shakespeare

      Squashman



        Specialist
      • Thanked: 134
      • Experience: Experienced
      • OS: Other
      Re: Multiple variable with multiple text files
      « Reply #12 on: December 16, 2011, 11:13:57 AM »
      Best thing to do is just go pick up your favorite violent game and kill something. That always helps me feel better and is a great way to relieve frustrations.  ;D
      I guess a quick game of Arkanoid will calm me down.   ;D