Advertisement


Illustrator scripts disappearing from Actions


Question

I've created Actions that include scripts (by using Insert Menu Item). I managed to get the scripts to show up in the menu by adding them to the folder ~\Presets\en_US\Scripts in my Illustrator directory.

The issue is that every Illustrator is restarted, the line in the Action that executes the script is gone. I suppose it is because there's a moment while Illustrator is launching before it checks that folder for scripts that it looks like that line is pointing to an item that isn't there.

I know this is an obscure question, but has anyone encountered this? And does anyone know a workaround?

(Or even a better way to assign a hotkey to a script would probably be fine)

2016/08/18
1
3
8/18/2016 7:10:00 PM

Accepted Answer

Yes its a well known limitation. There is no good workaround. Adobe has refused to fix this bug for some reason. For a very long time too, read more than 5 years. Ive been told that even very high profile clients have requested this in direct talks with adobe. Believe or not.

You can delete and reload the actions and they will work. You can even write a plugin that does this automatically, but the only way i know how to do this breaks adobes license so i dont do it. You can not map hotkeys for scripts for some reason.

Alternatively you can just use auto hotkey to circumvent the problem.

2016/08/18
4
8/18/2016 8:18:00 PM

[Now FIXED: Illustrator CC2017 October update!]

The problem has been going on forever, it's due to the need to physically-visually show the File menu so that the scripts that are installed in the scripts folder of Adobe Illustrator are visible. Only then can you re-load the actions which contain the scripts by loading the action sets, to get the working script menu items back. A light-weight semi-automatic scripting way can be used in versions CS6+ to save some clicks: it depends on your action sets being saved in a pre-determined folder. It also needs to be installed as a script in your File > Scripts menu. Once it is there, it works by having you manually activate this script through the file menu which by definition shows the file menu. Since the menu is shown at the point of the script activation, the actions which are automatically reloaded by the script will be working.

 #target illustrator
function ReloadActions(){
    function removeActionSet(setName){
        var errorFlag = false;
        while(!errorFlag){
            try {
                app.unloadAction(setName, "");
            } catch (e) {
                errorFlag = true;
            }
        }
    };
    function loadActionSet(aiaFile){
        app.loadAction(aiaFile);
    };
    function reloadActionSet(aiaFile, setName){
        removeActionSet(setName);
        loadActionSet(aiaFile);
    };
    if((app.version.substr(0, 2) * 1) < 16){
        alert("Sorry, the Action Reloader script only works in versions CS6 and above.");
        return;
    }
    var actionFolder = Folder(Folder.myDocuments + "/" + "Illustrator Actions");
    if(!actionFolder.exists){
        alert("The folder for script-reloadable Actions is not found at '" + decodeURI(actionFolder) + "'");
        return;
    }
    var fileMask = ($.os.match("Windows"))? "*.aia" : function(f){return f.name.match(/\.aia$/);}
    var actionFiles = actionFolder.getFiles(fileMask);
    var thisFile, thisSetName;
    for (var i = 0; i < actionFiles.length; i++) {
        thisFile = actionFiles[i];
        thisSetName = decodeURI(thisFile.name).replace(".aia", "");
        reloadActionSet(thisFile, thisSetName);
    }
};
ReloadActions();
2017/10/18