3 Replies Latest reply on May 26, 2015 11:52 PM by erolst

    I need a script help

    chs0615

      I need help to make a script that separates all of the emails individually into email address field.


      <ho@sa.com>; James<james@gmail.com>; <Maria@hotmail.com>; Mary<mariy01@yahoo.com>;..... so on...

       

       

      ho@sa.com

      james@gmail.com

      Maria@hotmail.com

      ...

      ...

       

       

      Thank,

       

      Chris

        • 1. Re: I need a script help
          erolst

          Try something along the (pun intended) lines of

           

          Set Variable [ $addressList ; Let ( m = Substitute ( YourTable::theMailList ; ">; " ; ¶ ) ; Middle ( m ; 2 ; Length ( m ) - 2 ) ) ]

          Set Variable [ $addressCount ; ValueCount ( $addressList) ]

          Loop

            Exit Loop if [ Let ( $addressCounter = $addressCounter + 1 ; $addressCounter > $addressCount )

            Set Variable [ $currentLine ; GetValue ( $addressList ; $addressCounter ) ]

            Set Variable [ $currentMailAddress ;

              Let ( [

                p = Position ( $currentLine ; "<" ; 1 ; 1 ) ;

                isValid = p < Position ( $currentLine ; "@" ; 1 ; 1 ) ;

                start = Case ( p and isValid ; p + 1 ; 1 )

                ] ;

                Middle ( $currentLine ; start ; Length ( $currentLine ) - start )

              )

            ]

            New Record/Request

            Set Field [ YourTable::eMail : $currentMailAddress ]

          End Loop

          • 2. Re: I need a script help
            chs0615

            Thank your help.

             

            This script works fine.  Except, the last alpabet is missing like below.

             

            jame@hotmail.co  instead of james@hotmail.com

            ho@gmail.co  instead of  ho@gmail.com

            mary@co.k  instead of mary@co.kr

             

            Since I am not skillful filemaker user,  where do I have to modify the this script?

             

            Thank one again...

             

            Chris

            • 3. Re: I need a script help
              erolst

              Oops – a one-off error. Change


              Middle ( $currentLine ; start ; Length ( $currentLine ) - start + 1 )


              to grab that last character, too.