Skip to content

Instantly share code, notes, and snippets.

🍕
Pizza...

Joonas Pääkkö joonaspaakko

🍕
Pizza...
Block or report user

Report or block joonaspaakko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Indesign Script - Get pageitem stacking index & select item based on the same ruleset.jsx
var selection = app.selection[0];
var zIndex = getStackingIndex( selection, true );
$.writeln( zIndex );
// Since the last parameter is set to false, this selectPageItem() mirrors the selection
// - If first item is selected when the script is run, the last one will be
// selected when the script is done.
selectPageItem( selection.parentPage, zIndex, false );
@joonaspaakko
joonaspaakko / Select All Layers.jsx
Last active Jul 31, 2019
Photoshop script for selecting all layers, including the background layer.
View Select All Layers.jsx
selectAllLayers();
function selectAllLayers() {
// Select all layers (doesn't include Background)
try {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
desc.putReference( charIDToTypeID('null'), ref );
executeAction( stringIDToTypeID('selectAllLayers'), desc, DialogModes.NO );
View Add leading & trailing space to a specific character style.jsx
// Set true to "normalize" the character styled text = no extra leading & trailing spaces
var removeSpace = false;
app.findTextPreferences = null;
app.changeTextPreferences = null;
var findPref = app.findTextPreferences;
var changePref = app.changeTextPreferences;
findPref.appliedCharacterStyle = 'yellow-background';
@joonaspaakko
joonaspaakko / Select Next Layer (invisible or not).jsx
Last active Apr 23, 2019
Photoshop script that selects the next layer above or below even if it's not visible.
View Select Next Layer (invisible or not).jsx
// Select Next Layer (invisible or not).jsx
// https://gist.github.com/joonaspaakko/048c9b58ccbb6e6f44c894bf4ce30b68
nextLayer('down');
// direction (↑): "up" or "above"
// direction (↓): "down" or "below"
function nextLayer( direction ) {
var doc = app.activeDocument;
@joonaspaakko
joonaspaakko / Compare Selected Comps.jsx
Last active Apr 21, 2019
Photoshop script for comparing selected layer comps. The script arranges layer comps on a new document for your viewing pleasure.
View Compare Selected Comps.jsx
// Version 1.1.
// Compare Selected Comps.jsx
// https://gist.github.com/joonaspaakko/adbe208a867f8681afa86032f91f5099?ts=2
// #########
// Changelog
// #########
// v.1.1.
// - Tested in Photoshop CC 2019
@joonaspaakko
joonaspaakko / Page Numbers To Percentages.jsx
Last active Jun 26, 2019
Indesign script for converting page numbers to percentages.
View Page Numbers To Percentages.jsx
// Version.1.0.
// Page Numbers To Percentages.jsx
// https://gist.github.com/joonaspaakko/6628e2b6252d622b1b7f7eba601f6c91
// You may want to save before running the script. Every single
// time you run the script, all text frames that are inside a
// master page or nested master pages will be torn out (overridden).
// The script assumes the starting point is this:
// 1. You have a designated layer for the page numbers (Layer name defined below↓).
@joonaspaakko
joonaspaakko / Save PNG next to PSD (Incremental numbers)
Created Mar 12, 2019
If the file hasn't already been saved as a PSD, the script will prompt you to do that because it relies on that path for all the exports.
View Save PNG next to PSD (Incremental numbers)
#target photoshop
var savePSD = false; // If set true the psd document is saved every time the script runs...
var folderName = ' (Frames)';
try {
var doc = app.activeDocument;
var fileExists = false;
View Dialog Example - Import Multiple PDF pages.jsx
/*
Code for Import https://scriptui.joonas.me — (Triple click to select):
{"activeId":1,"items":{"item-0":{"id":0,"type":"Dialog","parentId":false,"style":{"text":"Import Multiple PDF pages","preferredSize":[0,0],"margins":16,"orientation":"row","spacing":10,"alignChildren":["left","top"]}},"item-1":{"id":1,"type":"Panel","parentId":20,"style":{"text":"Page Selection","preferredSize":[0,205],"margins":10,"orientation":"column","spacing":10,"alignChildren":["left","top"],"alignment":null}},"item-2":{"id":2,"type":"StaticText","parentId":1,"style":{"text":"Import PDF Pages:","justify":"left","preferredSize":[0,0],"alignment":null}},"item-3":{"id":3,"type":"EditText","parentId":6,"style":{"text":"1","preferredSize":[60,0],"alignment":null}},"item-4":{"id":4,"type":"StaticText","parentId":6,"style":{"text":"thru","justify":"left","preferredSize":[0,0],"alignment":null}},"item-5":{"id":5,"type":"EditText","parentId":6,"style":{"text":"1","preferredSize":[60,0],"alignment":null}},"item-6":{"id":6,"type":"Group","
View Dialog Example - Export Layers Inside Selected Group.jsx
/*
Code for Import https://scriptui.joonas.me — (Triple click to select):
{"activeId":6,"items":{"item-0":{"id":0,"type":"Dialog","parentId":false,"style":{"text":"Export Layers Inside Selected Group","preferredSize":[0,0],"margins":16,"orientation":"column","spacing":10,"alignChildren":["center","top"]}},"item-1":{"id":1,"type":"Checkbox","parentId":6,"style":{"text":"PSD","preferredSize":[0,0],"alignment":null}},"item-2":{"id":2,"type":"Checkbox","parentId":6,"style":{"text":"TIFF","preferredSize":[0,0],"alignment":null}},"item-3":{"id":3,"type":"Checkbox","parentId":6,"style":{"text":"JPEG","preferredSize":[0,0],"alignment":null,"checked":true}},"item-4":{"id":4,"type":"Checkbox","parentId":6,"style":{"text":"PNG","preferredSize":[0,0],"alignment":null}},"item-5":{"id":5,"type":"Checkbox","parentId":6,"style":{"text":"PDF","preferredSize":[0,0],"alignment":null}},"item-6":{"id":6,"type":"Panel","parentId":9,"style":{"text":"File format","preferredSize":[0,0],"margins":10,"orientation":"row","spacing":10,
@joonaspaakko
joonaspaakko / SaveTo (PS-AI).jsx
Last active Sep 2, 2018
SaveTo.jsx script (v.1.1.) for Photoshop and Illustrator. Photoshop saves jpg and psd. Illustrator saves pdf and ai. The idea is that it exports the work file and the production file at the same time saving some time and effort.
View SaveTo (PS-AI).jsx
// https://gist.github.com/joonaspaakko/b878d993b038b98b8ca78cc859916af4
// The idea is that it exports the work file and the production file at the same time saving some time and effort.
// - This has been tested in Photoshop and Illustrator CC. It used to work in CS3, but I'm fairly sure I've changed the code enough at this point to break it for older versions.
// - Has a simple dialog where you can rename the file or leave it as it is.
// - If document has been saved the script will suggest saving in the same path, otherwise it will default to what's set in the variable "newDocPath".
// - Photoshop saves .jpg and .psd
// - Illustrator saves .pdf and .ai
You can’t perform that action at this time.