left menu mob button

New Video on YouTube:

You may delay, but time will not. (Benjamin Franklin)


Comments

Admin
(12.10.2020 20:18):

Galeb, for example: forum.rudtp.ru/threads/scriptpalette.75192/

(Interface for Typical Operations)

Galeb
(11.10.2020 23:51):

Hi there, just out of curiosity... which analogous scripts on the Web are you referring to? I'm looking for a possibility to make a custom dock/panel where I can add certain Skripts as a button and maybe the most used features also. Appreciate your input on that topic. Best from Croatia, Galeb

(Interface for Typical Operations)

Danko Josic
(05.06.2020 1:08):

Thank you. Great help.

(Common Formatting of Several Tables)

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: 5

Джангозы (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

Leave a comment:

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