• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

AS M Space

Community Expert ,
Sep 19, 2009 Sep 19, 2009

Copy link to clipboard

Copied

I know I can use tab or return to set tabs or returns as content in a text field, but how do I set different white spaces or dashes—m space, n space, etc.

TOPICS
Scripting

Views

1.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Sep 20, 2009 Sep 20, 2009

You can easily get this information by putting the character in a frame and getting the contents via script. If you ask for the contents of more than one character, you'll get the Unicode equivalent; otherwise you'll get the enumeration if there is one.

Votes

Translate

Translate
Community Expert ,
Sep 19, 2009 Sep 19, 2009

Copy link to clipboard

Copied

It depends on what you call 'a text field' -- and how you insert Tab and Return now.

If you use "^r" and "^t", you must be talking about the Find & Replace strings. If so, you can use the same notation as in the ID user interface: ^> for an en space, ^_ for an em dash, ^= for an en dash. (Sorry, can't cough up em space at the mo'.)

If you are using AS notation -- isn't that something like "hello" + newLine + "world"? -- and want to insert this as live text into ID documents, you might want to look for how to write Unicode characters. In JS, I can insert any UC character: "hello\u2014world" is an em dash. Em spaces are a bit more difficult. I think they have a UC code as well (and you could try that), but inside ID it's one of the SpecialCharacters. You cannot insert these right away in strings; I use (JS again)

app.activeDocument.selection[0].insertionPoints[-1].contents = SpecialCharacter.EM_SPACE;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 20, 2009 Sep 20, 2009

Copy link to clipboard

Copied

I'm adding content—not search and replacing. Unicode strings compile as a variable and produce an error. Tab and return compile as keywords, I'm looking for the equivalent for dashes and spaces. I suppose I could insert some odd string and then do a search and replace with the em space

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 20, 2009 Sep 20, 2009

Copy link to clipboard

Copied

You can easily get this information by putting the character in a frame and getting the contents via script. If you ask for the contents of more than one character, you'll get the Unicode equivalent; otherwise you'll get the enumeration if there is one.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2009 Sep 21, 2009

Copy link to clipboard

Copied

Thanks Shane, that's working for em and en dashes but not different spaces. If I run a get contents script on an em space is appears to be returning a normal space.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2009 Sep 21, 2009

Copy link to clipboard

Copied

Sorry, it's working if i put in just one character at a time. The key word for em space is Em space. Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 21, 2009 Sep 21, 2009

Copy link to clipboard

Copied

Keep in mind that if you're using 10.5 or later, you can also use the actual Unicode characters in your scripts. That gives you the ability to set them more than one character at a time.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2009 Sep 21, 2009

Copy link to clipboard

Copied

But when I actually use the returned key word in my script it's not working.

set myEntry to myTitle & "," & En space & myDate  

returns this:

Pretty Picture,«constant nSPcSEnS»1995

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 21, 2009 Sep 21, 2009

Copy link to clipboard

Copied

That's right -- you can only use the enumerations by themselves. What's happening is that AS, not ID, is doing the concatenating, and it does that by coercing all items to text.

As I said, if you're using 10.5 or later, just use the Unicode value. Other wise, you'll have to set the contents of the story in separate steps.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2009 Sep 21, 2009

Copy link to clipboard

Copied

LATEST

Thanks, I'll keep that in mind— I'm still using 10.4.11. A placeholder string followed up by a find and replace is working as well.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines