Skip to main content
이 주제는 답변이 닫혔습니다.

9 답변

willcampbell7
willcampbell7작성자
Legend
June 17, 2021

I've completed the Illustrator version of the script. I made a new post in the Illustrator section:
https://community.adobe.com/t5/illustrator/new-script-dimensions-illustrator/m-p/12120192#M279896

 

William Campbell
willcampbell7
willcampbell7작성자
Legend
June 7, 2021

New version 2.0 this morning. Get it on the web page:

https://www.marspremedia.com/software/indesign/dimensions-indesign

Either "Lines" or "Text" can now be un-checked, and either won't be drawn.

Text frames now auto-size (should have to begin with!)

Can set text swatch independent of line swatch.

Option to lengthen extension lines into element.
Can define prefix for corner radius.

Lots of other little fixes.

PLEASE respond if I've broken anything. I will fix it quickly.
I want to thank everyone for the fabulous input to the project, here and in private messages. Users have helped me make a real gem. Thank you all!

 

William Campbell
willcampbell7
willcampbell7작성자
Legend
May 15, 2021

I've posted an updated version 1.1 that adds some user requests:

1. Choice of arrowhead. Instead of checkbox that adds 'Triangle' arrowheads only, UI now has a drop-down for 'None','Simple', or 'Triangle' arrowhead choice.

2. Added input for 'Decimal mark'. For those who want comma instead of period.

Same link as original post above.

Thank you all for the suggestions. Contact me if anything isn't working right.

 

William Campbell
Kasyan Servetsky
Legend
May 11, 2021

Hi William,

Thank you for sharing your script!

When I run it (on MacOS Big Sur ver. 11.3, InDesign 16.1), I get this error message twice: before the dialog box appears and after I click OK.

Then it continues as expected.

 

— Kas

willcampbell7
willcampbell7작성자
Legend
May 11, 2021

@Kasyan Servetsky  The script should still work, just options set won't be saved and restored on next launch. Seems it can't access your User folder.

What's the result if you run this code?

 

alert(Folder.userData.fsName);

 

 

William Campbell
Community Expert
May 11, 2021

Hi Jens,

interesting results.

 

How exactly were the fonts installed that you filtered as the ones without property fullName?

Is it the way they were installed? What do you see in Type > Find/Replace fonts… when the font is used in a document with "More Information"? Something special with the value of "Path:" ?

 

( For example: Installed fonts from the Adobe Fonts cloud service will just show "Aktiviert von Adobe Fonts" and not a font file in the file and folder system. )

 

Regards,
Uwe Laubender

( ACP )

Jens Trost
Inspiring
May 12, 2021

Hi Uwe,

we use FontExplorer as our font management software, so as far as I know the fonts get locally downloaded via the client. 
I'm not exactly sure how it's integrated into InDesign since the fonts get not installed in usually used folders (see Screenshot).
FontExplorer uses plugins for font activation but I haven't activated/installed them currently... so not quite sure how this all works. 



Jens Trost
Inspiring
May 11, 2021

I merge my answers here (I'm still not used to this layout of different conversations within a thread ;)).

@Laubender 
I ran your snippet a litte bit modified – I got 10 fonts, 9 of which where Helvetica Neue and some free font.
Helvetica is always a problem since there are conflicts between the system version and the FontExplorer-activated version – I just disabled them all and now I've got a 0 with your snippet 😉

@willcampbell7 

Community Expert
May 11, 2021

Hi William,

fontNames = app.fonts.everyItem().fullName;

If there are fonts where property fullName is invalid one could do an individual check for every installed font. But this will slow down your script very much. At least when you start up and the available fonts dialog must be populated.

 

Way out: You could restrict the script showing document.fonts only, fonts that are already used in the document.

 

Jens could test the following script snippet that should get the number of installed fonts where fullName is not valid.Cannot test it with a system where a font misses fullName, so I don't know if it will show something exceptional.

 

var appFontsArray = app.fonts.everyItem().getElements();
var appFontsArrayLength = appFontsArray.length;

var fullNameNotAvailable = [];
var alertMessage = "Number of Fonts where fullName is not available:" +"\r";

for( var n=0; n<appFontsArrayLength; n++ )
{
	if( !( "fullName" in appFontsArray[n].properties ) )
	{
		fullNameNotAvailable[ fullNameNotAvailable.length++ ] =
		appFontsArray[n];
	}
};

alert( alertMessage + fullNameNotAvailable.length );

 

Regards,
Uwe Laubender

( ACP )

willcampbell7
willcampbell7작성자
Legend
May 11, 2021

Looks like my update worked. Below is the change I made that now works. Only question left is which of the attempted properties was the one that worked. A screen capture of the Select Font window will tell.

// Make list of fonts.
try {
    fontNames = app.fonts.everyItem().fullName;
} catch (_) {
    // Does not have property fullName
}
if (!fontNames) {
    // Try property fullNameNative
    try {
        fontNames = app.fonts.everyItem().fullNameNative;
    } catch (_) {
        // Does not have property fullNameNative
    }
}
if (!fontNames) {
    // Only property left to use: name
    // If it doesn't work after this, throw the error.
    fontNames = app.fonts.everyItem().name;
}

 

William Campbell
Jens Trost
Inspiring
May 11, 2021

@willcampbell7  

If there is just one problematic font, the list keeps being empty.

Community Expert
May 11, 2021

Hi William,

no issue so far with:

German InDesign 2021 version 16.2.1.100

Windows 10 Pro

 

Jens, could be that the default font Dimensions is using, Arial, has some issues on your Mac.

Or maybe, that Arial is quite different from my installed Arial that comes with Windows 10.

 

Hm. William, maybe you could avoid any font issue at startup if you use Minion Pro Regular ?

That's the default font for every installed InDesign since CS5, I think.

 

Regards,
Uwe Laubender

( ACP )

Jens Trost
Inspiring
May 11, 2021

Hi Uwe,

 

could be... I just noticed that the font list is completly empty, so there's probably an issue here...

Jens Trost
Inspiring
May 11, 2021

Hi William,

great idea!

 

But on first run (even before the dialog) I get an error

(loosly translated something like "The requested property is for this font not available")


Then the dialog shows up, I just hit okay, and then this error:


I guess it could have something to do with the layers, swatches and paragraph styles dropdowns being empty?


Tested on macOS 10.14.6, InDesign 16.1 (german version) with just an empty document an a selected rectangle.

willcampbell7
willcampbell7작성자
Legend
May 11, 2021

Thank you for the response. Your feedback helps me greatly.

I've posted an update version 1.0.1 to my site to download and try. I'll explain what is causing the error below. I highly suspect you have a faulty font installed. Download the update and if it still gives an error, then for sure one of your fonts is whacked. If you would contact me through my website, I can make a test file to send you via email and we can both learn exactly which font is causing the problem.

The line throwing the error is when making the font list. For those interested, the precise line is

 

fontNames = app.fonts.everyItem().fullName;

 

For whatever reason, either multiple fonts or a particular font lacks the propery 'fullName.' In my update I've added a few try catch blocks to try other properties if that one fails. I use 'fullName' because it's more human-readable than the property 'name' that has a tab between family and style that ends up stripped out in lists so it's just crammed together. But if fullName fails, I am now trying name.

The second problem that is fixed, is that if making a font list fails, the script should exit. It wasn't. This was a minor oversight on my part. Because fonts is the first list made, when it fails, the rest (swatches, paragraph styles) never are made either. That's why the drop-downs for all are empty. The update won't even display the interface now, since continuing the script only leads to further errors. Once making any one list fails, the script ends after the alert.

@Laubender, I'll reply to your reply separately -- good idea on default font, and I'll explain that fix I made for it in the 1.0.1 update.

 

William Campbell
Jens Trost
Inspiring
May 11, 2021

Your updated version works 🙂

Awesome script!
I really appreciate you provide this for free.