Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Invoking "Load Files Into Stack…" from Applescript

Guest
Oct 02, 2009 Oct 02, 2009

I have an Applescript that gathers a bunch of JPEGs, which I then combine into a PSD with File -> Scripts -> Load Files Into Stack…

However, I'd like to automate that final step if possible. Can I send a list of files to the Load Files Into Stack script from my Applescript?

TOPICS
Actions and scripting
1.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Oct 02, 2009 Oct 02, 2009

I'm not sure if or how Applescript can pass an array of file objects but the javascript function below accepts an array and stacks without a dialog. You will need to edit the include path to match your system

function runLoadStack( fList ){
    var loadLayersFromScript = true;// must be set before the include
    // @include '/C/Program Files/Adobe/Adobe Photoshop CS4/Presets/Scripts/Load Files into Stack.jsx'
    var aFlag = true;
    loadLayers.intoStack( fList, aFlag );
}

Translate
Adobe
Guest
Oct 02, 2009 Oct 02, 2009

Let me add that it does occur to me I could open all the files and use UI scripting to call the script, click the "Add Open Files" button, then click OK. However, that won't work if there are any other files open in Photoshop at the time, which is why I ask. Thank you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Oct 02, 2009 Oct 02, 2009

I'm not sure if or how Applescript can pass an array of file objects but the javascript function below accepts an array and stacks without a dialog. You will need to edit the include path to match your system

function runLoadStack( fList ){
    var loadLayersFromScript = true;// must be set before the include
    // @include '/C/Program Files/Adobe/Adobe Photoshop CS4/Presets/Scripts/Load Files into Stack.jsx'
    var aFlag = true;
    loadLayers.intoStack( fList, aFlag );
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 02, 2009 Oct 02, 2009

Thank you! Is there way I can pass just the name of the folder that contains the images I want in the stack? I explored the .jsx file but couldn't quite figure it out. That may save me the trouble of figuring out how to pass an Applescript list as a JavaScript array.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Oct 02, 2009 Oct 02, 2009
LATEST

If you can pass the full path to the folder as a string this should work.

function runLoadStack( folderPath ){// full path as String
    var loadLayersFromScript = true;// must be set before the include
    // @include '/C/Program Files/Adobe/Adobe Photoshop CS4/Presets/Scripts/Load Files into Stack.jsx'
    var folder = new Folder( folderPath );
    var fList = folder.getFiles('*.jpg')
    var aFlag = true;
    loadLayers.intoStack( fList, aFlag );
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines