Change cursor key keyboard increment
For many years I worked just with CorelDRAW and one thing I really liked and I used to was changing cursor key keyboard increment. Unfortunately InDesign doesn’t allow me to change that setting, without going into Preferences. So, I decided to try to create script, with simple dialog box where I can input number, and change setting. This was my very first InDesign script 😀
Script is also published on Adobe’s InDesign scripting forum but with finished dialog and with unit conversion. But here, I just want to look how to assign value to Preferences.
One interesting thing is that InDesign has two settings for cursor key keyboard increment. One is in app.activeDocument and other is in app.viewPreferences. First one, app.activeDocument is saved with document, and it’s opened with document and InDesign will use that value for cursor key increment. Second one, app.viewPreferences is for every new document we create, like default value. If we set cursor key increment from Preferences, while document is open, just app.activeDocument will update. Another important thing is that key increment unit is same as Horizontal ruler units, which means if our horizontal ruler units are in Points, cursor key increment will be also in Points. That’s important to know when we convert units that you got from measurementEditboxes, because they always return values in points!
Let’s see how to read/set values from both preferences through script.
Read/set cursor key increment for new created documents:
var keyInc = app.viewPreferences.cursorKeyIncrement; // read app.viewPreferences.cursorKeyIncrement = 5; // write
Read/set cursor key increment for curent document:
var keyInc = app.activeDocument.viewPreferences.cursorKeyIncrement; // read app.activeDocument.viewPreferences.cursorKeyIncrement = 5; // write
That’s it, if you want, take look at my script on Adobe’s forum. I built in option for saving to app.viewPreferences. Have fun! 😀