This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function combine_text_file ( files, path, new_name ) { | |
if( files.length>0 ) { | |
var all_string = ""; | |
for (var i = 0, len = files.length; i < len; i++) { | |
all_string += read_text_file( files[i] ); | |
}; | |
return write_text_file( all_string, path, new_name ); // return file | |
}; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_date_string(para_date) { | |
var date = para_date || new Date(); | |
var day = (date.getDate() > 10 ) ? date.getDate() : ("0" + date.getDate() ), | |
month = ((date.getMonth()+1) > 10 ) ? (date.getMonth()+1) : ("0" + (date.getMonth()+1) ), | |
year = (date.getFullYear() > 10 ) ? date.getFullYear() : ("0" + date.getFullYear() ), | |
hours = (date.getHours() > 10 ) ? date.getHours() : ("0" + date.getHours() ), | |
minutes = (date.getMinutes() > 10 ) ? date.getMinutes() : ("0" + date.getMinutes() ); | |
return year + month + day + "_" + hours + minutes; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function show_dialog(message, opened_number) { | |
// update it v 0.1.1 | |
var defaultScriptPreference = app.scriptPreferences.userInteractionLevel; | |
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL; | |
var myDialog = app.dialogs.add({name:"Continue with another file or finish?",canCancel:true}); | |
var all_messages = []; | |
with(myDialog){ | |
with(dialogColumns.add()){ | |
with(dialogRows.add()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function save_as_file_type(fileObj) { // { fileName, fileType, path, quality } | |
if (app.documents.length == 0) { | |
alert("Please have an 'photoshop' document before running this script."); | |
return; | |
} | |
var quality = fileObj.quality || 3, //default 3 | |
path = fileObj.path || app.activeDocument.path, | |
document = fileObj.document || app.activeDocument, | |
fileName = document.name, | |
fileType = fileObj.fileType, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function saveForWebPNG(outputFolderStr, filename) | |
{ | |
var opts, file; | |
opts = new ExportOptionsSaveForWeb(); | |
opts.format = SaveDocumentType.PNG; | |
opts.PNG8 = false; | |
opts.quality = 100; | |
if (filename.length > 27) { | |
file = new File(outputFolderStr + "/temp.png"); | |
activeDocument.exportDocument(file, ExportType.SAVEFORWEB, opts); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Cs4SFW(FileName,Quality,MetaData, Profile,Progressive) { | |
function cTID(s) { return app.charIDToTypeID(s); }; | |
function sTID(s) { return app.stringIDToTypeID(s); }; | |
/* | |
reference -> http://forums.adobe.com/message/2582725 | |
Metadata:- | |
'MDAl' All metadata 'MDNn' No metadata | |
'MDCp' Copywright 'MDCC' Copyright and contact | |
'MDAx' All except camera info | |
Profile:- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reference: http://www.hardcode.nl/subcategory_1/article_317-array-shuffle-function | |
Array.prototype.shuffle = function() { | |
var len = this.length; | |
var i = len; | |
while (i--) { | |
var p = parseInt(Math.random()*len); | |
var t = this[i]; | |
this[i] = this[p]; | |
this[p] = t; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_range (min, max) { | |
var arr = []; | |
for (var i = 0; i <= (max - min); i++) { | |
arr[i] = min + i; | |
}; | |
return arr; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reference: http://www.ps-scripts.com/bb/viewtopic.php?f=10&t=3409&sid=f4a754d74f5b92fa6732a283c0e20fd9 | |
function FitImage( inWidth, inHeight ) { | |
var desc = new ActionDescriptor(); | |
var unitPixels = charIDToTypeID( '#Pxl' ); | |
desc.putUnitDouble( charIDToTypeID( 'Wdth' ), unitPixels, inWidth ); | |
desc.putUnitDouble( charIDToTypeID( 'Hght' ), unitPixels, inHeight ); | |
var runtimeEventID = stringIDToTypeID( "3caa3434-cb67-11d1-bc43-0060b0a13dc4" ); | |
executeAction( runtimeEventID, desc, DialogModes.NO ); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function RunSaveForWeb() { | |
var id637 = charIDToTypeID( "slct" ); | |
var desc89 = new ActionDescriptor(); | |
var id638 = charIDToTypeID( "null" ); | |
var ref21 = new ActionReference(); | |
var id639 = charIDToTypeID( "Mn " ); | |
var id640 = charIDToTypeID( "MnIt" ); | |
var id641 = charIDToTypeID( "Svfw" ); | |
ref21.putEnumerated( id639, id640, id641 ); | |
desc89.putReference( id638, ref21 ); |