Skip to content

Instantly share code, notes, and snippets.

View joonaspaakko's full-sized avatar
🍕
Pizza...

Joonas Pääkkö joonaspaakko

🍕
Pizza...
View GitHub Profile
// Test file:
// ====================================
// https://www.dropbox.com/s/dokdemxve0wd6yp/singleline%20or%20multiline%20text%20-%20test.psd?dl=0
// My results:
// ====================================
// (TRUE) 1. Singleline Point text
// (TRUE) 2. Singleline Paragraph text
// (FALSE) 3. Multiline Point text.Forced linebreak
// (FALSE) 4. Multiline Paragraph text. No forced line breaks.
@joonaspaakko
joonaspaakko / Select Parent Group.jsx
Last active January 2, 2025 23:00
Selects the parent group of the currently selected layer.
// https://gist.github.com/joonaspaakko/e8b5d577953e25c0a86903a76a7f4bba
#target photoshop
var doc = app.activeDocument;
var layerParent = doc.activeLayer.parent;
if ( layerParent !== doc ) doc.activeLayer = layerParent;
@joonaspaakko
joonaspaakko / Select Sibling Layers.jsx
Last active January 2, 2025 23:00
Select Sibling Layers.jsx Photoshop Script - Selects the sibling layers.
//https://gist.github.com/joonaspaakko/d4449fd5ef211df7850cab748bf9b8f6
#target photoshop
if ( app.activeDocument.activeLayer.parent !== app.activeDocument ) {
app.activeDocument.suspendHistory( "Select Sibling Layers.jsx", "init();" );
}
function init() {
var doc = app.activeDocument;
@joonaspaakko
joonaspaakko / Select Next Layer (invisible or not).jsx
Last active January 2, 2025 22:58
Photoshop script that selects the next layer above or below even if it's not visible.
// 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 January 2, 2025 22:55
Photoshop script for comparing selected layer comps. The script arranges layer comps on a new document for your viewing pleasure.
// 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 / Illustrator convert to legacy.jsx
Last active October 8, 2024 05:16
Finds all Illustrator files from the input folder + its subfolders and converts them to an older version.
// https://gist.github.com/joonaspaakko/df2f9e31bdb365a6e5df
// Finds all .ai files from the input folder + its subfolders and converts them to the version given below in a variable called "targetVersion"
// Tested in Illustrator cc 2014 (Mac)
// Didn't bother to do a speed test with my macbook air...
#target illustrator
// If set to false, a new file will be written next to the original file.
@joonaspaakko
joonaspaakko / Select Child Layers.jsx
Last active June 6, 2024 01:24
Select Child Layers.jsx Photoshop Script - Selects the first level of layers inside the currently active group.
// https://gist.github.com/joonaspaakko/1add5c6a905216740c9c922a657636e1
#target photoshop
if ( app.activeDocument.activeLayer.typename == 'LayerSet' ) {
app.activeDocument.suspendHistory( "Select Child Layers.jsx", "init();" );
}
function init() {
var doc = app.activeDocument;
@joonaspaakko
joonaspaakko / Export document for each layer inside selected group.jsx
Last active January 23, 2024 05:52
Photoshop script that saves the whole document for each top level layer inside the selected group.
// Name: Export document for each layer inside selected group.jsx
// Formerly: Export Layers Inside Selected Group.jsx
// Description: Photoshop script that saves the whole document for each top level layer inside the selected group.
// Image example: https://user-images.githubusercontent.com/1164476/49152494-aef8af00-f31b-11e8-80ff-d774e3103eae.png
// https://gist.github.com/joonaspaakko/013a223e94ba0fb9a2a0
#target photoshop
/*
NOTE:
1. Makes the assumption that only one layer is selected (only really matters when going down)
2. Doesn't care if the adjacent layer is a group or not
*/
var options = {
direction: 'up',
loop: true,
};
@joonaspaakko
joonaspaakko / SaveTo (PS-AI).jsx
Last active December 10, 2023 01:49
SaveTo.jsx script (v.1.3.) for Photoshop and Illustrator. The idea is that it exports the work file and the production file at the same time, saving some time and effort.
// https://gist.github.com/joonaspaakko/b878d993b038b98b8ca78cc859916af4
// The idea is that it exports the work file and the production file (or a preview file) at the same time saving some time and effort.
// - This has been tested in Photoshop CC 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 and there's now the additional jpg option