left menu mob button

Thanks to everyone who said "thank you" by clicking the link:

Олег Е.
(23.12.2020):

За полезные скрипты и с Новым годом!

Фёдор Х.
(22.12.2020):

Большое спасибо!

Дмитрий
(20.06.2020):

За скрипт для работы с таблицами в Индизайне.


New Video on YouTube:

Comments

hadi
(10.08.2021 9:44):

Hi. If there is a group style, its subset style will not be displayed.

(Copy GREP Styles)

hadi
(24.06.2021 9:04):

hi. It is a perfect script.

(Common Formatting of Several Tables)

bartbin
(11.06.2021 21:22):

Eugenyus, I use your two scripts with great joy and benefit: Split Table Row by Paragraphs and Split Text By Paragraphs. Thank you very much for them. They have saved me time and work many times. I found another very interesting Quick Formatting script on your blog. I copied the code into the Sublime text editor and saved it as a .jsx file type Unfortunately, it does not perform the main function. After pressing start, the inscription -not working- is displayed and the window with the choice of style does not appear. The script still does not make any changes to the text. I have Indesign 2020 Please, write if it's the program's fault or if I wrote something wrong. Thank you so much. Bartholomew

(Quick formatting)

Only The Necessary Information

(series of articles):

Quick formatting

Each of us, sooner or later, will receive a text for layout, which cannot be formatted with the available automation tools. For example, if the author of the text does not know how to use different underlining types in MS Word, you will have to manually apply several character styles, one by one or interspersed.

If, at the same time, you prefer the "high-speed" style of work, imagine what emotions are waiting for you from the algorithm: "double click on the word —> mouse over the style —> mouse click —> look at the source text —> find the word in the layout —> double click on the word —> repeat cycle". How many times will you miss the right style? And if you use "hotkeys" — how many times will you have to take off your right hand from the mouse and not miss (in the "high-speed" mode) the right key? And, as we remember, there are dozens of words, if not hundreds of them...

And, if it is impossible to fully automate the formatting process in this case, is it possible to at least reduce the number of actions to a minimum by teaching a program to assign the desired formatting right at the moment of the selection of the desired text? That is, it would be great if the layout designer would select a text by double-clicking, and the text would be formatted by itself, getting the desired style. Then one would need to just click the right words with the mouse and do nothing else, and this is a huge saving of time and nerves of the layout designer.

It is this problem that the algorithm presented below solves.

#targetengine "quickformatting"
var myEventHandler = function(ev){
	try{
		//Here the required action is performed. For example, I have assigned a character style to a set of consecutively allocated characters:
		app.activeDocument.selection[0].appliedCharacterStyle = "Desired Character Style"; 
		w.text = "It's working!";
		}
	catch(e){w.text = "It doesn't work!";}
	}//function

var w = new Window("palette");
var butStart = w.add("button",undefined,"Start"); //This button will enable / disable event listener.
var started = false; //Using this variable, we determine whether event listener is enabled or not.
butStart.onClick = function(){
    if (!started){
        //If event listener disabled, enable
        app.activeDocument.addEventListener('afterSelectionChanged', myEventHandler);
        butStart.text = "Stop"; //Switch button text
        }
    else{
        //If event listener is on, turn off
        app.activeDocument.removeEventListener('afterSelectionChanged', myEventHandler);
        butStart.text = "Start"; //Switch button text
        }
    started = !started; //When we click on the button, reassign the variable
    }
w.onClose = function(){
	if (started){
		app.activeDocument.removeEventListener('afterSelectionChanged', myEventHandler);
		}
	}
w.show();

The start/stop button is responsible for the behavior of the program at the moment when the text selection occurs — whether the selected text will receive the formatting specified in the script or not. And from the videos below, I hope, it is clear that the capabilities of such a code allow one to use it not only to apply a character style, but also for more complex tasks.

Updated on 16.12.2015. A conditional action has been added to the script, which stops the script if the user closes the script window, having forgotten to press Stop before that. These lines should be placed before the last line: w.show();

w.onClose = function(){
	if (started){
		app.activeDocument.removeEventListener('afterSelectionChanged', myEventHandler);
		}
	}
w.show();

Comments: 6

Джангозы (12.10.2018 9:22) E-mail

А где можно скачать или купить скрипт который ставит ударение? А то не разобрался с кодом. Заранее спасибо! d.s.zhan@mail.ru

Reply
Admin (17.10.2018 8:13) E-mail

Джангозы, в статью добавлено видео с пояснениями по установке и настройке скрипта.

Reply
Дмитрий (25.04.2019 23:23) E-mail

Мне кажется не совсем эргономичный метод расстановки ударений. Я делал по-другому... В любом нормальном (некривом) шрифте уже есть знаки ударения как для ЗАГЛАВНЫХ букв так и для прописных. берете любой из скриптов Insert-A-Glyph’o-matic или GID_Injects или MultiplicationInjects или UnicodeInjector, и назначаете ему хоткей... Ставите курсор позади ударной гласной, ТЫНЦ по хоткею и все... 4 учебника русского для иностранцев по 300 полос каждый делал именно так.

Reply
Михаил (24.04.2020 22:23) E-mail

У Вас на видие пример работы скрипта, где есть выпадающий список различных вариантов форматирования. А в скачанном скрипте доступен лишь один вид. Приходится каждый раз править скрипт ручками, чтобы применять разные виды форматирования. Как сделать такой список?

Reply
Admin (25.04.2020 16:41) E-mail

Михаил, приветствую! Пример того, как создаются выпадающие списки стилей, можно посмотреть, например, в скрипте: eugenyus.rudtp.ru/ru/applyParStyleWithNextStyle Строки 3-19 - создание массивов, окна и выпадающего списка в этом окне; строка 30 - получение доступа к выбранному пользователем стилю после того, как была нажата кнопка выполнения. Там происходит обращение к абзацным стилям. Чтобы организовать список символьных стилей, нужно просто заменить везде в этих строках paragraph на character.

Reply
bartbin (11.06.2021 21:22) E-mail

Eugenyus, I use your two scripts with great joy and benefit: Split Table Row by Paragraphs and Split Text By Paragraphs. Thank you very much for them. They have saved me time and work many times. I found another very interesting Quick Formatting script on your blog. I copied the code into the Sublime text editor and saved it as a .jsx file type Unfortunately, it does not perform the main function. After pressing start, the inscription -not working- is displayed and the window with the choice of style does not appear. The script still does not make any changes to the text. I have Indesign 2020 Please, write if it's the program's fault or if I wrote something wrong. Thank you so much. Bartholomew

Reply

Leave a comment:

Name*:
E-mail*:
Comment text*:
Security code*: