Skip to main content
Nota
Participant
January 21, 2020
Question

Use script to apply style (paragraph, characters)

  • January 21, 2020
  • 4 replies
  • 613 views

Hi,

I have often to change my styles on my Illustrator doc,  I've tried to make a script on some styles but it doesn't work… Is it normal or it's a bug ?

 

Is it possible to fix it in the next update ?

 

Thx

 

Nelly

This topic has been closed for replies.

4 replies

pixxxelschubser
Community Expert
Community Expert
January 22, 2020

@Nota

Did you read my last answer?

Nota
NotaAuthor
Participant
January 23, 2020

Hi pixxxel,

Sorry I thought that my answer  was clear enough…

So,

1. I would like to set shortcuts to particulars paragraph or character style (to avoid lose time  in select in the window with a clic during writting). I try to set a script action with the script window (you know, with the little record button…) and set a shortcut with fn on it.

2.My action appears in the window with the name of my style but when I play it (or use the shortcut) nothing happen…

3.There is the part of  the code which does'nt  work

/version 3
/name [ 6
	5374796c6573
]
/isOpen 1
/actionCount 3
/action-1 {
	/name [ 9
		5374796c65204c4c53
	]
	/keyIndex 33
	/colorIndex 4
	/isOpen 1
	/eventCount 1
	/event-1 {
		/useRulersIn1stQuadrant 0
		/internalName (ai_plugin_charstyles)
		/localizedName [ 20
			5374796c657320646520636172616374c3a87265
		]
		/isOpen 1
		/isOn 1
		/hasDialog 0
		/parameterCount 2
		/parameter-1 {
			/key 1835363957
			/showInPalette 4294967295
			/type (integer)
			/value 13
		}
		/parameter-2 {
			/key 1937011295
			/showInPalette 4294967295
			/type (ustring)
			/value [ 48
				4170706c6971756572206c65207374796c6520646520636172616374e2889ac2
				ae7265203a45532d5479706f204c4c53
			]
		}
	}
}

I'm novice  in scripting but I try to learn 🙂

 

Thx

Nelly

 

pixxxelschubser
Community Expert
Community Expert
January 21, 2020

@Nota,

please explain exactly what you really want to do.

 

The best way to get an answer is:

  1. exact description (what you want, what does not work, error messages, wrong results and so on…)
  2. screenshot before and at the best after (if the second one is not possible - a scribble or a screenshot of a "manually created" wished result should be good enough)
  3. VERY Important: the relevant part of your code which does not work.
  4. ALSO important: an example AI file (use a hoster of your choise, for example dropbox or similar)
Mike_Gondek10189183
Community Expert
Community Expert
January 21, 2020

Why make a script or action for applying a type style, when you cann apply using the charachter or paragraph styles window? You may not get much feedback as most will use the style wundows to apply a style. Are you trying to combine this with other actions?

Nota
NotaAuthor
Participant
January 22, 2020

Hi,

I've to be quick because we have to make a looooot of infographics during the day… So I use lot of shortcuts into Illustrator to be faster…

I work  on a Macbook pro 2018 with Illustrator 2020  (24.0.2) since 2 weeks (I worked on CC  2018 before that)

I  use scritps action for some commands like alignments and I set shortcuts with fn on it.

 

It's easier to me to use shortcuts during the redaction that clic on the paragraph/character window… (Like tips on Indesign per example…!)

 

But when I try to use my script action to apply a character style per example, nothin happens… However, I see that the script is correct (my style appears on the script )… I thought that will be corrected in the news version but no :'(

This is what I see in the script action window :

 

Mylenium
Legend
January 21, 2020

Without any idea about what specific formatting the styles contain, your script code, system info and so on nobody can really tell you much. To me it simply sounds like your script may need some love because quite likely you're not differentiating between object types and if the script encounters an invalid entity it simply does nothing. Similalrly, conflicting styles could throw things off as do millions of other things. All of that could presumably be fixed easily with the right code, but it sounds like you're extremely inexperienced in this and just have cobbled together something from copy&paste snippets with no provision for such special cases.

 

Mylenium