I'm trying to merging two list but always have an error

set myNewList to ""

set myClipboard to the clipboard
set theList to words of myClipboard
##set theLength to (get length of mylist)

set ColortheList to {"42f489", "5cdf64", "FFFF00", "41f4d0", "4191f4", "4286f4", "4286f4", "f44192", "f44192", "f44192", "42f989", "5cdf54", "FFFF40", "41f4d5", "4191f2", "4386f5", "4246f4", "f55192", "f46192", "f24192"}

repeat with a from 1 to length of theList
    copy ({item a of theList, item a of ColortheList}) to the end of the |myNewList|

end repeat

Return :

error "Can’t set end of \"\" to {\"whateverfirstitemis\", \"42f489\"}." number -10006 from last insertion point of ""

How can I create a new list with the items of my clipboards merge with the colorlist ?


You need to change set myNewList to "" to:

set myNewList to {}

Otherwise myNewList isn't an empty list, it's an empty string.

  • @Kevin, That said though, you might want to consider adding some code to see that what is on the clipboard is not an image and is the expected text. – user3439894 May 11 at 12:38
  • Oh yes of course ... not sure why I wrote this at the first place , thank you ! – Kevin May 11 at 13:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .