Applescript remove Missing value and unwanted data I created a script to return some credit card informations from an internal website

                            &lt;a href=\"/web/Support.aa/aa/g55erefesfsfsf/4.g.g.5.24.54\"&gt;
                                CC&lt;br&gt;Info
                            &lt;/a&gt;

                    ", "

                            Visa (9999)

                    ", "

                            Visa (8888)

                    ", "

                            Visa (7777)

                    ", "

                            Visa (666)

                    ", "

                            Alipay

                    ", missing value, missing value, missing value}


I have two issue with my script,


I can't get rid of the first link with is not a CC numbers
tried :
set myRawData to items 2 thru -1 of myRawData as string
but don't seems to work.
I don't manage to remove all the missing values.
Can I remove some entry from the list that contain "none" ?


Here is my full script

tell application "Google Chrome"
    tell active tab of window 1 to set myRawData to execute javascript "var outPut=[]; var arr=document.getElementsByClassName('sortable fraudScoringTransactionCCSummary');for (var i in arr) {outPut.push(arr[i].innerHTML)};outPut;"
end tell

## set myRawData to items 2 thru -1 of myRawData as string -- not working
set myNewList to {}

repeat with each from 1 to count of items of myRawData
    set itemOnMyList to item each of myRawData
    if itemOnMyList is in myRawData and itemOnMyList is not in myNewList then set end of myNewList to itemOnMyList
end repeat

## not sur
##set myNewList to items 2 thru -1 of myNewList  -- not working

set countHowManyCC to count myNewList


return countHowManyCC
Using the returned output information posted in your OP while adding the missing opening curly brace and a opening double quote {" so as to have it compile as a list, the following example AppleScript code filters out the first item of the list as well as the items containing missing value in order to return a count of items that represent the data. 

set myRawData to {"&lt;a href=\"/web/Support.aa/aa/g55erefesfsfsf/4.g.g.5.24.54\"&gt;
                                CC&lt;br&gt;Info
                            &lt;/a&gt;

                    ", "

                            Visa (9999)

                    ", "

                            Visa (8888)

                    ", "

                            Visa (7777)

                    ", "

                            Visa (666)

                    ", "

                            Alipay

                    ", missing value, missing value, missing value}


set myRawData to items 2 thru -1 of myRawData

set myNewList to {}
repeat with i from 1 to count myRawData
    if item i of myRawData does not contain missing value then
        copy item i of myRawData to end of myNewList
    end if
end repeat

return count myNewList


The following example AppleScript code adds a second filter to handle items containing "none":

set myRawData to items 2 thru -1 of myRawData

set myNewList to {}
repeat with i from 1 to count myRawData
    set thisItem to item i of myRawData
    if thisItem does not contain "none" then
        if thisItem is not missing value then
            copy item i of myRawData to end of myNewList
        end if
    end if
end repeat

return count myNewList




Note: The example AppleScript code is just that and does not employ any error handling and is meant only to show one of many ways to accomplish a task. The onus is always upon the User to add/use appropriate error handling as needed/wanted.