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

Author Topic: grammar  (Read 21031 times)

0 Members and 1 Guest are viewing this topic.

Lemonilla



    Apprentice

  • "Too sweet"
  • Thanked: 70
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
Re: grammar
« Reply #30 on: July 21, 2013, 01:17:59 PM »
I don't have a computer with me, but try ^!
Quote from: patio
God Bless the DOS Helpers...
Quote
If it compiles, send the files.

tendude

    Topic Starter


    Rookie

  • ijust a new guy who still learning from stuff ido
  • Thanked: 1
    • Experience: Beginner
    • OS: Windows XP
    Re: grammar
    « Reply #31 on: July 22, 2013, 09:08:40 AM »
    thanks alot...using ^! its work thank you

    now
    -------------------------------------------------------------------

    set bI=1
    set bwash=2
    set bthe=3
    set bcar=4
    set byesterday=5

    if "%word%"=="I" do (
       set /a bI=%bI%+1
       set "bI=!tset! !tbword!=!bI!"
       echo !bI!>>"bword.txt"
            )
    goto :eof

    if "%word%"=="wash" do (
       set /a bwash=%bwash%+1
       set "bwash=!tset! !tbword!=!bwash!"
       echo !bwash!>>"bword.txt"
            )
    goto :eof

    if "%word%"=="the" do (
       set /a bthe=%bthe%+1
       set "bthe=!tset! !tbword!=!bthe!"
       echo !bthe!>>"bword.txt"
            )
    goto :eof

    if "%word%"=="car" do (
       set /a bcar=%bcar%+1
       set "bcar=!tset! !tbword!=!bcar!"
       echo !bcar!>>"bword.txt"
            )
    goto :eof

    if "%word%"=="yesterday" do (
       set /a byesterday=%byesterday%+1
       set "byesterday=!tset! !tbword!=!byesterday!"
       echo !byesterday!>>"bword.txt"
            )
    goto :eof

    -------------------------------------------------------------------
    each set plus 1

    but output becomes

    set bI=2
    set bwash=2
    set bthe=2
    set bcar=2
    set byesterday=2

    not

    set bI=2
    set bwash=3
    set bthe=4
    set bcar=5
    set byesterday=6
    i just a new guy who still learning from stuff i try to do, the best learning way is do it...

    tendude

      Topic Starter


      Rookie

    • ijust a new guy who still learning from stuff ido
    • Thanked: 1
      • Experience: Beginner
      • OS: Windows XP
      Re: grammar
      « Reply #32 on: July 23, 2013, 08:46:08 AM »
      any one?
      i just a new guy who still learning from stuff i try to do, the best learning way is do it...

      Geek-9pm


        Mastermind
      • Geek After Dark
      • Thanked: 1026
        • Gekk9pm bnlog
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      Re: grammar
      « Reply #33 on: July 24, 2013, 09:31:03 AM »
      Quote
      goto :eof
      d
      That is not in the right place. What you want it to mean?
      Are your thinking about a CASE statement?
      Batch does not have a  CASE statement, not does it lend itself to a graceful way of making something like a CASE or SELECT structure.

      tendude

        Topic Starter


        Rookie

      • ijust a new guy who still learning from stuff ido
      • Thanked: 1
        • Experience: Beginner
        • OS: Windows XP
        Re: grammar
        « Reply #34 on: July 24, 2013, 03:54:24 PM »


        i put goto :eof because i dont want it run all not necessary script.

        -----------------------------------------------------------------------------------

        i put value to each set

        set bI=1
        set bwash=2
        set bthe=3
        set bcar=4
        set byesterday=5

        went i run this script below

        if "%word%"=="I" do (
           set /a bI=%bI%+1
           set "bI=!tset! !tbword!=!bI!"
           echo !bI!>>"bword.txt"
                )
        goto :eof

        if "%word%"=="wash" do (
           set /a bwash=%bwash%+1
           set "bwash=!tset! !tbword!=!bwash!"
           echo !bwash!>>"bword.txt"
                )
        goto :eof

        if "%word%"=="the" do (
           set /a bthe=%bthe%+1
           set "bthe=!tset! !tbword!=!bthe!"
           echo !bthe!>>"bword.txt"
                )
        goto :eof

        if "%word%"=="car" do (
           set /a bcar=%bcar%+1
           set "bcar=!tset! !tbword!=!bcar!"
           echo !bcar!>>"bword.txt"
                )
        goto :eof

        if "%word%"=="yesterday" do (
           set /a byesterday=%byesterday%+1
           set "byesterday=!tset! !tbword!=!byesterday!"
           echo !byesterday!>>"bword.txt"
                )
        goto :eof

        ------------------------------------------------------------------
        this script should make each set +1

        from this                                                                  to
                                             plus 1 each of set
        set bI=1                       1+1=2                           set bI=2
        set bwash=2                2+1=3                           set bwash=3
        set bthe=3                   3+1=4                           set bthe=4
        set bcar=4                   4+1=5                           set bcar=5
        set byesterday=5        5+1=6                           set byesterday=6


        but output on bword.txt becomes like this

        set bI=2
        set bwash=2
        set bthe=2
        set bcar=2
        set byesterday=2

        you know how to solve this?
        i just a new guy who still learning from stuff i try to do, the best learning way is do it...

        Geek-9pm


          Mastermind
        • Geek After Dark
        • Thanked: 1026
          • Gekk9pm bnlog
        • Certifications: List
        • Computer: Specs
        • Experience: Expert
        • OS: Windows 10
        Re: grammar
        « Reply #35 on: July 24, 2013, 04:56:18 PM »
        Just remove all of goto :eof and it might work.

        tendude

          Topic Starter


          Rookie

        • ijust a new guy who still learning from stuff ido
        • Thanked: 1
          • Experience: Beginner
          • OS: Windows XP
          Re: grammar
          « Reply #36 on: July 25, 2013, 03:46:33 AM »
          it not work

          it just going run all script...

          output on bword.txt becomes

          set bI=2
          set bI=3
          set bI=4
          set bI=5
          set bI=6
          set bwash=2
          set bwash=3
          set bwash=4
          set bwash=5
          set bwash=6
          set bthe=2
          set bthe=3
          set bthe=4
          set bthe=5
          set bthe=6
          set bcar=2
          set bcar=3
          set bcar=4
          set bcar=5
          set bcar=6

          it run all not necessary script.

          if "%word%"=="I" do (
             set /a bI=%bI%+1
             set "bI=!tset! !tbword!=!bI!"             if i remove goto :eof its will be run all not necessary script below
             echo !bI!>>"bword.txt"
                  )
          goto :eof

          if "%word%"=="wash" do (
             set /a bwash=%bwash%+1
             set "bwash=!tset! !tbword!=!bwash!"
             echo !bwash!>>"bword.txt"
                  )
          goto :eof

          if "%word%"=="the" do (
             set /a bthe=%bthe%+1
             set "bthe=!tset! !tbword!=!bthe!"
             echo !bthe!>>"bword.txt"
                  )
          goto :eof

          if "%word%"=="car" do (
             set /a bcar=%bcar%+1
             set "bcar=!tset! !tbword!=!bcar!"
             echo !bcar!>>"bword.txt"
                  )
          goto :eof

          if "%word%"=="yesterday" do (
             set /a byesterday=%byesterday%+1
             set "byesterday=!tset! !tbword!=!byesterday!"
             echo !byesterday!>>"bword.txt"
                  )
          goto :eof
          i just a new guy who still learning from stuff i try to do, the best learning way is do it...

          Geek-9pm


            Mastermind
          • Geek After Dark
          • Thanked: 1026
            • Gekk9pm bnlog
          • Certifications: List
          • Computer: Specs
          • Experience: Expert
          • OS: Windows 10
          Re: grammar
          « Reply #37 on: July 25, 2013, 09:50:52 AM »
          This is as far as I can help you.
          This term
          "%word%"
          is a persistent entity in the code you gave. It does not wear mutilate or   change value by itself.
          When the test of
          ==
          meaning really equal to,
          is used, the result is exclusive for a persistent entity tested on unique values., but not null null values. You were supposed to learn that back in Programming 101 some time ago.
          Sorry, if you don't grasp this, I can not help you.

          The script you gave has blocks that are mutually exclusive,   so a break is not needed. Take out all the gooto.

          tendude

            Topic Starter


            Rookie

          • ijust a new guy who still learning from stuff ido
          • Thanked: 1
            • Experience: Beginner
            • OS: Windows XP
            Re: grammar
            « Reply #38 on: July 25, 2013, 11:12:15 AM »
            @echo off
            setlocal enabledelayedexpansion

            echo 1 scan document
            echo 2 create document
            echo 3 reset document
            set/p "pilih=^>"
            if %pilih%==1 goto :scan
            if %pilih%==2 goto :create
            if %pilih%==3 goto :reset

            :reset

            set bI=0
            set bwash=0
            set bthe=0
            set bcar=0
            set byesterday=0



            goto enter

            :create

            set bI=1
            set bwash=2
            set bthe=3
            set bcar=4
            set byesterday=5


            if "%word%"=="I" do (
               set /a bI=%bI%+1
               set "bI=!tset! !tbword!=!bI!"
               echo !bI!>>"bword.txt"
                    )


            if "%word%"=="wash" do (
               set /a bwash=%bwash%+1
               set "bwash=!tset! !tbword!=!bwash!"
               echo !bwash!>>"bword.txt"
                    )


            if "%word%"=="the" do (
               set /a bthe=%bthe%+1
               set "bthe=!tset! !tbword!=!bthe!"
               echo !bthe!>>"bword.txt"
                    )


            if "%word%"=="car" do (
               set /a bcar=%bcar%+1
               set "bcar=!tset! !tbword!=!bcar!"
               echo !bcar!>>"bword.txt"
                    )


            if "%word%"=="yesterday" do (
               set /a byesterday=%byesterday%+1
               set "byesterday=!tset! !tbword!=!byesterday!"
               echo !byesterday!>>"bword.txt"
                    )
            goto :eof

            :enter
            echo enter text and enter
            set /p input=:

            :savebword


            :scan
            set /p input=file name with (.txt)  :
            type "%input%"
            echo.
            echo.

            :loop
            for /f "delims=" %%A in ('type "%input%"') do (
                for %%B in (%%A) do (
                    echo %%B
                    call :set "%%B"
                    call :save "%%B"
                    call :create "%%B"
                    echo.
                )
            )

            goto :end

            :set

            echo set " %~1 " as
            echo 1 (pronoun)
            echo 2 (noun)
            echo 3 (verb)   
            echo 4 (adverb)   
            echo 5 (adjective)   
            echo 6 (preposition)   
            echo 7 (subject)   
            echo 8 (object)

            set/p "cho=^>"
            if %cho%==1 goto SOMEWERE
            if %cho%==2 goto SOMEWERE
            if %cho%==3 goto SOMEWERE
            if %cho%==4 goto SOMEWERE
            if %cho%==5 goto SOMEWERE
            if %cho%==6 goto SOMEWERE
            if %cho%==7 goto SOMEWERE
            if %cho%==8 goto SOMEWERE
            echo Invalid choice.
            goto :eof

            :save
            set "word=%~1"
            set "if=if"

            set "tword=word"
            set "code=word"

            set "tset=set"
            set "tbword=b!word!"

            set "techo=echo"
            set "simbol=^!"


            set "output=!if! "%%!tword!%%"=="!word!" goto !tbword!"
            set "outputt=:!tbword!"
            echo !output!>>"word.txt"
            echo !outputt!>>"word.txt"


            set "output2=!tset! !tbword!=0"
            echo !output2!>>"setword.txt"


            set "output3=!tset! /a !tbword!=%%!tbword!%%+1"
            echo !output3!>>"word.txt"

            echo (set /a bword=%bword%+1)

            set (bof=%bof%)





            set "output4=!tset! !tbword!=%%!tbword!%%"

            set "output6=!tset! "!tbword!=!simbol!tset!simbol! !simbol!tbword!simbol!=!simbol!!tbword!!simbol!""
            set "output7=!techo! !simbol!!tbword!!simbol!>>"bword.txt""
            set "output8=goto :eof"
            echo !output6!>>"word.txt"
            echo !output7!>>"word.txt"
            echo !output8!>>"word.txt"

            echo word " %~1 " now save         
            if "%~1"=="" goto nothaveit

            goto :eof


            :end
            echo END OF CODE
            pause>nul


            this full script i make so far...

            the problem is here

            if "%word%"=="I" do (
               set /a bI=%bI%+1
               set "bI=!tset! !tbword!=!bI!"
               echo !bI!>>"bword.txt"
                    )
            goto :eof

            if "%word%"=="wash" do (
               set /a bwash=%bwash%+1
               set "bwash=!tset! !tbword!=!bwash!"
               echo !bwash!>>"bword.txt"
                    )
            goto :eof

            if "%word%"=="the" do (
               set /a bthe=%bthe%+1
               set "bthe=!tset! !tbword!=!bthe!"
               echo !bthe!>>"bword.txt"
                    )
            goto :eof

            if "%word%"=="car" do (
               set /a bcar=%bcar%+1
               set "bcar=!tset! !tbword!=!bcar!"
               echo !bcar!>>"bword.txt"
                    )
            goto :eof

            if "%word%"=="yesterday" do (
               set /a byesterday=%byesterday%+1
               set "byesterday=!tset! !tbword!=!byesterday!"
               echo !byesterday!>>"bword.txt"
                    )
            goto :eof

            it should create output like this

            set bI=2
            set bwash=3
            set bthe=4
            set bcar=5
            set byesterday=6

            but

            set bI=2
            set bwash=2
            set bthe=2
            set bcar=2
            set byesterday=2

            !bI!, !bwash!, !bthe! ,!bcar! and !byesterday! all =2...
            why?

            this is the problem that i need help to solve
            i just a new guy who still learning from stuff i try to do, the best learning way is do it...

            Lemonilla



              Apprentice

            • "Too sweet"
            • Thanked: 70
            • Computer: Specs
            • Experience: Experienced
            • OS: Windows 7
            Re: grammar
            « Reply #39 on: July 25, 2013, 09:28:39 PM »
            Try changing your set /a to

            Code: [Select]
            Set /a %var%+=1
            Quote from: patio
            God Bless the DOS Helpers...
            Quote
            If it compiles, send the files.

            Salmon Trout

            • Guest
            Re: grammar
            « Reply #40 on: July 27, 2013, 01:48:37 AM »
            Quote
            if "%word%"=="wash" do (
               set /a bwash=%bwash%+1
               set "bwash=!tset! !tbword!=!bwash!"
               echo !bwash!>>"bword.txt"
                    )


            1. There is no IF .... DO in batch language. (Are you making the syntax up as you go?) I am amazed you have not seen lots of error messages (or are you running batch scripts by double clicking them?)

            2. To alter, or set and then read a variable inside parentheses you need delayed expansion. (Read about it).

            I suggest you read the documentation for each command or keyword, either from the prompt by typing the command followed by /?  (example: if /?) or you can use a site like ss64.com

            http://ss64.com/nt/

            Start with simple scripts and learn how each command or keyword works. You are just making up code by guesswork, and that will just lead to very long threads like this one.