i have a problem on windows with dragging lines in a field. Basically i have a field, which is filled with names and i want to reorder them by clicking on a name and then moving it up or down in the field. I found a wonderful script in the forum which works well on mac but does not on windows.
this is the script:
Code: Select all
local sClicked, sArray, sMovingText, sLastLineNum
on mousedown
put word 2 of the mouseLine into sClicked
put the styledText of me into sArray
put sArray[sClicked] into sMovingText
put empty into sLastLineNum
end mousedown
on mouseMove
put word 2 of the mouseLine into tLineNum
if tLineNum is empty or the mouse is not down then exit mouseMove
## don't do swapping if the lineNumber has not changed
if tLineNum = sLastLineNum then exit mouseMove
put tLineNum into sLastLineNum
## swap here
put sArray[tLineNum] into sArray[sClicked]
put sMovingText into sArray[tLineNum]
lock screen
put the vScroll of me into tScroll
set the styledText of me to sArray
set the scroll of me to tScroll
select line tLineNum of me
unlock screen
put tLineNum into sClicked
end mouseMove
I would be very happy, if someone could push me into the right direction.
Have a nice day!