Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6757205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:37:07+00:00 2026-05-26T13:37:07+00:00

this is extendscript for illustrator, its basically javascript though. I want the second pop

  • 0

this is extendscript for illustrator, its basically javascript though. I want the second pop up to only show once, I tried to tell it if the variable already exists to not do it, but if it doesn’t to ask for input. any idea what I am doing wrong?

#target illustrator
if ( app.documents.length > 0 ) {
    var replaceThis = prompt('What font do you want to replace?','')
    for ( i = 0; i< app.activeDocument.textFrames.length; i++) { //loop through the layers
        var textArtRange = app.activeDocument.textFrames[i].textRange;
        var fontSize = textArtRange.characterAttributes.size;
        //var replaceThis = "10";
        //alert("replace this:" + replaceThis);
       // alert("current font size" + fontSize);
        if (fontSize == replaceThis) {
             Replacefont();
         }
        function Replacefont () {
                //var newSize = "90";
                if (!newSize) {
                    var newSize = prompt('Replace '+ replaceThis +'pt with:','')
                }
                textArtRange.characterAttributes.size = newSize;
                alert("yay");
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:37:07+00:00Added an answer on May 26, 2026 at 1:37 pm

    newSize is only available inside ReplaceFont, and is discarded each time the function ends. You’d need to make it persistent like this (there is no real reason for making a separate function). Also don’t forget var for the for loop.

    #target illustrator
    if ( app.documents.length > 0 ) {
        var replaceThis = prompt('What font do you want to replace?','');
        var newSize = prompt('Replace '+ replaceThis +'pt with:','');
    
        for ( var i = 0; i < app.activeDocument.textFrames.length; i++) {
            var textArtRange = app.activeDocument.textFrames[i].textRange;
            var fontSize = textArtRange.characterAttributes.size;
    
            if (fontSize == replaceThis) {
                textArtRange.characterAttributes.size = newSize;
                alert("yay");
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This most be the second most simple rollover effect, still I don't find any
This is the content on my view page and i want to replace the
this is dankogai's javascript deflate http://github.com/dankogai/js-deflate I can't inflate from c#,please help me
I am trying to script InDesign using ExtendScript. I want the script to cut
This question is because normally when you want to click a button or link
This is a normalization thing, but I want I have to hold information about
this is my xml file. i want to use xslt to transfer them into
This is a bit of a long shot, but if anyone can figure it
This is starting to vex me. I recently decided to clear out my FTP,
This is kinda oddball, but I was poking around with the GNU assembler today

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.