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

Open Folder

Participant ,
Feb 21, 2011 Feb 21, 2011

I have a folder on the C drive called "Container". Since I often have to open pictures from a camera and Windows always remembers the last task I can not write an action which always opens this particular folder.

Can a Script be written that always will open this folder regardless what was opened before?

TOPICS
Actions and scripting
17.6K
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

Community Expert , Feb 21, 2011 Feb 21, 2011

Try this

var dir = Folder('C:/Container');

var files = dir.openDlg('This is always the same folder?','',true);

open(File(files));

I still think your description reads like your trying to create some sort of a collage.  What you call a Background sounds like some sort of Template files with image placement selections. If this is so I still think you should look at my collage toolkit.  The collages it creates are layered PSD documents that you can tweak and move the image about.  Your Images are plac

...
Translate
Adobe
Guide ,
Feb 21, 2011 Feb 21, 2011

Yes a script can define the same given input folder to use all the time. This could not be passed as an Array for action input or at least I don't think so? However the script could obtain the files for you and process each by running your action…

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
Community Expert ,
Feb 21, 2011 Feb 21, 2011

You may be able to do what Muppet Mark wrote in an action without writing a script record a single step action. Action step menu File>Automate>Batch and in the Batch Dialog set up the action set and action, source folder and the desternation option you want to use like "save and close" then click OK.  When  you record this action have only one file in the source folder. After BATCH runs click stop to end the action recording. Expand the action you only want one step in the action the batch step. Depending on the output options used there may be a close recorded before the batch step. Delete all steps except the batch step.

JJMack
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
Participant ,
Feb 21, 2011 Feb 21, 2011

A clever trick, but I need only to open the folder. Please read my explanation in the reply to Mark.

The script skould only open the folder Container on the C drive nothing else.

Yhank you for your input.

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
Guide ,
Feb 21, 2011 Feb 21, 2011

Im not very good when it comes to PC paths but 'Bridge' does have a browse to 'app.browseTo(someFolder)' if you want this to happen from the Photoshop end then send this in a 'bridgetalk' message… kind of like this…

// Put your path here… var f = Folder(Folder.desktop+'/PS JUNK'); function openBridge(folder) {      var bt = new BridgeTalk();      bt.target = 'bridge';      bt.body ='app.browseTo("'+folder+'");';      bt.send(); }; openBridge(f);

If Bridge is not running the message will launch it… The only thing I don't like is on the mac it also opens where Bridge was last too. Never did get around to check if running first then close default window then browse…

if you just need regular Finder/Explorer kind of open folder then this should do…

// Put your path here… var f = Folder(Folder.desktop+'/PS JUNK'); f.execute();

Im not really sure which you mean?

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
Valorous Hero ,
Feb 21, 2011 Feb 21, 2011

Try this Mark..

// Put your path here…
var f = Folder(Folder.desktop + "/PS JUNK").fsName;

function openBridge(folder) {
     var bt = new BridgeTalk();
     bt.target = 'bridge';
     bt.body ='app.document.thumbnail = "'+folder+'";';
     bt.send();
};

openBridge(f);

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
Participant ,
Feb 21, 2011 Feb 21, 2011

I do not want the sript to get the files in the Folder and it should not run an action.

I ussually take 3 pictures and save them in a folder on the C drive named Container then click on a Background in Bridge which invokes the Event Manager which is set to run an action. This action loads saved Selections and pasts picture 1 into the selection named Picture 1 and then Picture 2 into Selection 2 same for picture 3 into Selection 3.

Now customer wants to put picture 2 into the selection 1. No problem to do that I have an action with 2 stops one stop after opening the Folder. There I select the wanted picture and the action continues to the next stop which is to select the saved selection and it psts this picture into the be me selected Selection. Works great but since I always must open files from the camera I also must navigate all the time to the Folder Container on the C drive.

The script has only to open this folder nothing else.

Thanks for your input.

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
Community Expert ,
Feb 21, 2011 Feb 21, 2011

It sound like what you want to do is have Photoshop open it Open Dialog for a particular folder and you decovered that if you recorded an action and insert a menu item "File Open" when the action was run you neven knew which folder the file open dialog will defalt to.  That is the nature of the beast.  It seems to default to a folder reciently accessed by Photoshop.  I think I remember trying to do what tou want to do by having an action do something first to the folder I wanted the file open menu item to default to like save a new file into it. However I could never get it to work Photoshop or windows seemd to remenber some folder and I couldn't get it to forget that one and remembet the folder I just saver a temp file into.  A script can process the files in a folder and by retrieving the filename in the folder and open  all, some or none of the files in the folder. So it there is something unique you know about the file you doing to open you may be able to write a script that would find and open that file and terminate thus leaving the file open and active in Photoshop.

JJMack
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
Participant ,
Feb 21, 2011 Feb 21, 2011

Yes you are right I can not go to a specific folder with an action. The only way to do this I guess is with a script, and the script has only to open the folder.

I will select the file by clicking on it. The file selection can not be automated because it is always a different one.

There are already two scripts put up here but I have no knowledge of modifying them to go to my folder named Container on the C drive. Have modifyed the string several times in different ways but no go.

Thanks for all your input here.

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
Mentor ,
Feb 21, 2011 Feb 21, 2011
<snip> and the script has only to open the folder.

Neither Photoshop or a Photoshop script can open a folder.

I don't think what you want done can be done with a script either.

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
Community Expert ,
Feb 21, 2011 Feb 21, 2011

It also sound like to me that your trying to create a Collage where the "Background" you select has some saved selections you use to insert your images into. If that is the case I created a solution some time ago you may be able to use. My package contains Script to populate collage template (Your Background Selection).  It may be all you would need to do to you Background Templates is the renames the saved selection alpha channels to "Image 1", "Image 2", ... "Image n" . My package contain both inteavtive and batch scripts for populating collages.  Check out my Photo Collage Toolkit  package http://www.mouseprints.net/old/dpr/PhotoCollageToolkit.html

JJMack
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
Guide ,
Feb 21, 2011 Feb 21, 2011

This should always take you back to a folder to open files from?

var dir = Folder(Folder.desktop+'/PS JUNK/Testing Links'); var files = dir.openDlg('This is always the same folder?','',true);

It no care where I been last…

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
Participant ,
Feb 21, 2011 Feb 21, 2011

Could you please write in the string to go to my folder?

It's a folder named Container and it is located on the C drive.

I tried various typings but to no avail.

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
Community Expert ,
Feb 21, 2011 Feb 21, 2011

Try this

var dir = Folder('C:/Container');

var files = dir.openDlg('This is always the same folder?','',true);

open(File(files));

I still think your description reads like your trying to create some sort of a collage.  What you call a Background sounds like some sort of Template files with image placement selections. If this is so I still think you should look at my collage toolkit.  The collages it creates are layered PSD documents that you can tweak and move the image about.  Your Images are placed into the collage as smart objects to retain image quality.  The Batch script will remember the last settings used like template file used and the source image folder (your Container) and also the output folder. PSD Files will always be saved so you can tweak them. Its dialog looks something like this:

http://www.mouseprints.net/old/dpr/CollageDialog.jpg

JJMack
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
Mentor ,
Feb 21, 2011 Feb 21, 2011

JJMack wrote:

Try this

var dir = Folder('C:/Container');

var files = dir.openDlg('This is always the same folder?','',true);

open(File(files));

That will not work if more than one file is selected. If you want to open more than one file you need to do something like this.

var dir = Folder('C:/Container');
var files = dir.openDlg('This is always the same folder?','',true);
if( files !=null ){
     for(var f = 0;f< files.length;f++){
          // really should check that the file object is an image file
          // that Photoshop can open
          open(files);
     }
}

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
Community Expert ,
Feb 21, 2011 Feb 21, 2011

I think he want to do one file at a time interactivly and use copy paste within an action where I feel he would be better off using place that is why I wanted him to look at my collage toolkit for it uses place and automates the placement and transform. This can be done in an interactivly or in batch mode. It also only open files the Photoshop can open. Interactily using File.openDialog("Select Image" , "Select:*.nef;*.cr2;*.crw;*.dcs;*.raf;*.arw;*.orf;*.dng;*.psd;*.tif;*.jpg;*.png;*.bmp"); the script places the selected image in batch mode a little differently all files that can be opened are places into a template when template is full or images runout a collage is saved. If not full a message is generated. Many collages may be created is a single batch run.

JJMack
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
Participant ,
Feb 22, 2011 Feb 22, 2011

In my case no need for your modification because the only thing I need to open the folder. When Open I select the desired picture hit Enter picture opens and is put on the clipboard and closed. Since the Background (Template) is still open my action stops and let me select the Saved Selection I want to insert the picture.

Already wrote an Action invoking the Script and it works perfect.

See some Sample Backgrounds.

http://www.pixentral.com/show.php?picture=1feYU1yyH8lVM036gtIPUVaxGajq0

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
Mentor ,
Feb 22, 2011 Feb 22, 2011

Macro Details wrote:

In my case no need for your modification because...

Yes the original script will work if you only select one file.

However others will read this thread and perhaps one day you will want to select more than one file so I corrected the script to work either way. If JJMack did not want the script to accept multiple files he should have not set the multiSelect option to true.

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
Community Expert ,
Feb 22, 2011 Feb 22, 2011

Yes I just cut and pasted should have removed "TRUE"

JJMack
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
Guide ,
Feb 22, 2011 Feb 22, 2011

'true' was from my example but I could not get my head around exactly what was wanted at the time…

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
Mentor ,
Feb 22, 2011 Feb 22, 2011

Muppet Mark wrote:

'true' was from my example but I could not get my head around exactly what was wanted at the time…

That's ok Mark, I couldn't either.

I just wanted the open code corrected in case others reading this thread at a later date tried to use it with multiple files. It wasn't an issue with your post as you didn't include the code to open the returned file or array of files.

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
Community Expert ,
Feb 22, 2011 Feb 22, 2011

I think this is what he would want. He could name it OpenImageInFolderContainer.jsx and use it in his action to do an interactive open image file.

var dir = Folder('C:/Container');

var selectedFile = dir.openDlg("Select Image" , "Select:*.nef;*.cr2;*.crw;*.dcs;*.raf;*.arw;*.orf;*.dng;*.psd;*.tif;* .jpg;*.png;*.bmp");

if( selectedFile !=null ){open(File(selectedFile));}

JJMack
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
Participant ,
Feb 22, 2011 Feb 22, 2011

Thank you very much. Script works perfect.

I have played around with your Collage Builder and it is of course a very welcome and needed tool fo a whole lot of photographers but it is not the tool for me because I do not make Collages.

I have over 200 Backgrounds and here is how I work. Supose I am going to insert a picture into a Magazin Cover.

I take three pictures then save them into a folder named Container on the C drive. Event Manager uses the Action Set called Task Manager and the Action called 5 Pictures. Now in Bridge I click on lets say two different Magazine Covers and they are opened  the saved Selection Called Picture is loaded (A Selection is an Alpha Channel) the picture No 1 from the Container Folder is opened and put on the clipboard and closed then pastinto the selection of the Magazine.. Other Action can be uses to make the inserted picture 15% bigger or 10% smaller and color correct. Now here is when the script comes in. The customer wants the second picture inserted and I must go to the Container Folder. Without the script I had to navigate to this folder all the time.

Oh yes I could of course past into the selection all 3 pictures taken, but I can not, because some backgrounds have up to 5 saved Selections and it would slow done my computer and I had to go into the layers palette to hide and show the wanted ones. With the way I do it inserting only one picture into each selection.

Here is a Screen Shot of a few Backgrounds I have: On the left I have selections I can call up.

http://www.pixentral.com/show.php?picture=1feYU1yyH8lVM036gtIPUVaxGajq0

The pictures in the backgrounds are there for the customer to see how the backgrouds look with pictures. A script from this forum Hide All Numbered Layers runs before inserting the new pictures.

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
Community Expert ,
Feb 22, 2011 Feb 22, 2011

I have to admit I do not do much work in the Bridge. I just develop ACR settings and Rank images there and may use the image processor from the bridge to use its ranking feature filter.  However your examples all look like Collages to me.  Where you might use an image more then once in a collage sometimes.  My interactive collage populating script can do that.  You would need several actions for the three image case the four inage case and  so on.  A single script can do all you cases for a script can look at the selection and know how many images are involves.  My batch script will use the next image in the source folder for the next image. However the interactive script will happly use any image you select  you can select the same image.  Once an image is selected the script  places the images over the correct location and transform it to fit the space at that point it give the user control so they can tweak the place scale the image  and tweak the location. The alpha selection is use as a cropping mask. The difference is in my case is the selections are in the template file which you call your background.  I do not understand how you are using different selection for the same background template... I would think you would always past images into the same locatons on a particular background

JJMack
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
Participant ,
Feb 22, 2011 Feb 22, 2011

You wrote:

I do not understand how you are using different selection for the same background template... I would think you would always past images into the same locatons on a particular background.

They might be called Collages but for me a Collage is a bit different.I could call them Templates but since they are all Backgrounds I call them Backgrounds.

Each background has either one, two, three, four or five selections named Selection 1, Selection 2 etc. Each Saved Selection  will receive a different picture. I take lets say 3 pictures and an action resizes the first active one and saves it as a jpg in the folder Container with a name Picture 1, after it is saved it is closed, the next picture is resized to a sleighly smaller size saved as Picture 2 and closed. Same for the third picture. An Action takes care of this. As a matter of fact I have 4 actions with shortcuts assigned to them like Shift+F2 for saving two pictures, Shift+F3 for three pictures etc..

Now I have made Selection in Bridge like City for city backgrounds, Lovers 2 for backgrounds for lovers the 2 indicates that each background in this selection in Bridge has 2 saved selections (Alpha Channels) I named them Picture 1, Picture 2 and Picture 3 etc. Event Manager is set up so when I click on a Background (any one it does not matter how many saved Selections(Alpha Channels) it has) this background opens and loads Selection 1 then opens the Container which holds the saved pictures from the camera opens the Picture named Picture one puts it on the clipboard and and Pasts it into the selection. Next the Selection 2 is loaded and the Picture 2 from the Container is opened and put on the clipboard then closed then pasted into the Selection Called Picture 2. Same procedure for up to five selection for five different pictures in different places of the Background.

Now here comes in the new script open Container from the C drive I wrote an action for this named Change Picture. I have autoselect layers activated. If the customer wants a given picture replaced with an other one the only thing I have to do is click on the picture in the Background to activate it then run the Action which calls the script "Open Container" I select the picture wanted and this picture opens is put on the clipboard closed and then the dialog box opens (a stop in the action) for Select Selection I select the selection lets say Selection 3 and this picture is inserted over the one already there.

Before I had a sript running "Hide all Numbered Layers") but I found it not necessary to run it.

If you guys are interested to check this all out I could provide a few backgrounds, the actions and the scripts. To run it you only have to put the Folder Container and Scrips on the C drive. The backgrounds can be anywhere. You have to set up Event Manager and then in Bridge click on a background and Voila!

Interested?

Run this movie and see some thing similar.

http://www.triprism.com/products/demos.html

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