Hello,
I'm trying to randomize a list of comma-delimited words copied from a cel in excel, and then storing that list in a clipboard or variable to be pasted later in the workflow. I've been trying to kludge something together from what I found elsewhere, but I only know a little about keyboard maestro and NOTHING about applescript.
I've been trying to use this
set myList to {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
set randomizedList to randomizeList(myList)
on randomizeList(theList)
set listCount to count of theList
set newList to {}
repeat listCount times
set subListCount to count of theList
set r to random number from 1 to subListCount
set end of newList to item r of theList
-- remove the random item from theList
if subListCount is 1 then
exit repeat
else if r = 1 then --> first item
set theList to items 2 thru end of theList
else if r = subListCount then --> last item
set theList to items 1 thru -2 of theList
else
set theList to items 1 thru (r - 1) of theList & items (r + 1) thru -1 of theList
end if
end repeat
return newList
end randomizeList
Which I found here: http://stackoverflow.com/questions/15458773/it-there-a-simple-way-to-shuffle-a-list-in-applescript
I've tried this:
tell application "Keyboard Maestro Engine"
set fruit to value of variable "fruit"
end tell
set myList to fruit
set randomizedList to randomizeList(myList)
But that returns
as: a, r, a, ,, g, ,, p, b, e, a, e, n, a, , o, a, p, n, l, n,
I've tried other equally fruitless (get it?) things with varying degrees of failure, and thought I'd take a short break from banging my head against this problem to come and ask here
Thank you