KevinCork KevinCork - 1 year ago 121
AppleScript Question

Applescript saving each item from a list as text

I have a list of numbers (the number of numbers is random)

for example here is my current result :

{"1024343495", "84734348416", "100434439171", "86343425", "13434290", "83434946", "81711343497", "43534347319", "863434490"}

I would like to print them in a text file, or save in the clipboard, but this is not working

set the clipboard to myList

so I tried to convert the all as a string :

set the clipboard to myList as string

but then I have just a huge number :

Answer Source


set myString to ""
set i to 0
repeat (number of items in myList) times
    set i to i + 1
    set myString to myString & ((item i of myList)as string) &  ", "-- this last bit here is what goes in between each list item
end repeat
return myString

result "1024343495, 84734348416, 100434439171"-etc

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download