1st time Scripter...needs help with 2 step conditional
never scripted in form. javascript might cuniform know.
really understand stuff.
downloaded guides...they make head hurt. love suggestions on starter book. entry level stuff.
should go learn javascript , easier?
here goal of script want write.
i have main folder/artist name folder/backup container/retouched/*this images lie*
also /untouched/*this images lie*
i write script send photoshop through subfolders looking files.
open file.
determine if file grayscale.
if not close file.
if grayscale determine long side of picture , resize 300dpi retaining proportions making long side 10 inches.
save file in folder adding '_8x10' filename
save file in 'c:/getty/" adding '_8x10' filename
close file without saving
other important facts
stressing need originals should not harmed in anyway.
99% of files .tiffs others jpgs - can ignore jpgs in order remove variable.
i have been working on 2 days, trying teach myself , isn't clicking. can't seem pick quickly.
here have written , tried patch other scripts on web hoping understood why picking code.
i running out of time , love direction on this.
here code:
// grayscalethenlandorportto10inches300dpi.jsx
// copyright 2012
// written brian shupe stealing shamelessly on net
/*
description:
this script searches folder , subfolders images.
checks see if grayscale
if so, sizes long side 10 inches @ 300dpi
*/
// enable double clicking
// macintosh finder or windows explorer
#target photoshop
// make photoshop frontmost application
// in case double clicked file
app.bringtofront();
///////////////////////////
// set-up //
///////////////////////////
//close open documents
while (app.documents.length) {
app.activedocument.close()
}
// create dialog box select parent folder
var imagefolder = folder.selectdialog("select folder images process");
// set naming variables easier coding
var doc = app.activedocument;
//set units inches
// save current preferences
var strtrulerunits = app.preferences.rulerunits;
var strttypeunits = app.preferences.typeunits;
// set adobe photoshop cs4 use pixels , display no dialogs
app.preferences.rulerunits = units.inches
app.preferences.typeunits = typeunits.inches
app.displaydialogs = dialogmodes.no
// recurse subfolders
if (imagefolder != null) processfolder(imagefolder);
function processfolder(folder) {
var filelist = folder.getfiles()
(var = 0; < filelist.length; i++) {
var file = filelist[i];
}}
// check see if active document not grayscale. if true nothing
if (doc.mode != documentmode.grayscale) {
} else
// check see if document taller wide
if (doc.height > doc.width)
{
// run action if if statement true. action sizes both height 10 inches , dpi 300
doaction("port","getty");
}
else
{
// run action if if statement false. action sizes both length 10 inches , dpi 300
doaction("land","getty");
}
// create folder hold duplicate file
var myfolder = new folder("c:/getty/");
myfolder.create();
savefile = new file('c:/getty/' + imgname+ "_" + "8x10")
var currentfolder = activedocument.path;
var parentfolder = decodeuri(activedocument.path.parent);
savefile = new file(parentfolder + '/' + 'backup container' + '/' + imgname+ "_" + "8x10")
app.activedocument.close(saveoptions.donotsavechanges)
i believe right problem when gets point looks open image...there none , breaks.
can see clumsy attempt intends , course correct me?
would happy discuss tutoring services.
to start shallow forray ino scripting picked book peter kahrel on automating indesign javascript – seems it’s available neither in english anymore nor cs6, though.
in case helped me basic grasp on javascript, naturally not lot of if have no indesign automating needs.
in case people in forum , on @
have been helpful.
as documentation have started »photoshop scripting guide.pdf«?
as script, @ cursory glance seem have missed opening files here.
// create dialog box select parent folder var imagefolder = folder.selectdialog("select folder images process"); // set naming variables easier coding var doc = app.activedocument;
this not concise method, maybe helps open files selected folder:
// 2012, use @ own risk; #target photoshop var thefolder = folder.selectdialog ("select folder"); var thefolderfiles = retrievetifandjpg (thefolder, []) ; (var m = 0; m < thefolderfiles.length; m++) { app.open(file(thefolderfiles[m])) }; ////// subfolders ////// function retrievetifandjpg (thefolder, thefiles) { if (!thefiles) {var thefiles = []}; var thecontent = thefolder.getfiles(); (var n = 0; n < thecontent.length; n++) { var theobject = thecontent[n]; if (theobject.constructor.name == "folder") { thefiles = retrievetifandpsd(theobject, thefiles) }; if (theobject.name.slice(-4) == ".tif" || theobject.name.slice(-4) == ".jpg") { thefiles = thefiles.concat(theobject) } }; return thefiles };
More discussions in Photoshop Scripting
adobe
Comments
Post a Comment