|Photoshop Scripting Learning and sharing for all platforms|
| ||Thread Tools|
I need a Script like a mail merge!
Hi there clickin, welcome to RetouchPRO.
It's a shame that I won't have time to try this for a couple of days, but what you want is pretty easy to do.
If nobody cracks this in the mean time, I'll have a go this weekend.
You could just convert your excel file into a batch file to replace...
1) You need a program that allows regular expressions...if you don't have one there is a really good free one called vim (you can download it here)
2) Export your excel file as a delimeted file using a character not in your file (like the semicolon)
3) Open it in the program with regular expression replacement
4) Perform a regular expression find replace to create the commands to rename you files
5) Change the file extension to "bat"
6) Run the script
If you are using vim, you would navigate to the folder you saved your file and type:
vim has no gui, so you have to type all the commands...
if your format is <filename>;<Name> type the following string pattern:
: the colon gets you a prompt
%s/\([^;]*\);\([^;]*\)/rename "\1" "\2.jpg"/
where jpg is your file type
\( \) denotes it as a reference
[^;] says to take any character but a ";"
* means accept any number of the previous set, meaning any group of characters that do not contain a ";"
the \1 and \2 refer to your previous references.
this will change the line:
rename "file.jpg" "Doe, John.jpg"
if you let me know how the file is layed out I can get you the exact search string.
then finally you would type ":wq" to save and close the file.
Regular expressions are very powerful, and it really will save you a lot of time in a lot of tasks if you get to know them well.
Hope that helps,
mail merge script
Java or VB it doesn't matter. I was hoping to write it in Java ... but thought that the file thing would make it easier in VB. If you have a chance, I would appreciate any help.
The JS Way
1) Export the file as a csv (comma separated values). This is done manually from Excel.
2) Write a JS script that reads the csv a line at a time.
3) Break each line into its component parts. JS does actually have very good regular expression support, but a simple String.split(",") call may be sufficient.
4) Use the JS File APIs to rename, copy, or do whatever it is you need to do with the files.
There are other ways of doing this, but you have PS which means you have JS available. Personally, this is the kind of problem that I would use perl or bash to solve.
|Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Help needed to merge a face on to a picture!||jamesatkins||Image Help||10||05-01-2007 02:16 PM|
|merge photos together||kewl_head||Photo Compositing||5||09-09-2005 07:12 PM|
|how does PS merge layers?||mediatevictoria||Photo Compositing||9||05-28-2004 09:46 AM|
|Can't merge layers when creating mask||BrianF||Hidden Power Support||1||06-18-2003 05:59 PM|
|Mail Washer||Ed_L||Software||3||02-05-2003 05:48 AM|