Skip to main content
dublove
Legend
May 18, 2026
Answered

How to enable the "Auto Resize" function under the preferences and "Regional Text Options"?

  • May 18, 2026
  • 42 replies
  • 3663 views

I want to activate two functions of text:
One is:
Preferences>Text>Automatically adjust the text size in the new area“


The second one is the menu:

"Text>>Regional Text Options>Auto Resize“


I have searched a lot of information but have not been successful, and it seems that I can only open the preferences option.
A single text object cannot be set, which is a bit unscientific.

function setAutoTextFrames() {
//var autoSize = app.preferences.getBooleanPreference("text/autoSizing");
//app.preferences.setBooleanPreference("text/autoSizing", true);

var autoSize = app.preferences.getStringPreference('text/autoSizing');
alert(autoSize);

}
setAutoTextFrames();

https://judicious-night-bca.notion.site/app-getIntegerPreference-e4088e6caef64b3ba5b801d86fba7877

 

 

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Correct answer m1b

    @dublove The best I could do is to use Action code. Unfortunately, it is a bit of a hack, but I cannot think of any other way.

    — Mark

    /**
    * @file Auto Size Selected TextFrame.js
    *
    * Invoke the "Auto Size" area text option on the selected text frame(s).
    *
    * @author m1b
    * @version 2026-05-19
    * @discussion https://community.adobe.com/questions-652/how-to-enable-the-auto-resize-function-under-the-preferences-and-regional-text-options-1623882
    */
    (function () {

    if (
    0 === app.documents.length
    || 0 === app.activeDocument.selection.length
    )
    return alert('Please select one or more text frames and try again.');

    const KEEP_AUTOSIZE_ON = false;
    autoSizeSelectedTextFrames(KEEP_AUTOSIZE_ON);

    })();

    /**
    * Auto-sizes the given `textFrames`.
    * @param {Boolean} [keepOn] - whether to leave Auto Size turned ON (default: true).
    */
    function autoSizeSelectedTextFrames(keepOn) {

    // this is the .aia markup to invoke "Auto Size" in Area Text Options
    const AUTOSIZE_AREATEXT_OPTIONS_AIA_AND_KEEP_ON = '/version 3 /name [ 4 54656d70 ] /isOpen 1 /actionCount 1 /action-1 { /name [ 8 416374696f6e2031 ] /keyIndex 0 /colorIndex 0 /isOpen 0 /eventCount 1 /event-1 { /useRulersIn1stQuadrant 0 /internalName (adobe_SLOAreaTextDialog) /localizedName [ 17 417265612054797065204f7074696f6e73 ] /isOpen 0 /isOn 1 /hasDialog 0 /parameterCount 1 /parameter-1 { /key 1952539754 /showInPalette 4294967295 /type (integer) /value 1 } } }';
    const AUTOSIZE_AREATEXT_OPTIONS_AIA_AND_KEEP_OFF = '/version 3 /name [ 4 54656d70 ] /isOpen 1 /actionCount 1 /action-1 { /name [ 8 416374696f6e2031 ] /keyIndex 0 /colorIndex 0 /isOpen 0 /eventCount 2 /event-1 { /useRulersIn1stQuadrant 0 /internalName (adobe_SLOAreaTextDialog) /localizedName [ 17 417265612054797065204f7074696f6e73 ] /isOpen 0 /isOn 1 /hasDialog 0 /parameterCount 1 /parameter-1 { /key 1952539754 /showInPalette 4294967295 /type (integer) /value 1 } } /event-2 { /useRulersIn1stQuadrant 0 /internalName (adobe_SLOAreaTextDialog) /localizedName [ 17 417265612054797065204f7074696f6e73 ] /isOpen 0 /isOn 1 /hasDialog 0 /parameterCount 1 /parameter-1 { /key 1952539754 /showInPalette 4294967295 /type (integer) /value 2 } } }';

    var aia = keepOn
    ? AUTOSIZE_AREATEXT_OPTIONS_AIA_AND_KEEP_ON
    : AUTOSIZE_AREATEXT_OPTIONS_AIA_AND_KEEP_OFF;

    // invoke the auto-size
    doActionFromString(aia);

    };

    /**
    * Create and execute an action using the markup supplied.
    *
    * Loads the .aia into a "DeleteMeNNNNN" action set,
    * which will be unloaded after running.
    *
    * Example of .aia markup:
    * const AUTOSIZE_AREATEXT = '/version 3 /name [ 4 54656d70 ] /isOpen 1 /actionCount 1 /action-1 { /name [ 8 416374696f6e2031 ] /keyIndex 0 /colorIndex 0 /isOpen 0 /eventCount 1 /event-1 { /useRulersIn1stQuadrant 0 /internalName (adobe_SLOAreaTextDialog) /localizedName [ 17 417265612054797065204f7074696f6e73 ] /isOpen 0 /isOn 1 /hasDialog 0 /parameterCount 1 /parameter-1 { /key 1952539754 /showInPalette 4294967295 /type (integer) /value 1 } } }';
    *
    * @author m1b (and thanks to Charu Rajput for initial idea of loading a temporary aia).
    * @version 2026-05-19
    * @param {String} aia - the action markup.
    */
    function doActionFromString(aia) {

    // replace the set name with a unique throwaway name to avoid collisions
    var setNameHex = encodeHex('DeleteMe' + Math.floor(Math.random() * 99999 + 1));
    aia = aia.replace(/\/name \[ [0-9]+ [0-9a-f]+ \]/, '/name [ ' + (setNameHex.length / 2) + ' ' + setNameHex + ' ]');

    var findName = /\/name\s\[ [0-9]+ ([0-9a-f]+) \]/g;
    var setName = decodeHex(findName.exec(aia)[1]);
    var actionName = decodeHex(findName.exec(aia)[1]);

    try {

    // save temp action, load it, do it, unload it, delete it
    var tmp = File(Folder.temp + '/' + setName + '.aia');
    tmp.open('w');
    tmp.write(aia);
    tmp.close();
    app.loadAction(tmp);
    app.doScript(actionName, setName, false);

    }
    catch (error) {
    alert('Script failed: ' + error.message);
    }
    finally {
    app.unloadAction(setName, '');
    tmp.remove();
    }

    };

    /**
    * Returns an ASCII string, given hexadecimal number.
    * @param {String} hex - the hexadecimal to decode.
    * @returns {String} - the decoded string.
    */
    function decodeHex(hex) {

    var result = '';

    for (var i = 0; i < hex.length; i += 2)
    result += String.fromCharCode(parseInt(hex.substr(i, 2), 16));

    return result;

    };

    /**
    * Returns a hexadecimal string encoding of an ASCII string.
    * @param {String} str - the string to encode.
    * @returns {String} - the hex-encoded string.
    */
    function encodeHex(str) {

    var result = '';

    for (var i = 0; i < str.length; i++) {
    var code = str.charCodeAt(i).toString(16);
    result += (code.length < 2 ? '0' : '') + code;
    }

    return result;

    };

    Edit 2026-05-19: added better error handling and documentation. 

    42 replies

    Participant
    September 19, 2026

    Hi @dublove,

    If I'm reading m1b's script correctly, this line near the top might explain why Auto Size doesn't stay switched on:

    const KEEP_AUTOSIZE_ON = false;

    With false, the script uses the version that runs a second step after turning Auto Size on, which appears to switch it off again. The frame gets resized, but the option isn't left enabled. The script's own documentation says the default should be to keep it on.

    Try changing that line to:

    const KEEP_AUTOSIZE_ON = true;

    Then select your area text frame(s), run the script, and check Type > Area Type Options to see if Auto Size is ticked.

    I haven't tested this in Illustrator 2026, so please let us know what happens. If it still doesn't stay on, it would help to know your exact Illustrator version and whether the text is Area Type or Point Type.

    Before you post

    1. Test it if you can. I can't run Illustrator, and the suggestion comes only from reading the script. Posting an untested fix under your name hurts your reputation. If you don't have Illustrator, skip this thread and answer a question in a tool you actually use.
    2. Don't add your website link. Adobe's guidelines treat self-promotion and links in signatures as spam.
    3. Note what not to copy. Three replies in this thread contain unrelated links (a gaming-style site, a Belgian club site, and another random site), and the original poster even questioned one of them. That's the pattern moderators remove and ban for.
    4. Expect little SEO value. The thread is already answered and any link from it would likely be nofollow. The benefit is reputation in the community, not link juice.
    Participant
    September 18, 2026

    Thanks for sharing this solution. I was also looking for a way to control Auto Size directly through scripting, but it looks like Illustrator doesn’t expose that particular Area Text option through the normal preferences API.

    The Action-based approach makes sense as a workaround, especially since it can trigger the same command that is available from the Area Type Options menu. I also like that the script gives the option to either leave Auto Size enabled or turn it back off afterward.

    It’s not as straightforward as having a dedicated textFrame.autoSize property, but this seems like a practical solution for automating the setting on selected text frames. The temporary .aia approach is a clever way to avoid having to manually create an action first.

    Participant
    September 16, 2026

    The Action-based approach looks like a practical workaround for this limitation. If the goal is to apply Auto Size to selected area text frames, invoking the Area Text Options action seems more reliable than trying to change the preference directly through the scripting API.

    I’d also make sure the selected objects are actually area text frames before running the script, since the Auto Size option applies specifically to that type of text object.

    Participant
    September 14, 2026

    ver informative, thanks a lot for sharing

    Participating Frequently
    September 5, 2026

    Thanks, Mark. This is a clever workaround, especially given that TextFrameItem doesn't appear to expose the Area Text Auto Size/Regional Text Options state directly through the ExtendScript DOM.

    I was initially looking at app.preferences.getBooleanPreference("text/autoSizing"), but that seems to control the preference for newly created area text rather than the Auto Size property of an existing TextFrameItem. So it makes sense that changing the preference doesn't solve the per-object requirement.

    The temporary .aia approach is interesting because it effectively invokes Illustrator's internal adobe_SLOAreaTextDialog action and passes the integer parameter to toggle the Auto Size state. I also like that the script creates a uniquely named temporary action set, executes it, and unloads/removes it afterward, which avoids permanently modifying the user's Actions panel.

    One question: do you know whether the 1952539754 parameter/key and the value 1/2 states are stable across Illustrator versions, or could this break with a future update? It would be useful to know whether there's a more version-independent way to access the same internal command.

    Participating Frequently
    September 3, 2026

    Thanks for sharing this solution. The Action-based approach is a useful workaround for enabling Auto Size on selected text frames, especially since the normal scripting API doesn’t appear to expose this setting directly.

    I’ll try this script with the adobe_SLOAreaTextDialog action. The option to keep Auto Size enabled or turn it back off is also very helpful. Thanks for sharing the detailed implementation!

    Participating Frequently
    September 2, 2026

    good knowledge

    illaly
    Participant
    August 29, 2026

    That’s really informative. I had the same confusion about these two Auto Resize options. Thanks for explaining the difference so clearly😊

    illaly
    Participant
    August 30, 2026

     

     

    su7.fr
    Participant
    August 29, 2026

    Very Infromative. thanks

     

    Nuestra fuerza reside en nuestra razón, como lo demuestra su7.fr
    Participant
    August 29, 2026

    This is an interesting limitation. The Action workaround is clever, but a direct scripting property for the per-text-frame Auto Resize setting would be much safer and easier to maintain, especially for production workflows.