Drag-and-drop bug running scripts containing app.doScript()
Watch the "drag-and-drop-bug.mp4" video, which demonstrates a specific but with the Adobe Illustrator's JS engine handling scripts which are dragged to different areas of the screen in different ways.
In most cases, a drag-and-dropped script will work as intended. But for 10 years in CS6-CC 2023 versions there is a limited bug handling the script if dragged to the “wrong” area of the program window.
If the script contains an action and a user drags it onto the document window, it may not work correctly. If the script selects objects one by one and applies an action to them, it won't work on the first selected object, but it will work on all the others.
If you drag the script to the document tab area, the action will be called correctly for each selected object.
So far, the problem is found in scripts that use actions with the commands from the Transform menu: Move, Rotate, Reflect, Scale, Shear.
Try it yourself:
1) Rename "ScriptSet.txt" to "ScriptSet.aia" and load it in the Actions panel.
2) Rename the "rotate-180-action.txt" file to "rotate-180-action.js" and try running the script in a document with multiple artboards.
Here's the Medium article about this issue:
https://aiscripts.medium.com/running-scripts-via-drag-and-drop-84021c505ed4